Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,19 @@ class BrowserTabViewModelTest {
assertTrue(browserViewState().canGoForward)
}

@Test
fun whenFindInPageShowingByPressingBackOnBrowserThenViewStateUpdatedInvisibleAndDoesNotGoToPreviousPage() {
setupNavigation(isBrowsing = true, canGoBack = true)
testee.onFindInPageSelected()
testee.onUserPressedBack()

assertFalse(findInPageViewState().visible)
assertCommandIssued<Command.DismissFindInPage>()

val issuedCommand = commandCaptor.allValues.find { it is Command.NavigateBack }
assertNull(issuedCommand)
}

@Test
fun whenHomeShowingByPressingBackOnInvalidatedBrowserThenForwardButtonInactive() {
setupNavigation(isBrowsing = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,11 @@ class BrowserTabViewModel(
fun onUserPressedBack(): Boolean {
val navigation = webNavigationState ?: return false

if (currentFindInPageViewState().visible) {
dismissFindInView()
return true
}

if (!currentBrowserViewState().browserShowing) {
return false
}
Expand Down