Skip to content

Commit

Permalink
fix(searchbar): only trigger the input event on clear if there is a v…
Browse files Browse the repository at this point in the history
…alue

fixes #6382
  • Loading branch information
brandyscarney committed Jun 9, 2016
1 parent b4028c6 commit 99fdcc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/components/searchbar/searchbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,11 @@ export class Searchbar extends Ion {
clearInput() {
this.ionClear.emit(this);

this.value = '';
this.onChange(this.value);
this.ionInput.emit(this);
if (isPresent(this.value) && this.value !== '') {
this.value = '';
this.onChange(this.value);
this.ionInput.emit(this);
}

this.blurInput = false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/components/searchbar/test/floating/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ class E2EApp {
defaultCancel: string = '';

onClearSearchbar(searchbar) {
console.log("Clicked clear input on", searchbar.value);
console.log("ionClear", searchbar.value);
}

onCancelSearchbar(searchbar) {
console.log("Clicked cancel button with", searchbar.value);
console.log("ionCancel", searchbar.value);
}

triggerInput(searchbar) {
console.log("Triggered input", searchbar.value);
console.log("ionInput", searchbar.value);
}

inputBlurred(searchbar) {
console.log("Blurred input", searchbar.value);
console.log("ionBlur", searchbar.value);
}

inputFocused(searchbar) {
console.log("Focused input", searchbar.value);
console.log("ionFocus", searchbar.value);
}
}

Expand Down

0 comments on commit 99fdcc0

Please sign in to comment.