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

Commit

Permalink
Don't do suggestion actions on non-char key presses
Browse files Browse the repository at this point in the history
Auditors: @bsclifton

Fix #5878

Test comming in a follow up commit now, just pushing without so you can get a build going
  • Loading branch information
bbondy committed May 18, 2017
1 parent afd891f commit 2a39e06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/renderer/components/navigation/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ class UrlBar extends React.Component {
case KeyCodes.DOWN:
case KeyCodes.TAB:
case KeyCodes.ESC:
case KeyCodes.LEFT:
case KeyCodes.SHIFT:
case KeyCodes.RIGHT:
return
}
if (this.props.isSelected) {
Expand Down
19 changes: 19 additions & 0 deletions test/navbar-components/urlBarSuggestionsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ describe('urlBarSuggestions', function () {
.waitForElementCount(urlBarSuggestions, 0)
})

it('deactivated suggestions do not pop back up when left or shift is pressed', function * () {
const pagePartialUrl = Brave.server.url('page')
yield this.app.client
.setInputText(urlInput, 'Page 1')
.waitForExist(urlBarSuggestions + ' li.suggestionItem[data-index="0"]')
.keys(Brave.keys.BACKSPACE)
.waitForElementCount(urlBarSuggestions, 0)
.keys(Brave.keys.LEFT)
.pause(50)
.keys(Brave.keys.SHIFT + Brave.keys.LEFT)
.pause(50)
.keys(Brave.keys.LEFT)
.pause(50)
.keys(Brave.keys.SHIFT)
.pause(50)
.waitForElementCount(urlBarSuggestions, 0)
})


it('deactivates suggestions on delete', function * () {
yield this.app.client
.setInputText(urlInput, 'Page 1')
Expand Down

0 comments on commit 2a39e06

Please sign in to comment.