|
|
@ -1,14 +1,13 @@ |
|
|
|
import * as windows from "../ambassador/src/client/windows"; |
|
|
|
import * as windows from "../ambassador/src/client/windows"; |
|
|
|
import * as tabs from "../ambassador/src/client/tabs"; |
|
|
|
import * as tabs from "../ambassador/src/client/tabs"; |
|
|
|
import * as keys from "../ambassador/src/client/keys"; |
|
|
|
import * as keys from "../ambassador/src/client/keys"; |
|
|
|
|
|
|
|
import { CLIENT_URL } from '../web-server/url'; |
|
|
|
const SERVER_URL = "localhost:11111/"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe("tab test", () => { |
|
|
|
describe("tab test", () => { |
|
|
|
let targetWindow; |
|
|
|
let targetWindow; |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
beforeEach(() => { |
|
|
|
return windows.create(SERVER_URL).then((win) => { |
|
|
|
return windows.create(CLIENT_URL).then((win) => { |
|
|
|
targetWindow = win; |
|
|
|
targetWindow = win; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -20,7 +19,7 @@ describe("tab test", () => { |
|
|
|
it('deletes tab by d', () => { |
|
|
|
it('deletes tab by d', () => { |
|
|
|
let before; |
|
|
|
let before; |
|
|
|
let targetTab; |
|
|
|
let targetTab; |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL).then((tab) => { |
|
|
|
targetTab = tab; |
|
|
|
targetTab = tab; |
|
|
|
return windows.get(targetWindow.id); |
|
|
|
return windows.get(targetWindow.id); |
|
|
|
}).then((win) => { |
|
|
|
}).then((win) => { |
|
|
@ -36,7 +35,7 @@ describe("tab test", () => { |
|
|
|
it('duplicates tab by zd', () => { |
|
|
|
it('duplicates tab by zd', () => { |
|
|
|
let before; |
|
|
|
let before; |
|
|
|
let targetTab; |
|
|
|
let targetTab; |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL).then((tab) => { |
|
|
|
targetTab = tab; |
|
|
|
targetTab = tab; |
|
|
|
return windows.get(targetWindow.id) |
|
|
|
return windows.get(targetWindow.id) |
|
|
|
}).then((win) => {; |
|
|
|
}).then((win) => {; |
|
|
@ -54,7 +53,7 @@ describe("tab test", () => { |
|
|
|
it('makes pinned by zp', () => { |
|
|
|
it('makes pinned by zp', () => { |
|
|
|
let before; |
|
|
|
let before; |
|
|
|
let targetTab; |
|
|
|
let targetTab; |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL).then((tab) => { |
|
|
|
targetTab = tab; |
|
|
|
targetTab = tab; |
|
|
|
return windows.get(targetWindow.id) |
|
|
|
return windows.get(targetWindow.id) |
|
|
|
}).then((win) => {; |
|
|
|
}).then((win) => {; |
|
|
@ -71,11 +70,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects previous tab by K', () => { |
|
|
|
it('selects previous tab by K', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -89,11 +88,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects previous tab by K rotatory', () => { |
|
|
|
it('selects previous tab by K rotatory', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 0); |
|
|
|
return tabs.selectAt(targetWindow.id, 0); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -107,11 +106,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects next tab by J', () => { |
|
|
|
it('selects next tab by J', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -125,11 +124,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects previous tab by J rotatory', () => { |
|
|
|
it('selects previous tab by J rotatory', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 3); |
|
|
|
return tabs.selectAt(targetWindow.id, 3); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -143,11 +142,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects first tab by g0', () => { |
|
|
|
it('selects first tab by g0', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -163,11 +162,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects last tab by g$', () => { |
|
|
|
it('selects last tab by g$', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
return tabs.selectAt(targetWindow.id, 2); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -183,11 +182,11 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('selects last selected tab by <C-6>', () => { |
|
|
|
it('selects last selected tab by <C-6>', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#2') |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#2') |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#3'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#3'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
return tabs.selectAt(targetWindow.id, 1); |
|
|
|
return tabs.selectAt(targetWindow.id, 1); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
@ -203,7 +202,7 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('deletes tab by d', () => { |
|
|
|
it('deletes tab by d', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1'); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
|
return keys.press(tab.id, 'd'); |
|
|
|
return keys.press(tab.id, 'd'); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
@ -215,7 +214,7 @@ describe("tab test", () => { |
|
|
|
|
|
|
|
|
|
|
|
it('does not delete pinned tab by d', () => { |
|
|
|
it('does not delete pinned tab by d', () => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1'); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
|
return tabs.update(tab.id, { pinned: true }); |
|
|
|
return tabs.update(tab.id, { pinned: true }); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
@ -230,7 +229,7 @@ describe("tab test", () => { |
|
|
|
it('deletes pinned tab by !d', () => { |
|
|
|
it('deletes pinned tab by !d', () => { |
|
|
|
let target; |
|
|
|
let target; |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
return tabs.create(targetWindow.id, SERVER_URL + '#1'); |
|
|
|
return tabs.create(targetWindow.id, CLIENT_URL + '#1'); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
|
return tabs.update(tab.id, { pinned: true }); |
|
|
|
return tabs.update(tab.id, { pinned: true }); |
|
|
|
}).then((tab) => { |
|
|
|
}).then((tab) => { |
|
|
|