mirror of
https://github.com/bitwarden/android.git
synced 2026-03-21 13:52:07 -05:00
[PM-17242] While on autofill search on all item types. (#4824)
This commit is contained in:
@@ -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,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user