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

Commit

Permalink
Merge pull request #7893 from NejcZdovc/hotfix/#7892-middle-click
Browse files Browse the repository at this point in the history
Fixes back/forward history middle click
  • Loading branch information
bsclifton authored Mar 27, 2017
2 parents fa91aab + be780ac commit afb5329
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
36 changes: 35 additions & 1 deletion test/tab-components/tabTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit afb5329

Please sign in to comment.