mirror of
https://github.com/bitwarden/android.git
synced 2024-11-29 14:28:55 +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 ->
|
updateCommonContent { commonContent ->
|
||||||
commonContent.copy(
|
commonContent.copy(
|
||||||
customFieldData = commonContent.customFieldData.filter {
|
customFieldData = commonContent.customFieldData.filter {
|
||||||
|
|
|
@ -12,5 +12,5 @@ enum class CustomFieldAction(val actionText: Text) {
|
||||||
EDIT(R.string.edit.asText()),
|
EDIT(R.string.edit.asText()),
|
||||||
MOVE_UP(R.string.move_up.asText()),
|
MOVE_UP(R.string.move_up.asText()),
|
||||||
MOVE_DOWN(R.string.move_down.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.hasAnyAncestor
|
||||||
import androidx.compose.ui.test.hasContentDescription
|
import androidx.compose.ui.test.hasContentDescription
|
||||||
import androidx.compose.ui.test.hasSetTextAction
|
import androidx.compose.ui.test.hasSetTextAction
|
||||||
|
import androidx.compose.ui.test.hasText
|
||||||
import androidx.compose.ui.test.isDialog
|
import androidx.compose.ui.test.isDialog
|
||||||
import androidx.compose.ui.test.isPopup
|
import androidx.compose.ui.test.isPopup
|
||||||
import androidx.compose.ui.test.onAllNodesWithContentDescription
|
import androidx.compose.ui.test.onAllNodesWithContentDescription
|
||||||
|
@ -1864,7 +1865,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onNodeWithText("Name")
|
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||||
|
.filterToOne(hasText("Name"))
|
||||||
.performTextInput("TestLinked")
|
.performTextInput("TestLinked")
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
|
@ -2239,7 +2241,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onNodeWithText("Name")
|
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||||
|
.filterToOne(hasText("Name"))
|
||||||
.performTextInput("TestText")
|
.performTextInput("TestText")
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
|
@ -2294,7 +2297,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onNodeWithText("Name")
|
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||||
|
.filterToOne(hasText("Name"))
|
||||||
.performTextInput("TestBoolean")
|
.performTextInput("TestBoolean")
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
|
@ -2329,7 +2333,8 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onNodeWithText("Name")
|
.onAllNodes(hasAnyAncestor(isDialog()))
|
||||||
|
.filterToOne(hasText("Name"))
|
||||||
.performTextInput("TestHidden")
|
.performTextInput("TestHidden")
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
|
@ -2443,7 +2448,7 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
|
|
||||||
@Suppress("MaxLineLength")
|
@Suppress("MaxLineLength")
|
||||||
@Test
|
@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
|
mutableStateFlow.value = DEFAULT_STATE_SECURE_NOTES_CUSTOM_FIELDS
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
|
@ -2452,13 +2457,13 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onNodeWithText("Delete")
|
.onNodeWithText("Remove")
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
verify {
|
verify {
|
||||||
viewModel.trySendAction(
|
viewModel.trySendAction(
|
||||||
VaultAddEditAction.Common.CustomFieldActionSelect(
|
VaultAddEditAction.Common.CustomFieldActionSelect(
|
||||||
customFieldAction = CustomFieldAction.DELETE,
|
customFieldAction = CustomFieldAction.REMOVE,
|
||||||
customField = VaultAddEditState.Custom.BooleanField(
|
customField = VaultAddEditState.Custom.BooleanField(
|
||||||
itemId = "Test ID 1",
|
itemId = "Test ID 1",
|
||||||
name = "TestBoolean",
|
name = "TestBoolean",
|
||||||
|
|
|
@ -2105,7 +2105,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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(
|
val customFieldData = VaultAddEditState.Custom.BooleanField(
|
||||||
"TestId 3",
|
"TestId 3",
|
||||||
"Boolean Field",
|
"Boolean Field",
|
||||||
|
@ -2136,7 +2136,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
|
|
||||||
viewModel.actionChannel.trySend(
|
viewModel.actionChannel.trySend(
|
||||||
VaultAddEditAction.Common.CustomFieldActionSelect(
|
VaultAddEditAction.Common.CustomFieldActionSelect(
|
||||||
CustomFieldAction.DELETE,
|
CustomFieldAction.REMOVE,
|
||||||
customFieldData,
|
customFieldData,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue