[PM-17242] While on autofill search on all item types. (#4824)

This commit is contained in:
André Bispo
2025-03-13 11:33:12 +00:00
committed by GitHub
parent d26a2ee52a
commit e16ad44d5e
2 changed files with 25 additions and 1 deletions

View File

@@ -1049,9 +1049,15 @@ class VaultItemListingViewModel @Inject constructor(
}
private fun handleSearchIconClick() {
val searchType = if (state.autofillSelectionData != null) {
SearchType.Vault.All
} else {
state.itemListingType.toSearchType()
}
sendEvent(
event = VaultItemListingEvent.NavigateToSearchScreen(
searchType = state.itemListingType.toSearchType(),
searchType = searchType,
),
)
}

View File

@@ -339,6 +339,24 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
}
}
@Test
fun `SearchIconClick should emit NavigateToVaultSearchScreen with all search type`() = runTest {
specialCircumstanceManager.specialCircumstance = SpecialCircumstance.AutofillSelection(
autofillSelectionData = AutofillSelectionData(
framework = AutofillSelectionData.Framework.ACCESSIBILITY,
type = AutofillSelectionData.Type.LOGIN,
uri = null,
),
shouldFinishWhenComplete = false,
)
val searchType = SearchType.Vault.All
val viewModel = createVaultItemListingViewModel()
viewModel.eventFlow.test {
viewModel.trySendAction(VaultItemListingsAction.SearchIconClick)
assertEquals(VaultItemListingEvent.NavigateToSearchScreen(searchType), awaitItem())
}
}
@Test
fun `LockClick should call lockVaultForCurrentUser`() {
every { vaultRepository.lockVaultForCurrentUser() } just runs