From ef332b1738f4196d092e0946f50ef7f6a7e374dc Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Jun 2018 13:29:15 +0900 Subject: [PATCH 1/5] Update QA.md --- QA.md | 1 + 1 file changed, 1 insertion(+) diff --git a/QA.md b/QA.md index 0ecf292..a88680e 100644 --- a/QA.md +++ b/QA.md @@ -118,6 +118,7 @@ The behaviors of the console are tested in [Console section](#consoles). #### Misc - [ ] Select next item by Tab and previous item by Shift+Tab +- [ ] Reopen tab on *only current window* by u ### Settings From 2e9574fbea4636577b0e9f33c3650d85ae85055a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Jun 2018 14:18:21 +0900 Subject: [PATCH 2/5] Implement e2e test of view-source --- QA.md | 1 - e2e/contents/tab.test.js | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/QA.md b/QA.md index a88680e..0473126 100644 --- a/QA.md +++ b/QA.md @@ -27,7 +27,6 @@ The behaviors of the console are tested in [Console section](#consoles). #### Misc -- [ ] gf: open page source in the new tab. - [ ] y: yank current URL and show a message - [ ] p: open clipboard's URL in current tab - [ ] P: open clipboard's URL in new tab diff --git a/e2e/contents/tab.test.js b/e2e/contents/tab.test.js index 2d7f548..bb6c56f 100644 --- a/e2e/contents/tab.test.js +++ b/e2e/contents/tab.test.js @@ -163,4 +163,22 @@ describe("tab test", () => { let win = await windows.get(targetWindow.id); expect(win.tabs).to.have.lengthOf(1); }); + + it('opens view-source by gf', () => { + let target; + return Promise.resolve().then(() => { + return windows.get(targetWindow.id); + }).then((win) => { + target = win.tabs[0]; + return keys.press(target.id, 'g'); + }).then(() => { + return keys.press(target.id, 'f'); + }).then(() => { + return new Promise((resolve) => setTimeout(resolve, 300)); + }).then(() => { + return windows.get(targetWindow.id); + }).then((win) => { + expect(win.tabs.map((t) => t.url)).to.include.members([CLIENT_URL + '/', 'view-source:' + CLIENT_URL + '/']); + }); + }); }); From 413ad780a07502108c4508cdb399243567e54066 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Jun 2018 14:22:51 +0900 Subject: [PATCH 3/5] fix --- e2e/contents/navigate.test.js | 16 ++++++++-------- e2e/contents/tab.test.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e/contents/navigate.test.js b/e2e/contents/navigate.test.js index d36b167..32ed423 100644 --- a/e2e/contents/navigate.test.js +++ b/e2e/contents/navigate.test.js @@ -20,7 +20,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c'); await keys.press(tab.id, 'g'); await keys.press(tab.id, 'u'); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/a/b/'); @@ -38,7 +38,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c'); await keys.press(tab.id, 'g'); await keys.press(tab.id, 'U', { shiftKey: true }); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/'); @@ -49,11 +49,11 @@ describe("navigate test", () => { await keys.press(tab.id, 'g'); await keys.press(tab.id, 'u'); await keys.press(tab.id, 'H', { shiftKey: true }); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url, 'go back in history').to.be.equal(CLIENT_URL + '/#navigate'); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); await keys.press(tab.id, 'L', { shiftKey: true }); tab = await tabs.get(tab.id); @@ -64,7 +64,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10'); await keys.press(tab.id, '['); await keys.press(tab.id, '['); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=9'); @@ -74,7 +74,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10'); await keys.press(tab.id, ']'); await keys.press(tab.id, ']'); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 100)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=11'); @@ -84,7 +84,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10'); await keys.press(tab.id, '['); await keys.press(tab.id, '['); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=9'); @@ -94,7 +94,7 @@ describe("navigate test", () => { let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10'); await keys.press(tab.id, ']'); await keys.press(tab.id, ']'); - await new Promise(resolve => { setTimeout(() => resolve(), 10) }); + await new Promise((resolve) => setTimeout(resolve, 10)); tab = await tabs.get(tab.id); expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=11'); diff --git a/e2e/contents/tab.test.js b/e2e/contents/tab.test.js index bb6c56f..fb24011 100644 --- a/e2e/contents/tab.test.js +++ b/e2e/contents/tab.test.js @@ -174,7 +174,7 @@ describe("tab test", () => { }).then(() => { return keys.press(target.id, 'f'); }).then(() => { - return new Promise((resolve) => setTimeout(resolve, 300)); + return new Promise((resolve) => setTimeout(resolve, 500)); }).then(() => { return windows.get(targetWindow.id); }).then((win) => { From 32fb827f02cac179efc56d7c35ecbff7379f8f03 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 18 Jun 2018 21:07:23 +0900 Subject: [PATCH 4/5] fix --- e2e/contents/tab.test.js | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/e2e/contents/tab.test.js b/e2e/contents/tab.test.js index fb24011..ada3760 100644 --- a/e2e/contents/tab.test.js +++ b/e2e/contents/tab.test.js @@ -139,7 +139,7 @@ describe("tab test", () => { expect(win.tabs).to.have.lengthOf(1); await keys.press(win.tabs[0].id, 'u'); - await new Promise((resolve) => setTimeout(resolve, 100)); + await new Promise(resolve => setTimeout(resolve, 100)); win = await windows.get(targetWindow.id); expect(win.tabs).to.have.lengthOf(2); @@ -164,21 +164,15 @@ describe("tab test", () => { expect(win.tabs).to.have.lengthOf(1); }); - it('opens view-source by gf', () => { - let target; - return Promise.resolve().then(() => { - return windows.get(targetWindow.id); - }).then((win) => { - target = win.tabs[0]; - return keys.press(target.id, 'g'); - }).then(() => { - return keys.press(target.id, 'f'); - }).then(() => { - return new Promise((resolve) => setTimeout(resolve, 500)); - }).then(() => { - return windows.get(targetWindow.id); - }).then((win) => { - expect(win.tabs.map((t) => t.url)).to.include.members([CLIENT_URL + '/', 'view-source:' + CLIENT_URL + '/']); - }); + it('opens view-source by gf', async () => { + let win = await windows.get(targetWindow.id); + let tab = win.tabs[0]; + await keys.press(tab.id, 'g'); + await keys.press(tab.id, 'f'); + await new Promise(resolve => setTimeout(resolve, 500)); + + win = await windows.get(targetWindow.id); + let urls = win.tabs.map((t) => t.url) + expect(urls).to.include.members([CLIENT_URL + '/', 'view-source:' + CLIENT_URL + '/']); }); }); From 1623684bceefcaef03bfb9bef410f0422cf7c71f Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 25 Jun 2018 21:44:35 +0900 Subject: [PATCH 5/5] fix bdelete/bdelete! commands --- src/background/shared/tabs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/background/shared/tabs.js b/src/background/shared/tabs.js index 33a4fac..26e2e44 100644 --- a/src/background/shared/tabs.js +++ b/src/background/shared/tabs.js @@ -22,7 +22,7 @@ const queryByKeyword = async(keyword, excludePinned = false) => { }; const closeTabByKeywords = async(keyword) => { - let tabs = await queryByKeyword(keyword, false); + let tabs = await queryByKeyword(keyword, true); if (tabs.length === 0) { throw new Error('No matching buffer for ' + keyword); } else if (tabs.length > 1) { @@ -32,7 +32,7 @@ const closeTabByKeywords = async(keyword) => { }; const closeTabByKeywordsForce = async(keyword) => { - let tabs = await queryByKeyword(keyword, true); + let tabs = await queryByKeyword(keyword, false); if (tabs.length === 0) { throw new Error('No matching buffer for ' + keyword); } else if (tabs.length > 1) {