From 53919e6e0024fa0e59daa8c14073772569a95a2f Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Wed, 3 May 2017 03:41:40 -0300 Subject: [PATCH] Show search indicator when urlBar is empty - Auditors: @bsclifton, @nejczdovc - Close #8468 - Test Plan: covered by automated test --- app/renderer/components/navigation/urlBar.js | 5 ++++ test/navbar-components/navigationBarTest.js | 30 ++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/app/renderer/components/navigation/urlBar.js b/app/renderer/components/navigation/urlBar.js index 6bb2e50502..a3a95542e3 100644 --- a/app/renderer/components/navigation/urlBar.js +++ b/app/renderer/components/navigation/urlBar.js @@ -258,6 +258,11 @@ class UrlBar extends React.Component { if (this.suggestionLocation) { windowActions.setUrlBarSuggestions(undefined, null) } + // onChange is fired if text is cut from contextMenu + // for such cases we have to trigger render again to update urlIcon + if (e.target.value === '') { + windowActions.setNavBarUserInput('') + } } // Keeps track of which part was set for the url suffix and which diff --git a/test/navbar-components/navigationBarTest.js b/test/navbar-components/navigationBarTest.js index b361a3c58b..46f6120944 100644 --- a/test/navbar-components/navigationBarTest.js +++ b/test/navbar-components/navigationBarTest.js @@ -904,6 +904,36 @@ describe('navigationBar tests', function () { }) + describe('with no url input value', function () { + Brave.beforeAll(this) + + before(function * () { + this.page1 = Brave.server.url('page1.html') + yield setup(this.app.client) + yield this.app.client + .waitForExist(urlInput) + yield this.app.client + .keys(this.page1) + yield this.app.client + .keys(Brave.keys.ENTER) + }) + + it('shows search icon when input is empty', function * () { + // test that url is shown with proper icon + // before getting cleared + yield this.app.client + .waitForExist(urlbarIcon) + .getAttribute(urlbarIcon, 'class').then(classes => classes.includes('fa-unlock')) + + // ensure that once cleaned, search icon + // is shown instead of protocol icon + yield this.app.client + .setValue(urlInput, '') + .waitForExist(urlbarIcon) + .getAttribute(urlbarIcon, 'class').then(classes => classes.includes('fa-search')) + }) + }) + describe('with javascript url input value', function () { Brave.beforeAll(this)