Skip to content

Commit

Permalink
Fixes lion badge when disabled
Browse files Browse the repository at this point in the history
Resolves brave#8889

Auditors: @bsclifton

Test Plan:
- Visit any site
- Disable shields
- Lion head is grayed out
  • Loading branch information
NejcZdovc committed May 17, 2017
1 parent fe0bcc4 commit b9e3b53
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/renderer/components/navigation/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class Navigator extends React.Component {
const activeTab = tabState.getByTabId(state, activeTabId)
const activeTabShowingMessageBox = !!(activeTab && tabState.isShowingMessageBox(state, activeTabId))
const allSiteSettings = siteSettingsState.getAllSiteSettings(state, activeFrame)
const braverySettings = siteSettings.activeSettings(allSiteSettings, state, appConfig)
const activeSiteSettings = siteSettings.getSiteSettingsForURL(allSiteSettings, activeFrame.get('location'))
const braverySettings = siteSettings.activeSettings(activeSiteSettings, state, appConfig)
const enabledExtensions = extensionState.getEnabledExtensions(state)
const extensionBrowserActions = enabledExtensions
.map((extension) => {
Expand Down Expand Up @@ -254,6 +255,7 @@ class Navigator extends React.Component {
<Button iconClass='braveMenu'
l10nId='braveMenu'
testId='braveShieldButton'
test2Id={`shield-down-${this.props.shieldsDown}`}
className={cx({
braveShieldsDisabled: !this.props.shieldEnabled,
braveShieldsDown: this.props.shieldsDown,
Expand Down
11 changes: 9 additions & 2 deletions js/components/braveryPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ class BraveryPanel extends ImmutableComponent {
if (setting !== 'noScript' && (parsedUrl.protocol === 'https:' || parsedUrl.protocol === 'http:')) {
ruleKey = `https?://${parsedUrl.host}`
}
console.log(e.target.value)
appActions.changeSiteSetting(ruleKey, setting, e.target.value, this.isPrivate)
this.onReload()
}
Expand Down Expand Up @@ -186,7 +185,15 @@ class BraveryPanel extends ImmutableComponent {
</div>
<div className='braveryPanelHeaderRight'>
<div className='braveryShieldsUpDown'>
<SwitchControl onClick={this.onToggleShields} leftl10nId='shieldsDown' rightl10nId='shieldsUp' topl10nId='shields' checkedOn={shieldsUp} large />
<SwitchControl
onClick={this.onToggleShields}
leftl10nId='shieldsDown'
rightl10nId='shieldsUp'
topl10nId='shields'
testId='shields-toggle'
checkedOn={shieldsUp}
large
/>
</div>
</div>
</div>
Expand Down
34 changes: 34 additions & 0 deletions test/navbar-components/navigatorTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* global describe, it, beforeEach */

const Brave = require('../lib/brave')
const {urlInput, braveMenu, braveryPanel, braveryPanelContainer} = require('../lib/selectors')

describe('navigator component tests', function () {
function * setup (client) {
yield client
.waitForUrl(Brave.newTabUrl)
.waitForBrowserWindow()
.waitForVisible(urlInput)
}

describe('lion badge', function () {
Brave.beforeEach(this)
beforeEach(function * () {
yield setup(this.app.client)
})

it('is grayed out if shield is disabled', function * () {
yield this.app.client
.tabByIndex(0)
.loadUrl('https://clifton.io/')
.windowByUrl(Brave.browserWindowUrl)
.waitForElementCount('[data-test2-id="shield-down-false"]', 1)
.openBraveMenu(braveMenu, braveryPanel)
.waitForElementCount('[data-test-id="shields-toggle"][data-switch-status="true"]', 1)
.click('[data-test-id="shields-toggle"] .switchBackground')
.waitForElementCount('[data-test-id="shields-toggle"][data-switch-status="false"]', 1)
.click(braveryPanelContainer)
.waitForElementCount('[data-test2-id="shield-down-true"]', 1)
})
})
})

0 comments on commit b9e3b53

Please sign in to comment.