From 6e5e05db40f3e842764f1aefee6df7145c5b92b5 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Sat, 25 Mar 2017 16:19:48 +0100 Subject: [PATCH] Fixes back/forwad history middle click Resolves #7892 Auditors: @bsclifton Test Plan: - Open page and some sub pages - Right click on a back button - Middle click on a history item --- js/contextMenus.js | 4 ++-- test/tab-components/tabTest.js | 36 +++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/js/contextMenus.js b/js/contextMenus.js index f9d0d83f302..3a1486a6817 100644 --- a/js/contextMenus.js +++ b/js/contextMenus.js @@ -1459,7 +1459,7 @@ function onBackButtonHistoryMenu (activeFrame, history, target) { if (eventUtil.isForSecondaryAction(e)) { windowActions.newFrame({ location: url, - partitionNumber: activeFrame.props.frame.get('partitionNumber') + partitionNumber: activeFrame.props.partitionNumber }, !!e.shiftKey) } else { activeFrame.goToIndex(index) @@ -1503,7 +1503,7 @@ function onForwardButtonHistoryMenu (activeFrame, history, target) { if (eventUtil.isForSecondaryAction(e)) { windowActions.newFrame({ location: url, - partitionNumber: activeFrame.props.frame.get('partitionNumber') + partitionNumber: activeFrame.props.partitionNumber }, !!e.shiftKey) } else { activeFrame.goToIndex(index) diff --git a/test/tab-components/tabTest.js b/test/tab-components/tabTest.js index 25514ff9dcf..ec50549588b 100644 --- a/test/tab-components/tabTest.js +++ b/test/tab-components/tabTest.js @@ -4,7 +4,7 @@ const Brave = require('../lib/brave') const messages = require('../../js/constants/messages') const assert = require('assert') const settings = require('../../js/constants/settings') -const {urlInput, backButton, forwardButton, activeTab, activeTabTitle, activeTabFavicon, newFrameButton, notificationBar} = require('../lib/selectors') +const {urlInput, backButton, forwardButton, activeTab, activeTabTitle, activeTabFavicon, newFrameButton, notificationBar, contextMenu} = require('../lib/selectors') describe('tab tests', function () { function * setup (client) { @@ -56,6 +56,40 @@ describe('tab tests', function () { .then((title) => title === 'Page 2') }) }) + + it('middle click opens in the new tab', function * () { + var page1 = Brave.server.url('page1.html') + var page2 = Brave.server.url('page2.html') + + yield this.app.client + .tabByIndex(0) + .loadUrl(page1) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 1') + }) + .tabByIndex(0) + .loadUrl(page2) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 2') + }) + .waitForExist(backButton) + .click(backButton) + .waitForUrl(page1) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 1') + }) + .waitForExist('.forwardButton') + .rightClick(forwardButton) + .waitForExist(contextMenu) + .middleClick(`${contextMenu} [data-index="0"]`) + .waitForTabCount(2) + }) }) describe('new tab signal', function () {