This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tabs so that they use the correct id when closing/focusing (#1761)
* Fix tabs so that they use the correct id when closing/focusing * Add integration test for opening/closing tabs with tabs.modes set to tabs
- Loading branch information
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as assert from "assert" | ||
import * as Oni from "oni-api" | ||
|
||
import { getElementsBySelector } from "./Common" | ||
|
||
export const test = async (oni: Oni.Plugin.Api) => { | ||
const getTabsCount = () => getElementsBySelector(".tabs .tab").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 = getElementsBySelector(".tabs .tab") | ||
const closeButton = tabs[tabs.length - 1].querySelector(".corner.enable-hover") | ||
closeButton.click() | ||
return waitForTabCount(tabs.length - 1) | ||
} | ||
|
||
await oni.automation.waitForEditors() | ||
|
||
// 1. Create two tabs, then close the last on | ||
await openTab() | ||
await openTab() | ||
await closeLastTabWithMouse() | ||
|
||
// 3. Open another tab | ||
await openTab() | ||
|
||
// 4.1 Attempt to close it | ||
await closeLastTabWithMouse() | ||
} | ||
|
||
// Bring in custom config. | ||
export const settings = { | ||
config: { | ||
"tabs.mode": "tabs", | ||
}, | ||
} |