This repository was archived by the owner on Apr 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +50
-1
lines changed
browser/src/UI/components Expand file tree Collapse file tree 4 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ const getTabsFromVimTabs = createSelector(
303303 allBuffers : State . IBuffer [ ] ,
304304 ) => {
305305 return tabState . tabs . map ( ( t : State . ITab , idx : number ) => ( {
306- id : t . id ,
306+ id : idx + 1 ,
307307 name : getIdPrefix ( ( idx + 1 ) . toString ( ) , shouldShowId ) + getTabName ( t . name ) ,
308308 highlightColor : t . id === tabState . selectedTabId ? color : "transparent" ,
309309 iconFileName : showFileIcon ? getTabName ( t . name ) : "" ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const CiTests = [
2626 "Editor.BufferModifiedState" ,
2727 "Editor.OpenFile.PathWithSpacesTest" ,
2828 "Editor.TabModifiedState" ,
29+ "Editor.CloseTabWithTabModesTabsTest" ,
2930 "MarkdownPreviewTest" ,
3031 "PaintPerformanceTest" ,
3132 "QuickOpenTest" ,
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ export const getElementByClassName = (className: string) => {
2222 }
2323}
2424
25+ export const getElementsBySelector = ( selector : string ) => {
26+ const elements = document . body . querySelectorAll ( selector )
27+ return elements || [ ]
28+ }
29+
2530export const createNewFile = async (
2631 fileExtension : string ,
2732 oni : Oni . Plugin . Api ,
Original file line number Diff line number Diff line change 1+ import * as assert from "assert"
2+ import * as Oni from "oni-api"
3+
4+ import { getElementsBySelector } from "./Common"
5+
6+ export const test = async ( oni : Oni . Plugin . Api ) => {
7+ const getTabsCount = ( ) => getElementsBySelector ( ".tabs .tab" ) . length
8+ const waitForTabCount = count => oni . automation . waitFor ( ( ) => getTabsCount ( ) === count )
9+
10+ const openTab = ( ) => {
11+ const initialTabCount = getTabsCount ( )
12+ oni . automation . sendKeys ( ":tabnew" )
13+ oni . automation . sendKeys ( "<cr>" )
14+ return waitForTabCount ( initialTabCount + 1 )
15+ }
16+
17+ const closeLastTabWithMouse = ( ) => {
18+ const tabs = getElementsBySelector ( ".tabs .tab" )
19+ const closeButton = tabs [ tabs . length - 1 ] . querySelector ( ".corner.enable-hover" )
20+ closeButton . click ( )
21+ return waitForTabCount ( tabs . length - 1 )
22+ }
23+
24+ await oni . automation . waitForEditors ( )
25+
26+ // 1. Create two tabs, then close the last on
27+ await openTab ( )
28+ await openTab ( )
29+ await closeLastTabWithMouse ( )
30+
31+ // 3. Open another tab
32+ await openTab ( )
33+
34+ // 4.1 Attempt to close it
35+ await closeLastTabWithMouse ( )
36+ }
37+
38+ // Bring in custom config.
39+ export const settings = {
40+ config : {
41+ "tabs.mode" : "tabs" ,
42+ } ,
43+ }
You can’t perform that action at this time.
0 commit comments