mirror of
https://github.com/bitwarden/android.git
synced 2024-11-22 09:25:58 +03:00
BIT-1571 Update custom field to follow the design. (#1055)
This commit is contained in:
parent
86756a4698
commit
206d25bb48
4 changed files with 16 additions and 11 deletions
|
@ -471,7 +471,7 @@ class VaultAddEditViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
CustomFieldAction.DELETE -> {
|
||||
CustomFieldAction.REMOVE -> {
|
||||
updateCommonContent { commonContent ->
|
||||
commonContent.copy(
|
||||
customFieldData = commonContent.customFieldData.filter {
|
||||
|
|
|
@ -12,5 +12,5 @@ enum class CustomFieldAction(val actionText: Text) {
|
|||
EDIT(R.string.edit.asText()),
|
||||
MOVE_UP(R.string.move_up.asText()),
|
||||
MOVE_DOWN(R.string.move_down.asText()),
|
||||
DELETE(R.string.delete.asText()),
|
||||
REMOVE(R.string.remove.asText()),
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import androidx.compose.ui.test.filterToOne
|
|||
import androidx.compose.ui.test.hasAnyAncestor
|
||||
import androidx.compose.ui.test.hasContentDescription
|
||||
import androidx.compose.ui.test.hasSetTextAction
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.isDialog
|
||||
import androidx.compose.ui.test.isPopup
|
||||
import androidx.compose.ui.test.onAllNodesWithContentDescription
|
||||
|
@ -1864,7 +1865,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Name")
|
||||
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||
.filterToOne(hasText("Name"))
|
||||
.performTextInput("TestLinked")
|
||||
|
||||
composeTestRule
|
||||
|
@ -2239,7 +2241,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Name")
|
||||
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||
.filterToOne(hasText("Name"))
|
||||
.performTextInput("TestText")
|
||||
|
||||
composeTestRule
|
||||
|
@ -2294,7 +2297,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Name")
|
||||
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||
.filterToOne(hasText("Name"))
|
||||
.performTextInput("TestBoolean")
|
||||
|
||||
composeTestRule
|
||||
|
@ -2329,7 +2333,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Name")
|
||||
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||
.filterToOne(hasText("Name"))
|
||||
.performTextInput("TestHidden")
|
||||
|
||||
composeTestRule
|
||||
|
@ -2443,7 +2448,7 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `clicking custom field edit icon and Delete option sends a CustomFieldActionSelect delete action`() {
|
||||
fun `clicking custom field edit icon and Remove option sends a CustomFieldActionSelect remove action`() {
|
||||
mutableStateFlow.value = DEFAULT_STATE_SECURE_NOTES_CUSTOM_FIELDS
|
||||
|
||||
composeTestRule
|
||||
|
@ -2452,13 +2457,13 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
|||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Delete")
|
||||
.onNodeWithText("Remove")
|
||||
.performClick()
|
||||
|
||||
verify {
|
||||
viewModel.trySendAction(
|
||||
VaultAddEditAction.Common.CustomFieldActionSelect(
|
||||
customFieldAction = CustomFieldAction.DELETE,
|
||||
customFieldAction = CustomFieldAction.REMOVE,
|
||||
customField = VaultAddEditState.Custom.BooleanField(
|
||||
itemId = "Test ID 1",
|
||||
name = "TestBoolean",
|
||||
|
|
|
@ -2105,7 +2105,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `CustomFieldActionSelect with delete action should delete the item`() = runTest {
|
||||
fun `CustomFieldActionSelect with remove action should remove the item`() = runTest {
|
||||
val customFieldData = VaultAddEditState.Custom.BooleanField(
|
||||
"TestId 3",
|
||||
"Boolean Field",
|
||||
|
@ -2136,7 +2136,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
|||
|
||||
viewModel.actionChannel.trySend(
|
||||
VaultAddEditAction.Common.CustomFieldActionSelect(
|
||||
CustomFieldAction.DELETE,
|
||||
CustomFieldAction.REMOVE,
|
||||
customFieldData,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue