mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1838935 - Inactive tabs not selectable in multi-select mode
When in tabs tray and in multi select mode, the user should not be able to select inactive tabs.
This commit is contained in:
parent
af3b8d4be8
commit
62eb8dcdae
@ -532,7 +532,9 @@ class DefaultTabsTrayController(
|
||||
handleNavigateToBrowser()
|
||||
}
|
||||
tab.id in selected.map { it.id } -> handleTabUnselected(tab)
|
||||
else -> tabsTrayStore.dispatch(TabsTrayAction.AddSelectTab(tab))
|
||||
source != TrayPagerAdapter.INACTIVE_TABS_FEATURE_NAME -> {
|
||||
tabsTrayStore.dispatch(TabsTrayAction.AddSelectTab(tab))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,6 +650,37 @@ class DefaultTabsTrayControllerTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN at least a tab is selected and the user is in multi select mode WHEN the user taps an inactive tab THEN that tab will not be selected`() {
|
||||
val middleware = CaptureActionsMiddleware<TabsTrayState, TabsTrayAction>()
|
||||
trayStore = TabsTrayStore(middlewares = listOf(middleware))
|
||||
trayStore.dispatch(TabsTrayAction.EnterSelectMode)
|
||||
trayStore.waitUntilIdle()
|
||||
val controller = spyk(createController())
|
||||
val normalTab = TabSessionState(
|
||||
id = "1",
|
||||
content = ContentState(
|
||||
url = "www.mozilla.com",
|
||||
),
|
||||
)
|
||||
val inactiveTab = TabSessionState(
|
||||
id = "2",
|
||||
content = ContentState(
|
||||
url = "www.google.com",
|
||||
),
|
||||
)
|
||||
|
||||
trayStore.dispatch(TabsTrayAction.EnterSelectMode)
|
||||
trayStore.dispatch(TabsTrayAction.AddSelectTab(normalTab))
|
||||
trayStore.waitUntilIdle()
|
||||
|
||||
controller.handleTabSelected(inactiveTab, TrayPagerAdapter.INACTIVE_TABS_FEATURE_NAME)
|
||||
|
||||
middleware.assertLastAction(TabsTrayAction.AddSelectTab::class) {
|
||||
assertEquals(normalTab, it.tab)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN the user selects only the current tab WHEN the user forces tab to be inactive THEN tab does not become inactive`() {
|
||||
val currentTab = TabSessionState(content = mockk(), id = "currentTab", createdAt = 11)
|
||||
|
Loading…
Reference in New Issue
Block a user