You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
Kotlin
46 lines
1.6 KiB
Kotlin
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.fenix.tabstray
|
|
|
|
import io.mockk.mockk
|
|
import io.mockk.verifySequence
|
|
import org.junit.Test
|
|
import mozilla.components.concept.tabstray.Tab
|
|
|
|
class DefaultTabsTrayInteractorTest {
|
|
val controller: TabsTrayController = mockk(relaxed = true)
|
|
val trayInteractor = DefaultTabsTrayInteractor(controller)
|
|
|
|
@Test
|
|
fun `GIVEN user selecting a new tray page WHEN onTrayPositionSelected is called THEN the Interactor delegates the controller`() {
|
|
trayInteractor.onTrayPositionSelected(14, true)
|
|
|
|
verifySequence { controller.handleTrayScrollingToPosition(14, true) }
|
|
}
|
|
|
|
@Test
|
|
fun `GIVEN user selecting a new browser tab WHEN onBrowserTabSelected is called THEN the Interactor delegates the controller`() {
|
|
trayInteractor.onBrowserTabSelected()
|
|
|
|
verifySequence { controller.handleNavigateToBrowser() }
|
|
}
|
|
|
|
@Test
|
|
fun `GIVEN user deleted one browser tab page WHEN onDeleteTab is called THEN the Interactor delegates the controller`() {
|
|
trayInteractor.onDeleteTab("testTabId")
|
|
|
|
verifySequence { controller.handleTabDeletion("testTabId") }
|
|
}
|
|
|
|
@Test
|
|
fun `GIVEN user deleted multiple browser tabs WHEN onDeleteTabs is called THEN the Interactor delegates the controller`() {
|
|
val tabsToDelete = listOf<Tab>(mockk(), mockk())
|
|
|
|
trayInteractor.onDeleteTabs(tabsToDelete)
|
|
|
|
verifySequence { controller.handleMultipleTabsDeletion(tabsToDelete) }
|
|
}
|
|
}
|