feat(Input): added functionality for clear input option on ion-input

Implemented function to handle when the clearInput button is pressed on an ion-input element
This commit is contained in:
unknown
2016-04-14 09:03:00 -05:00
parent c594c43108
commit d8e2849be8
4 changed files with 43 additions and 0 deletions

View File

@ -105,6 +105,13 @@ export class TextInput extends InputBase {
inputFocused(event) {
this.focus.emit(event);
}
/**
* @private
*/
clearTextInput() {
this._value = '';
}
}

View File

@ -0,0 +1,5 @@
it('should clear input', function() {
element(by.css('.e2eClearInput')).click();
expect(by.css('.e2eClearInput').getText()).toEqual('');
});

View File

@ -0,0 +1,11 @@
import {App} from 'ionic-angular';
@App({
templateUrl: 'main.html'
})
class E2EApp {
constructor() {
this.myValue = 'value';
}
}

View File

@ -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>