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

Commit

Permalink
Findbar focus twice should select text
Browse files Browse the repository at this point in the history
This was introduced with #5289

Fix #5289

Auditors: @diracdeltas
  • Loading branch information
bbondy committed Nov 1, 2016
1 parent c9afb91 commit 649630f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/components/findbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class FindBar extends ImmutableComponent {
componentDidUpdate (prevProps) {
if (this.props.selected) {
this.focus()
// Findbar might already be focused, so make sure select happens even if no
// onFocus event happens.
this.select()
windowActions.setFindbarSelected(false)
}
if (!this.props.findDetail || !prevProps.findDetail ||
Expand Down
16 changes: 16 additions & 0 deletions test/components/frameTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,22 @@ describe('findbar', function () {
})
})

it('focus twice without hide selects text', function * () {
yield this.app.client
.showFindbar()
.waitForElementFocus(findBarInput)
.setValue(findBarInput, 'test')
.waitUntil(function () {
return this.getValue(findBarInput).then((val) => val === 'test')
})
.showFindbar()
.waitForElementFocus(findBarInput)
.keys('x')
.waitUntil(function () {
return this.getValue(findBarInput).then((val) => val === 'x')
})
})

it('should remember the position across findbar showing', function * () {
yield this.app.client
.showFindbar()
Expand Down

1 comment on commit 649630f

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Please sign in to comment.