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 @@ -3248,6 +3248,21 @@ class BrowserTabViewModelTest {
assertCommandIssued<Navigate>()
}

@Test
fun whenSubmittedQueryAndNavigationStateIsNullThenResetHistoryCommandSent() {
whenever(mockOmnibarConverter.convertQueryToUrl("nytimes.com", null)).thenReturn("nytimes.com")
testee.onUserSubmittedQuery("nytimes.com")
assertCommandIssued<Command.ResetHistory>()
}

@Test
fun whenSubmittedQueryAndNavigationStateIsNotNullThenResetHistoryCommandNotSent() {
setupNavigation(isBrowsing = true)
whenever(mockOmnibarConverter.convertQueryToUrl("nytimes.com", null)).thenReturn("nytimes.com")
testee.onUserSubmittedQuery("nytimes.com")
assertCommandNotIssued<Command.ResetHistory>()
}

private suspend fun givenFireButtonPulsing() {
whenever(mockUserStageStore.getUserAppStage()).thenReturn(AppStage.DAX_ONBOARDING)
dismissedCtaDaoChannel.send(listOf(DismissedCta(CtaId.DAX_DIALOG_TRACKERS_FOUND)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class BrowserTabViewModel(
}

private fun shouldClearHistoryOnNewQuery(): Boolean {
val navigation = webNavigationState ?: return false
val navigation = webNavigationState ?: return true
return !currentBrowserViewState().browserShowing && navigation.hasNavigationHistory
}

Expand Down