mirror of
https://github.com/bitwarden/android.git
synced 2024-11-22 17:36:01 +03:00
Actions block allows testTag (#1122)
This commit is contained in:
parent
53c241b4d7
commit
b649288948
5 changed files with 14 additions and 4 deletions
|
@ -50,6 +50,7 @@ fun BitwardenTextFieldWithActions(
|
|||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
trailingIconContent: (@Composable () -> Unit)? = null,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
actionsTestTag: String? = null,
|
||||
textFieldTestTag: String? = null,
|
||||
) {
|
||||
Row(
|
||||
|
@ -73,7 +74,10 @@ fun BitwardenTextFieldWithActions(
|
|||
shouldAddCustomLineBreaks = shouldAddCustomLineBreaks,
|
||||
visualTransformation = visualTransformation,
|
||||
)
|
||||
BitwardenRowOfActions(actions)
|
||||
BitwardenRowOfActions(
|
||||
modifier = Modifier.run { actionsTestTag?.let { semantics { testTag = it } } ?: this },
|
||||
actions = actions,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,12 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
|||
* layout individual icons or buttons.
|
||||
*/
|
||||
@Composable
|
||||
fun BitwardenRowOfActions(actions: @Composable RowScope.() -> Unit) {
|
||||
fun BitwardenRowOfActions(
|
||||
modifier: Modifier = Modifier,
|
||||
actions: @Composable RowScope.() -> Unit,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(start = 8.dp),
|
||||
modifier = modifier.padding(start = 8.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
content = actions,
|
||||
|
|
|
@ -39,6 +39,7 @@ fun BitwardenStepper(
|
|||
isIncrementEnabled: Boolean = true,
|
||||
isDecrementEnabled: Boolean = true,
|
||||
textFieldReadOnly: Boolean = true,
|
||||
stepperActionsTestTag: String? = null,
|
||||
increaseButtonTestTag: String? = null,
|
||||
decreaseButtonTestTag: String? = null,
|
||||
) {
|
||||
|
@ -53,6 +54,7 @@ fun BitwardenStepper(
|
|||
value = clampedValue
|
||||
?.toString()
|
||||
?: ZERO_WIDTH_CHARACTER,
|
||||
actionsTestTag = stepperActionsTestTag,
|
||||
actions = {
|
||||
BitwardenIconButtonWithResource(
|
||||
iconRes = IconResource(
|
||||
|
|
|
@ -64,7 +64,7 @@ fun BitwardenSwitchWithActions(
|
|||
onCheckedChange = null,
|
||||
)
|
||||
|
||||
BitwardenRowOfActions(actions)
|
||||
BitwardenRowOfActions(actions = actions)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -830,6 +830,7 @@ private fun PassphraseNumWordsCounterItem(
|
|||
value = coercedNumWords,
|
||||
range = minValue..maxValue,
|
||||
onValueChange = onPassphraseNumWordsCounterChange,
|
||||
stepperActionsTestTag = "NumberOfWordsStepper",
|
||||
increaseButtonTestTag = "NumberOfWordsIncreaseButton",
|
||||
decreaseButtonTestTag = "NumberOfWordsDecreaseButton",
|
||||
modifier = Modifier
|
||||
|
|
Loading…
Reference in a new issue