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

Commit 7e0d8ed

Browse files
committed
payments advanced settings button hidden when payments disabled
1 parent f7953d8 commit 7e0d8ed

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

js/about/preferences.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ class PaymentsTab extends ImmutableComponent {
12471247
<span data-l10n-id='off' />
12481248
<SettingCheckbox dataL10nId='on' prefKey={settings.PAYMENTS_ENABLED} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
12491249
</div>
1250-
{ this.props.ledgerData.get('created') ? <Button l10nId='advancedSettings' className='whiteButton inlineButton' onClick={this.props.showOverlay.bind(this, 'advancedSettings')} /> : null }
1250+
{ this.props.ledgerData.get('created') && this.enabled ? <Button l10nId='advancedSettings' className='advancedSettings whiteButton inlineButton' onClick={this.props.showOverlay.bind(this, 'advancedSettings')} /> : null }
12511251
</div>
12521252
</div>
12531253
{

test/components/ledgerPanelTest.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global describe, it, beforeEach, before */
22

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

77
const prefsUrl = 'about:preferences'
@@ -78,6 +78,29 @@ describe('Payments Panel', function () {
7878
}, ledgerAPIWaitTimeout)
7979
})
8080

81+
it('advanced settings is hidden by default', function * () {
82+
yield this.app.client
83+
.tabByIndex(0)
84+
.loadUrl(prefsUrl)
85+
.waitForVisible(paymentsTab)
86+
.click(paymentsTab)
87+
.waitForVisible(paymentsWelcomePage)
88+
.waitForVisible(walletSwitch)
89+
.waitForVisible(advancedSettings, 100, true)
90+
})
91+
92+
it('advanced settings is visible when payments are enabled', function * () {
93+
yield this.app.client
94+
.tabByIndex(0)
95+
.loadUrl(prefsUrl)
96+
.waitForVisible(paymentsTab)
97+
.click(paymentsTab)
98+
.waitForVisible(paymentsWelcomePage)
99+
.waitForVisible(walletSwitch)
100+
.click(walletSwitch)
101+
.waitForVisible(advancedSettings, ledgerAPIWaitTimeout)
102+
})
103+
81104
it('can create wallet', function * () {
82105
yield this.app.client
83106
.tabByIndex(0)

test/lib/selectors.js

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = {
5454
homepageInput: '[data-l10n-id="homepageInput"]',
5555
walletSwitch: '.enablePaymentsSwitch .switchBackground',
5656
addFundsButton: '.addFunds',
57+
advancedSettings: '.advancedSettings',
5758
fundsSelectBox: '#fundsSelectBox',
5859
paymentsStatus: '#walletStatus',
5960
ledgerTable: '#ledgerTable',

0 commit comments

Comments
 (0)