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 #5407 from brave/advanced-settings-button
Browse files Browse the repository at this point in the history
payments advanced settings button hidden when payments disabled
  • Loading branch information
bsclifton authored Nov 5, 2016
2 parents 951a127 + 7e0d8ed commit 56ca390
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ class PaymentsTab extends ImmutableComponent {
<span data-l10n-id='off' />
<SettingCheckbox dataL10nId='on' prefKey={settings.PAYMENTS_ENABLED} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</div>
{ this.props.ledgerData.get('created') ? <Button l10nId='advancedSettings' className='whiteButton inlineButton' onClick={this.props.showOverlay.bind(this, 'advancedSettings')} /> : null }
{ this.props.ledgerData.get('created') && this.enabled ? <Button l10nId='advancedSettings' className='advancedSettings whiteButton inlineButton' onClick={this.props.showOverlay.bind(this, 'advancedSettings')} /> : null }
</div>
</div>
{
Expand Down
25 changes: 24 additions & 1 deletion test/components/ledgerPanelTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it, beforeEach, before */

const Brave = require('../lib/brave')
const {urlInput, addFundsButton, paymentsStatus, paymentsWelcomePage, paymentsTab, walletSwitch, ledgerTable} = require('../lib/selectors')
const {urlInput, advancedSettings, addFundsButton, paymentsStatus, paymentsWelcomePage, paymentsTab, walletSwitch, ledgerTable} = require('../lib/selectors')
const assert = require('assert')

const prefsUrl = 'about:preferences'
Expand Down Expand Up @@ -78,6 +78,29 @@ describe('Payments Panel', function () {
}, ledgerAPIWaitTimeout)
})

it('advanced settings is hidden by default', function * () {
yield this.app.client
.tabByIndex(0)
.loadUrl(prefsUrl)
.waitForVisible(paymentsTab)
.click(paymentsTab)
.waitForVisible(paymentsWelcomePage)
.waitForVisible(walletSwitch)
.waitForVisible(advancedSettings, 100, true)
})

it('advanced settings is visible when payments are enabled', function * () {
yield this.app.client
.tabByIndex(0)
.loadUrl(prefsUrl)
.waitForVisible(paymentsTab)
.click(paymentsTab)
.waitForVisible(paymentsWelcomePage)
.waitForVisible(walletSwitch)
.click(walletSwitch)
.waitForVisible(advancedSettings, ledgerAPIWaitTimeout)
})

it('can create wallet', function * () {
yield this.app.client
.tabByIndex(0)
Expand Down
1 change: 1 addition & 0 deletions test/lib/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = {
homepageInput: '[data-l10n-id="homepageInput"]',
walletSwitch: '.enablePaymentsSwitch .switchBackground',
addFundsButton: '.addFunds',
advancedSettings: '.advancedSettings',
fundsSelectBox: '#fundsSelectBox',
paymentsStatus: '#walletStatus',
ledgerTable: '#ledgerTable',
Expand Down

0 comments on commit 56ca390

Please sign in to comment.