Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 6e5e05d

Browse files
NejcZdovcbsclifton
authored andcommitted
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
1 parent fa91aab commit 6e5e05d

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

js/contextMenus.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ function onBackButtonHistoryMenu (activeFrame, history, target) {
14591459
if (eventUtil.isForSecondaryAction(e)) {
14601460
windowActions.newFrame({
14611461
location: url,
1462-
partitionNumber: activeFrame.props.frame.get('partitionNumber')
1462+
partitionNumber: activeFrame.props.partitionNumber
14631463
}, !!e.shiftKey)
14641464
} else {
14651465
activeFrame.goToIndex(index)
@@ -1503,7 +1503,7 @@ function onForwardButtonHistoryMenu (activeFrame, history, target) {
15031503
if (eventUtil.isForSecondaryAction(e)) {
15041504
windowActions.newFrame({
15051505
location: url,
1506-
partitionNumber: activeFrame.props.frame.get('partitionNumber')
1506+
partitionNumber: activeFrame.props.partitionNumber
15071507
}, !!e.shiftKey)
15081508
} else {
15091509
activeFrame.goToIndex(index)

test/tab-components/tabTest.js

+35-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Brave = require('../lib/brave')
44
const messages = require('../../js/constants/messages')
55
const assert = require('assert')
66
const settings = require('../../js/constants/settings')
7-
const {urlInput, backButton, forwardButton, activeTab, activeTabTitle, activeTabFavicon, newFrameButton, notificationBar} = require('../lib/selectors')
7+
const {urlInput, backButton, forwardButton, activeTab, activeTabTitle, activeTabFavicon, newFrameButton, notificationBar, contextMenu} = require('../lib/selectors')
88

99
describe('tab tests', function () {
1010
function * setup (client) {
@@ -56,6 +56,40 @@ describe('tab tests', function () {
5656
.then((title) => title === 'Page 2')
5757
})
5858
})
59+
60+
it('middle click opens in the new tab', function * () {
61+
var page1 = Brave.server.url('page1.html')
62+
var page2 = Brave.server.url('page2.html')
63+
64+
yield this.app.client
65+
.tabByIndex(0)
66+
.loadUrl(page1)
67+
.windowByUrl(Brave.browserWindowUrl)
68+
.waitUntil(function () {
69+
return this.getText(activeTabTitle)
70+
.then((title) => title === 'Page 1')
71+
})
72+
.tabByIndex(0)
73+
.loadUrl(page2)
74+
.windowByUrl(Brave.browserWindowUrl)
75+
.waitUntil(function () {
76+
return this.getText(activeTabTitle)
77+
.then((title) => title === 'Page 2')
78+
})
79+
.waitForExist(backButton)
80+
.click(backButton)
81+
.waitForUrl(page1)
82+
.windowByUrl(Brave.browserWindowUrl)
83+
.waitUntil(function () {
84+
return this.getText(activeTabTitle)
85+
.then((title) => title === 'Page 1')
86+
})
87+
.waitForExist('.forwardButton')
88+
.rightClick(forwardButton)
89+
.waitForExist(contextMenu)
90+
.middleClick(`${contextMenu} [data-index="0"]`)
91+
.waitForTabCount(2)
92+
})
5993
})
6094

6195
describe('new tab signal', function () {

0 commit comments

Comments
 (0)