diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-20 07:58:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-20 07:58:29 +0000 |
commit | c8e8b3db8ec592f43dcc3fa7920dabc26ce409b9 (patch) | |
tree | 739bcb398d389dde2453daf7bb8e407df18b3a5f /e2e/completion_open.test.js | |
parent | 15b3372c668a4b6120c614e35d3c38639a04b514 (diff) | |
parent | 2562d3b9de36d8b0a25d9ec4f67c5c1430773410 (diff) |
Merge pull request #568 from ueokande/add-e2e-tests
Add e2e tests
Diffstat (limited to 'e2e/completion_open.test.js')
-rw-r--r-- | e2e/completion_open.test.js | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/e2e/completion_open.test.js b/e2e/completion_open.test.js index 59d6b83..80628b3 100644 --- a/e2e/completion_open.test.js +++ b/e2e/completion_open.test.js @@ -129,4 +129,127 @@ describe("completion on open/tabopen/winopen commands", () => { assert(items.every(x => x.includes('https://'))); }); }) + + it('should display only specified items in "complete" property by set command', async() => { + let c = new Console(session); + + const execCommand = async(line) => { + await body.sendKeys(':'); + await session.switchToFrame(0); + await c.sendKeys(line, Key.Enter); + await session.switchToParentFrame(); + } + + const typeCommand = async(...keys) => { + await body.sendKeys(':'); + await session.switchToFrame(0); + await c.sendKeys(...keys); + } + + const cancel = async() => { + await c.sendKeys(Key.Escape); + await session.switchToParentFrame(); + } + + await execCommand('set complete=sbh'); + await typeCommand('open '); + + await eventually(async() => { + let completions = await c.getCompletions(); + let titles = completions.filter(x => x.type === 'title').map(x => x.text); + assert.deepEqual(titles, ['Search Engines', 'Bookmarks', 'History']) + }); + + await cancel(); + await execCommand('set complete=bss'); + await typeCommand('open '); + + await eventually(async() => { + let completions = await c.getCompletions(); + let titles = completions.filter(x => x.type === 'title').map(x => x.text); + assert.deepEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines']) + }); + }) + + it('should display only specified items in "complete" property by setting', async() => { + const settings = { + source: 'json', + json: `{ + "keymaps": { + ":": { "type": "command.show" } + }, + "search": { + "default": "google", + "engines": { "google": "https://google.com/search?q={}" } + }, + "properties": { + "complete": "sbh" + } + }`, + }; + await browser.storage.local.set({ settings, }); + + let c = new Console(session); + + const typeCommand = async(...keys) => { + await body.sendKeys(':'); + await session.switchToFrame(0); + await c.sendKeys(...keys); + } + + const cancel = async() => { + await c.sendKeys(Key.Escape); + await session.switchToParentFrame(); + } + + await browser.storage.local.set({ settings: { + source: 'json', + json: `{ + "keymaps": { + ":": { "type": "command.show" } + }, + "search": { + "default": "google", + "engines": { "google": "https://google.com/search?q={}" } + }, + "properties": { + "complete": "sbh" + } + }`, + }}); + await typeCommand('open '); + + await eventually(async() => { + let completions = await c.getCompletions(); + let titles = completions.filter(x => x.type === 'title').map(x => x.text); + assert.deepEqual(titles, ['Search Engines', 'Bookmarks', 'History']) + }); + + await cancel(); + + await browser.storage.local.set({ settings: { + source: 'json', + json: `{ + "keymaps": { + ":": { "type": "command.show" } + }, + "search": { + "default": "google", + "engines": { "google": "https://google.com/search?q={}" } + }, + "properties": { + "complete": "bss" + } + }`, + }}); + await typeCommand('open '); + + await eventually(async() => { + let completions = await c.getCompletions(); + let titles = completions.filter(x => x.type === 'title').map(x => x.text); + assert.deepEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines']) + }); + + + }) }); |