2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Revert "Bug 1817524 - Do not show homepage if last tab of section is closed while not in view"

This reverts commit 3c660fe68b872a9f20618846a96528ab20bfefcf.
This commit is contained in:
Christian Sadilek 2023-03-03 13:17:45 -05:00 committed by mergify[bot]
parent a5d229aa75
commit 9e88b36f02
2 changed files with 1 additions and 32 deletions

View File

@ -274,8 +274,7 @@ class DefaultTabsTrayController(
tab?.let {
val isLastTab = browserStore.state.getNormalOrPrivateTabs(it.content.private).size == 1
val isCurrentTab = browserStore.state.selectedTabId.equals(tabId)
if (!isLastTab || !isCurrentTab) {
if (!isLastTab) {
tabsUseCases.removeTab(tabId)
showUndoSnackbarForTab(it.content.private)
} else {

View File

@ -865,36 +865,6 @@ class DefaultTabsTrayControllerTest {
verify { controller.handleNavigateToBrowser() }
}
@Test
fun `GIVEN a normal tab is selected WHEN the last private tab is deleted THEN that private tab is removed and an undo snackbar is shown and original normal tab is still displayed`() {
val currentTab = TabSessionState(content = ContentState(url = "https://simulate.com", private = false), id = "currentTab")
val privateTab = TabSessionState(content = ContentState(url = "https://mozilla.com", private = true), id = "privateTab")
var showUndoSnackbarForTabInvoked = false
var navigateToHomeAndDeleteSessionInvoked = false
browserStore = BrowserStore(
initialState = BrowserState(
tabs = listOf(currentTab, privateTab),
selectedTabId = currentTab.id,
),
)
val controller = spyk(
createController(
showUndoSnackbarForTab = {
showUndoSnackbarForTabInvoked = true
},
navigateToHomeAndDeleteSession = {
navigateToHomeAndDeleteSessionInvoked = true
},
),
)
controller.handleTabSelected(currentTab, "source")
controller.handleTabDeletion("privateTab")
assertTrue(showUndoSnackbarForTabInvoked)
assertFalse(navigateToHomeAndDeleteSessionInvoked)
}
private fun createController(
navigateToHomeAndDeleteSession: (String) -> Unit = { },
selectTabPosition: (Int, Boolean) -> Unit = { _, _ -> },