From 72ec3725e9e7be3b3bff2770ea7863f0041c9b61 Mon Sep 17 00:00:00 2001 From: Jon Kuperman Date: Thu, 20 Oct 2016 16:40:45 -0700 Subject: [PATCH] findbar clear button not working --- js/components/findbar.js | 7 ++----- test/components/frameTest.js | 18 +++++++++++++++++- test/lib/selectors.js | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/js/components/findbar.js b/js/components/findbar.js index 07138801700..e2a8c04015c 100644 --- a/js/components/findbar.js +++ b/js/components/findbar.js @@ -106,10 +106,7 @@ class FindBar extends ImmutableComponent { } onClear () { - windowActions.setFindDetail(this.frame, Immutable.fromJS({ - searchString: '', - caseSensitivity: this.isCaseSensitive - })) + this.searchInput.value = '' this.focus() } @@ -193,7 +190,7 @@ class FindBar extends ImmutableComponent { value={inputValue} onKeyDown={this.onKeyDown} onKeyUp={this.onChange} /> - {findMatchText} diff --git a/test/components/frameTest.js b/test/components/frameTest.js index 78bbdcef104..3ed948c91a9 100644 --- a/test/components/frameTest.js +++ b/test/components/frameTest.js @@ -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') @@ -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() diff --git a/test/lib/selectors.js b/test/lib/selectors.js index 27569138060..de7d38c7b9a 100644 --- a/test/lib/selectors.js +++ b/test/lib/selectors.js @@ -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',