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

Commit

Permalink
findbar clear button not working
Browse files Browse the repository at this point in the history
  • Loading branch information
jkup committed Oct 21, 2016
1 parent f7d18d0 commit 72ec372
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
7 changes: 2 additions & 5 deletions js/components/findbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ class FindBar extends ImmutableComponent {
}

onClear () {
windowActions.setFindDetail(this.frame, Immutable.fromJS({
searchString: '',
caseSensitivity: this.isCaseSensitive
}))
this.searchInput.value = ''
this.focus()
}

Expand Down Expand Up @@ -193,7 +190,7 @@ class FindBar extends ImmutableComponent {
value={inputValue}
onKeyDown={this.onKeyDown}
onKeyUp={this.onChange} />
<span className='searchStringContainerIcon fa fa-times'
<span className='searchStringContainerIcon fa fa-times findClear'
onClick={this.onClear} />
</div>
<span className='findMatchText'>{findMatchText}</span>
Expand Down
18 changes: 17 additions & 1 deletion test/components/frameTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it, before */

const Brave = require('../lib/brave')
const {activeWebview, findBarInput, findBarMatches, findBarNextButton, urlInput, titleBar, backButton, forwardButton} = require('../lib/selectors')
const {activeWebview, findBarInput, findBarMatches, findBarNextButton, findBarClearButton, urlInput, titleBar, backButton, forwardButton} = require('../lib/selectors')
const messages = require('../../js/constants/messages')
const assert = require('assert')

Expand Down Expand Up @@ -53,6 +53,22 @@ describe('findbar', function () {
assert.equal(match, '1 of 2')
})

it.only('should empty the input on clear', function * () {
yield this.app.client
.showFindbar()
.waitForElementFocus(findBarInput)
.setValue(findBarInput, 'test')
.waitUntil(function () {
return this.getValue(findBarInput).then((val) => val === 'test')
})

// Clicking next goes to the next match
yield this.app.client
.click(findBarClearButton)
let match = yield this.app.client.getText(findBarInput)
assert.equal(match, '')
})

it('should display no results correctly', function * () {
yield this.app.client
.showFindbar()
Expand Down
1 change: 1 addition & 0 deletions test/lib/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
findBarMatchCase: '#caseSensitivityCheckbox',
findBarNextButton: '.findButton.findNext',
findBarPrevButton: '.findButton.findPrev',
findBarClearButton: '.findClear',
braveMenu: '.braveMenu:not(.braveShieldsDisabled)',
braveMenuDisabled: '.braveMenu.braveShieldsDisabled',
adsBlockedStat: '.braveryStat.adsBlockedStat',
Expand Down

0 comments on commit 72ec372

Please sign in to comment.