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

Commit

Permalink
Fix home button
Browse files Browse the repository at this point in the history
Add property that was missed during conversion to redux component (with 174f086)

Fixes #8845

Auditors: @bridiver
  • Loading branch information
bsclifton committed May 12, 2017
1 parent 6fd0557 commit ebfdb65
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/renderer/components/navigation/navigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class NavigationBar extends React.Component {
props.activeTabShowingMessageBox = activeTabShowingMessageBox
props.locationInfo = state.get('locationInfo')
props.titleMode = titleMode
props.activeTabId = activeTabId

return props
}
Expand Down Expand Up @@ -205,7 +206,9 @@ class NavigationBar extends React.Component {
{
!this.props.titleMode && getSetting(settings.SHOW_HOME_BUTTON)
? <span className='navigationButtonContainer'>
<button data-l10n-id='homeButton'
<button
data-test-id='homeButton'
data-l10n-id='homeButton'
className='normalizeButton navigationButton homeButton'
onClick={this.onHome} />
</span>
Expand Down
1 change: 1 addition & 0 deletions test/lib/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = {
backButton: '.backforward .backButton',
forwardButton: '.backforward .forwardButton',
reloadButton: '.reloadButton',
homeButton: '[data-test-id="homeButton"]',
clearBrowsingDataButton: '[data-test-id="clearBrowsingDataButton"]',
clearBrowsingDataPanel: '[data-test-id="clearBrowsingDataPanel"]',
clearDataButton: '[data-test-id="clearDataButton"]',
Expand Down
66 changes: 64 additions & 2 deletions test/navbar-components/navigationBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const config = require('../../js/constants/config')
const {urlInput, activeWebview, activeTabFavicon, activeTab, navigatorLoadTime,
titleBar, urlbarIcon, bookmarksToolbar, navigatorNotBookmarked, navigatorBookmarked,
doneButton, allowRunInsecureContentButton, dismissAllowRunInsecureContentButton,
denyRunInsecureContentButton, dismissDenyRunInsecureContentButton, activeTabTitle} = require('../lib/selectors')
denyRunInsecureContentButton, dismissDenyRunInsecureContentButton, activeTabTitle,
homeButton} = require('../lib/selectors')
const urlParse = require('url').parse
const assert = require('assert')
const settings = require('../../js/constants/settings')
Expand All @@ -17,7 +18,7 @@ describe('navigationBar tests', function () {
.waitForUrl(Brave.newTabUrl)
.windowByUrl(Brave.browserWindowUrl)
.waitForEnabled(urlInput)
.changeSetting('general.disable-title-mode', false)
.changeSetting(settings.DISABLE_TITLE_MODE, false)
}

function * newFrame (client, frameKey = 2) {
Expand Down Expand Up @@ -1011,6 +1012,67 @@ describe('navigationBar tests', function () {
})
})

describe('home button', function () {
describe('when enabled', function () {
Brave.beforeAll(this)

before(function * () {
yield setup(this.app.client)
yield this.app.client
.changeSetting(settings.SHOW_HOME_BUTTON, true)
})

it('displays the button', function * () {
yield this.app.client
.waitForVisible(homeButton)
})

it('goes to the home page when clicked', function * () {
const page1Url = Brave.server.url('page1.html')

yield this.app.client
.changeSetting(settings.HOMEPAGE, page1Url)
.waitForVisible(homeButton)
.click(homeButton)
.waitForUrl(page1Url)
})

it('opens home page in a new tab when cmd/ctrl is pressed', function * () {
const page2Url = Brave.server.url('page2.html')

yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.changeSetting(settings.HOMEPAGE, page2Url)
.waitForVisible(homeButton)
.isDarwin().then((val) => {
if (val === true) {
return this.app.client.keys(Brave.keys.COMMAND)
} else {
return this.app.client.keys(Brave.keys.CONTROL)
}
})
.click(homeButton)
.waitForTabCount(2)
.waitForUrl(page2Url)
})
})

describe('when disabled', function () {
Brave.beforeAll(this)

before(function * () {
yield setup(this.app.client)
yield this.app.client
.changeSetting(settings.SHOW_HOME_BUTTON, false)
})

it('does not display the button', function * () {
yield this.app.client
.waitForVisible(homeButton, 500, true)
})
})
})

// need to move urlbar state to frame before enabling these
describe.skip('change tabs', function () {
Brave.beforeAll(this)
Expand Down

0 comments on commit ebfdb65

Please sign in to comment.