mirror of
https://github.com/bitwarden/android.git
synced 2024-11-23 01:46:00 +03:00
BIT-1969: Add testTags for password history (#1123)
This commit is contained in:
parent
b649288948
commit
a8670965f9
2 changed files with 8 additions and 3 deletions
|
@ -19,6 +19,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
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.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
|
@ -49,7 +51,6 @@ fun PasswordHistoryListItem(
|
|||
.then(modifier),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
var widthPx by remember(label) { mutableIntStateOf(0) }
|
||||
val textStyle = LocalNonMaterialTypography.current.sensitiveInfoMedium
|
||||
|
@ -64,6 +65,7 @@ fun PasswordHistoryListItem(
|
|||
style = textStyle,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "GeneratedPasswordValue" }
|
||||
.fillMaxWidth()
|
||||
.onGloballyPositioned { widthPx = it.size.width },
|
||||
)
|
||||
|
@ -72,6 +74,7 @@ fun PasswordHistoryListItem(
|
|||
text = supportingLabel,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.semantics { testTag = "GeneratedPasswordDateLabel" },
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -80,6 +83,7 @@ fun PasswordHistoryListItem(
|
|||
colors = IconButtonDefaults.iconButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.primary,
|
||||
),
|
||||
modifier = Modifier.semantics { testTag = "CopyPasswordValueButton" },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_copy),
|
||||
|
|
|
@ -161,16 +161,17 @@ private fun PasswordHistoryLoading(modifier: Modifier = Modifier) {
|
|||
@Composable
|
||||
private fun PasswordHistoryContent(
|
||||
state: PasswordHistoryState.ViewState.Content,
|
||||
modifier: Modifier = Modifier,
|
||||
onPasswordCopyClick: (PasswordHistoryState.GeneratedPassword) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
LazyColumn(modifier = modifier.semantics { testTag = "GeneratedPasswordRow" }) {
|
||||
LazyColumn(modifier = modifier) {
|
||||
items(state.passwords) { password ->
|
||||
PasswordHistoryListItem(
|
||||
label = password.password,
|
||||
supportingLabel = password.date,
|
||||
onCopyClick = { onPasswordCopyClick(password) },
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "GeneratedPasswordRow" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue