File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
androidTest/java/com/duckduckgo/app/browser
main/java/com/duckduckgo/app/browser Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -872,6 +872,19 @@ class BrowserTabViewModelTest {
872872 assertTrue(browserViewState().canGoForward)
873873 }
874874
875+ @Test
876+ fun whenFindInPageShowingByPressingBackOnBrowserThenViewStateUpdatedInvisibleAndDoesNotGoToPreviousPage () {
877+ setupNavigation(isBrowsing = true , canGoBack = true )
878+ testee.onFindInPageSelected()
879+ testee.onUserPressedBack()
880+
881+ assertFalse(findInPageViewState().visible)
882+ assertCommandIssued<Command .DismissFindInPage >()
883+
884+ val issuedCommand = commandCaptor.allValues.find { it is Command .NavigateBack }
885+ assertNull(issuedCommand)
886+ }
887+
875888 @Test
876889 fun whenHomeShowingByPressingBackOnInvalidatedBrowserThenForwardButtonInactive () {
877890 setupNavigation(isBrowsing = true )
Original file line number Diff line number Diff line change @@ -415,6 +415,11 @@ class BrowserTabViewModel(
415415 fun onUserPressedBack (): Boolean {
416416 val navigation = webNavigationState ? : return false
417417
418+ if (currentFindInPageViewState().visible) {
419+ dismissFindInView()
420+ return true
421+ }
422+
418423 if (! currentBrowserViewState().browserShowing) {
419424 return false
420425 }
You can’t perform that action at this time.
0 commit comments