From 6605d3ea99c364a8f5f9d98a33e3ac89afb035f7 Mon Sep 17 00:00:00 2001 From: chocolateboy Date: Sun, 28 Jul 2019 05:35:07 +0100 Subject: Add an option to close the current tab and select the tab to the left Add an option to tabs.close to close the current tab and select the tab to the left. Bound to `D` by default, which replaces the tabs.close.right command, which is rarely-used. [1] The old `D` behavior has been moved to `gd`. + update the README and fix some lint errors [1] https://tinyurl.com/y4mj7hjy --- e2e/settings.js | 3 ++- e2e/tab.test.js | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'e2e') diff --git a/e2e/settings.js b/e2e/settings.js index e09747f..e3e9787 100644 --- a/e2e/settings.js +++ b/e2e/settings.js @@ -24,7 +24,8 @@ module.exports = { "G": { "type": "scroll.bottom" }, "$": { "type": "scroll.end" }, "d": { "type": "tabs.close" }, - "D": { "type": "tabs.close.right" }, + "D": { "type": "tabs.close", "selectLeft": true }, + "gd": { "type": "tabs.close.right" }, "!d": { "type": "tabs.close.force" }, "u": { "type": "tabs.reopen" }, "K": { "type": "tabs.prev", "count": 1 }, diff --git a/e2e/tab.test.js b/e2e/tab.test.js index 16d61ae..aaaa5d7 100644 --- a/e2e/tab.test.js +++ b/e2e/tab.test.js @@ -55,18 +55,32 @@ describe("tab test", () => { await browser.windows.remove(win.id); }); - it('deletes tab by d', async () => { + it('deletes tab and selects right by d', async () => { + await browser.tabs.update(tabs[3].id, { active: true }); let body = await session.findElementByCSS('body'); await body.sendKeys('d'); let current = await browser.tabs.query({ windowId: win.id }); assert(current.length === tabs.length - 1); + assert(current[3].active); + assert(current[3].url === tabs[4].url); + }); + + it('deletes tab and selects left by D', async () => { + await browser.tabs.update(tabs[3].id, { active: true }); + let body = await session.findElementByCSS('body'); + await body.sendKeys(Key.Shift, 'D'); + + let current = await browser.tabs.query({ windowId: win.id }); + assert(current.length === tabs.length - 1); + assert(current[2].active); + assert(current[2].url === tabs[2].url); }); - it('deletes tabs to the right by D', async () => { + it('deletes all tabs to the right by gD', async () => { await browser.tabs.update(tabs[1].id, { active: true }); let body = await session.findElementByCSS('body'); - await body.sendKeys(Key.Shift, 'd'); + await body.sendKeys('g', Key.Shift, 'D'); let current = await browser.tabs.query({ windowId: win.id }); assert(current.length === 2); -- cgit v1.2.3