Skip to content

Commit

Permalink
feat(Input): added functionality for clear input option on ion-input
Browse files Browse the repository at this point in the history
Implemented function to handle when the clearInput button is pressed on an ion-input element
  • Loading branch information
unknown authored and unknown committed Apr 14, 2016
1 parent c594c43 commit d8e2849
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ionic/components/input/input.ts
Expand Up @@ -105,6 +105,13 @@ export class TextInput extends InputBase {
inputFocused(event) {
this.focus.emit(event);
}

/**
* @private
*/
clearTextInput() {
this._value = '';
}
}


Expand Down
5 changes: 5 additions & 0 deletions ionic/components/input/test/clear-input/e2e.ts
@@ -0,0 +1,5 @@

it('should clear input', function() {
element(by.css('.e2eClearInput')).click();
expect(by.css('.e2eClearInput').getText()).toEqual('');
});
11 changes: 11 additions & 0 deletions ionic/components/input/test/clear-input/index.ts
@@ -0,0 +1,11 @@
import {App} from 'ionic-angular';


@App({
templateUrl: 'main.html'
})
class E2EApp {
constructor() {
this.myValue = 'value';
}
}
20 changes: 20 additions & 0 deletions ionic/components/input/test/clear-input/main.html
@@ -0,0 +1,20 @@

<ion-toolbar>
<ion-title>Clear Input</ion-title>
</ion-toolbar>


<ion-content>


<ion-list>

<ion-item>
<ion-label>Text 1:</ion-label>
<ion-input class="e2eClearInput" [(ngModel)]="myParam" clearInput></ion-input>
</ion-item>


</ion-list>

</ion-content>

0 comments on commit d8e2849

Please sign in to comment.