mirror of
https://github.com/bitwarden/android.git
synced 2025-03-16 03:08:50 +03:00
[PM-10024] Force focus on Master Password or Pin input field (#3601)
This commit is contained in:
parent
23066769a1
commit
22dae88b42
3 changed files with 16 additions and 0 deletions
|
@ -196,6 +196,7 @@ fun VaultUnlockScreen(
|
|||
.testTag(state.vaultUnlockType.unlockScreenInputTestTag)
|
||||
.padding(horizontal = 16.dp)
|
||||
.fillMaxWidth(),
|
||||
autoFocus = state.showKeyboard,
|
||||
)
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
Text(
|
||||
|
|
|
@ -354,6 +354,11 @@ data class VaultUnlockState(
|
|||
*/
|
||||
val showBiometricLogin: Boolean get() = isBiometricEnabled && isBiometricsValid
|
||||
|
||||
/**
|
||||
* Indicates if we want force focus on Master Password \ PIN input field and show keyboard.
|
||||
*/
|
||||
val showKeyboard: Boolean get() = !showBiometricLogin && !hideInput
|
||||
|
||||
/**
|
||||
* Represents the various dialogs the vault unlock screen can display.
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.x8bit.bitwarden.ui.auth.feature.vaultunlock
|
|||
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsEnabled
|
||||
import androidx.compose.ui.test.assertIsFocused
|
||||
import androidx.compose.ui.test.assertIsNotEnabled
|
||||
import androidx.compose.ui.test.filterToOne
|
||||
import androidx.compose.ui.test.hasAnyAncestor
|
||||
|
@ -417,6 +418,15 @@ class VaultUnlockScreenTest : BaseComposeTest() {
|
|||
verify { viewModel.trySendAction(VaultUnlockAction.UnlockClick) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `state with input and without biometrics should request focus on input field`() {
|
||||
mutableStateFlow.update { it.copy(hideInput = false, isBiometricEnabled = false) }
|
||||
composeTestRule
|
||||
.onNodeWithText("Master password")
|
||||
.performScrollTo()
|
||||
.assertIsFocused()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `input change should send InputChanged action`() {
|
||||
val input = "abcd1234"
|
||||
|
|
Loading…
Add table
Reference in a new issue