File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting
test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1049,9 +1049,15 @@ class VaultItemListingViewModel @Inject constructor(
1049
1049
}
1050
1050
1051
1051
private fun handleSearchIconClick () {
1052
+ val searchType = if (state.autofillSelectionData != null ) {
1053
+ SearchType .Vault .All
1054
+ } else {
1055
+ state.itemListingType.toSearchType()
1056
+ }
1057
+
1052
1058
sendEvent(
1053
1059
event = VaultItemListingEvent .NavigateToSearchScreen (
1054
- searchType = state.itemListingType.toSearchType() ,
1060
+ searchType = searchType ,
1055
1061
),
1056
1062
)
1057
1063
}
Original file line number Diff line number Diff line change @@ -339,6 +339,24 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
339
339
}
340
340
}
341
341
342
+ @Test
343
+ fun `SearchIconClick should emit NavigateToVaultSearchScreen with all search type` () = runTest {
344
+ specialCircumstanceManager.specialCircumstance = SpecialCircumstance .AutofillSelection (
345
+ autofillSelectionData = AutofillSelectionData (
346
+ framework = AutofillSelectionData .Framework .ACCESSIBILITY ,
347
+ type = AutofillSelectionData .Type .LOGIN ,
348
+ uri = null ,
349
+ ),
350
+ shouldFinishWhenComplete = false ,
351
+ )
352
+ val searchType = SearchType .Vault .All
353
+ val viewModel = createVaultItemListingViewModel()
354
+ viewModel.eventFlow.test {
355
+ viewModel.trySendAction(VaultItemListingsAction .SearchIconClick )
356
+ assertEquals(VaultItemListingEvent .NavigateToSearchScreen (searchType), awaitItem())
357
+ }
358
+ }
359
+
342
360
@Test
343
361
fun `LockClick should call lockVaultForCurrentUser` () {
344
362
every { vaultRepository.lockVaultForCurrentUser() } just runs
You can’t perform that action at this time.
0 commit comments