mirror of
https://github.com/bitwarden/android.git
synced 2025-03-15 18:58:59 +03:00
BIT-1677: Add element IDs for edit item (#923)
Co-authored-by: Lucas Kivi <125697099+lucas-livefront@users.noreply.github.com>
This commit is contained in:
parent
ce3066dd54
commit
77ac4b1956
6 changed files with 36 additions and 3 deletions
|
@ -13,6 +13,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
|
@ -177,6 +179,7 @@ fun LazyListScope.vaultAddEditCardItems(
|
|||
isChecked = commonState.favorite,
|
||||
onCheckedChange = commonHandlers.onToggleFavorite,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemFavoriteToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -189,6 +192,7 @@ fun LazyListScope.vaultAddEditCardItems(
|
|||
isChecked = commonState.masterPasswordReprompt,
|
||||
onCheckedChange = commonHandlers.onToggleMasterPasswordReprompt,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "MasterPasswordRepromptToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
actions = {
|
||||
|
@ -223,6 +227,7 @@ fun LazyListScope.vaultAddEditCardItems(
|
|||
value = commonState.notes,
|
||||
onValueChange = commonHandlers.onNotesTextChange,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemNotesEntry" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -295,6 +300,7 @@ fun LazyListScope.vaultAddEditCardItems(
|
|||
)
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemOwnershipPicker" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
|
@ -7,6 +7,8 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenBasicDialogRow
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenFilledTonalButton
|
||||
|
@ -74,6 +76,6 @@ fun VaultAddEditCustomFieldsButton(
|
|||
BitwardenFilledTonalButton(
|
||||
label = stringResource(id = R.string.new_custom_field),
|
||||
onClick = { shouldShowChooserDialog = true },
|
||||
modifier = modifier,
|
||||
modifier = modifier.semantics { testTag = "NewCustomFieldButton" },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenListHeaderText
|
||||
|
@ -286,6 +288,7 @@ fun LazyListScope.vaultAddEditIdentityItems(
|
|||
isChecked = commonState.favorite,
|
||||
onCheckedChange = commonTypeHandlers.onToggleFavorite,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemFavoriteToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -298,6 +301,7 @@ fun LazyListScope.vaultAddEditIdentityItems(
|
|||
isChecked = commonState.masterPasswordReprompt,
|
||||
onCheckedChange = commonTypeHandlers.onToggleMasterPasswordReprompt,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "MasterPasswordRepromptToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
actions = {
|
||||
|
@ -332,6 +336,7 @@ fun LazyListScope.vaultAddEditIdentityItems(
|
|||
value = commonState.notes,
|
||||
onValueChange = commonTypeHandlers.onNotesTextChange,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemNotesEntry" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -417,6 +422,7 @@ fun LazyListScope.vaultAddEditIdentityItems(
|
|||
)
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemOwnershipPicker" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
|
@ -8,8 +8,11 @@ import androidx.compose.foundation.layout.navigationBarsPadding
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenListHeaderText
|
||||
|
@ -24,6 +27,7 @@ import kotlinx.collections.immutable.toImmutableList
|
|||
/**
|
||||
* The top level content UI state for the [VaultAddEditScreen].
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
fun VaultAddEditContent(
|
||||
|
@ -51,7 +55,8 @@ fun VaultAddEditContent(
|
|||
)
|
||||
|
||||
LazyColumn(
|
||||
modifier = modifier,
|
||||
modifier = modifier
|
||||
.semantics { testTagsAsResourceId = true },
|
||||
) {
|
||||
item {
|
||||
BitwardenListHeaderText(
|
||||
|
|
|
@ -17,6 +17,8 @@ import androidx.compose.runtime.setValue
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenFilledTonalButton
|
||||
|
@ -213,6 +215,7 @@ fun LazyListScope.vaultAddEditLoginItems(
|
|||
isChecked = commonState.favorite,
|
||||
onCheckedChange = commonActionHandler.onToggleFavorite,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemFavoriteToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -225,6 +228,7 @@ fun LazyListScope.vaultAddEditLoginItems(
|
|||
isChecked = commonState.masterPasswordReprompt,
|
||||
onCheckedChange = commonActionHandler.onToggleMasterPasswordReprompt,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "MasterPasswordRepromptToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
actions = {
|
||||
|
@ -259,6 +263,7 @@ fun LazyListScope.vaultAddEditLoginItems(
|
|||
value = commonState.notes,
|
||||
onValueChange = commonActionHandler.onNotesTextChange,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemNotesEntry" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -327,6 +332,7 @@ fun LazyListScope.vaultAddEditLoginItems(
|
|||
)
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemOwnershipPicker" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -371,7 +377,9 @@ private fun UsernameRow(
|
|||
},
|
||||
)
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "GenerateUsernameButton" }
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
||||
if (shouldShowDialog) {
|
||||
|
|
|
@ -12,6 +12,8 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.BitwardenListHeaderText
|
||||
|
@ -83,6 +85,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems(
|
|||
isChecked = commonState.favorite,
|
||||
onCheckedChange = commonTypeHandlers.onToggleFavorite,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemFavoriteToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -95,6 +98,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems(
|
|||
isChecked = commonState.masterPasswordReprompt,
|
||||
onCheckedChange = commonTypeHandlers.onToggleMasterPasswordReprompt,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "MasterPasswordRepromptToggle" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
actions = {
|
||||
|
@ -129,6 +133,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems(
|
|||
value = commonState.notes,
|
||||
onValueChange = commonTypeHandlers.onNotesTextChange,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemNotesEntry" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
@ -197,6 +202,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems(
|
|||
)
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ItemOwnershipPicker" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue