Ensure FAB is hidden for some Vault Screen states (#401)

This commit is contained in:
Brian Yencho
2023-12-15 12:14:01 -06:00
committed by GitHub
parent 1a3035bb2f
commit 92368b2535
3 changed files with 38 additions and 5 deletions

View File

@@ -283,6 +283,25 @@ class VaultScreenTest : BaseComposeTest() {
verify { viewModel.trySendAction(VaultAction.ExitConfirmationClick) }
}
@Test
fun `floating action button should be shown or hidden according to the state`() {
val fabDescription = "Add item"
mutableStateFlow.update { it.copy(viewState = VaultState.ViewState.Loading) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertDoesNotExist()
mutableStateFlow.update {
it.copy(viewState = VaultState.ViewState.Error("Error".asText()))
}
composeTestRule.onNodeWithContentDescription(fabDescription).assertDoesNotExist()
mutableStateFlow.update { it.copy(viewState = VaultState.ViewState.NoItems) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertIsDisplayed()
mutableStateFlow.update { it.copy(viewState = DEFAULT_CONTENT_VIEW_STATE) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertIsDisplayed()
}
@Test
fun `error dialog should be shown or hidden according to the state`() {
val errorTitle = "Error title"