import * as assert from "assert" ; import * as Oni from "oni-api" ; import { getAllTabs , getElementsBySelector , getTabCloseButtonByIndex } from "./Common" ; export const test = async ( oni ) => { const getTabsCount = ( ) => getAllTabs ( ) . length ; const waitForTabCount = count => oni . automation . waitFor ( ( ) => getTabsCount ( ) === count ) ; const openTab = ( ) => { const initialTabCount = getTabsCount ( ) ; oni . automation . sendKeys ( ":tabnew" ) ; oni . automation . sendKeys ( "<cr>" ) ; return waitForTabCount ( initialTabCount + 1 ) ; } ; const closeLastTabWithMouse = ( ) => { const tabs = getAllTabs ( ) ; const closeButton = getTabCloseButtonByIndex ( tabs . length - 1 ) ; closeButton . click ( ) ; return waitForTabCount ( tabs . length - 1 ) ; } ; await oni . automation . waitForEditors ( ) ; await openTab ( ) ; await openTab ( ) ; await closeLastTabWithMouse ( ) ; await openTab ( ) ; await closeLastTabWithMouse ( ) ; } ; export const settings = { config : { "tabs.mode" : "tabs" , } , } ;