diff --git a/ionic/components/input/input.ts b/ionic/components/input/input.ts index 27f2dfe3c09..22d84542397 100644 --- a/ionic/components/input/input.ts +++ b/ionic/components/input/input.ts @@ -105,6 +105,13 @@ export class TextInput extends InputBase { inputFocused(event) { this.focus.emit(event); } + + /** + * @private + */ + clearTextInput() { + this._value = ''; + } } diff --git a/ionic/components/input/test/clear-input/e2e.ts b/ionic/components/input/test/clear-input/e2e.ts new file mode 100644 index 00000000000..be86073f5ef --- /dev/null +++ b/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(''); +}); diff --git a/ionic/components/input/test/clear-input/index.ts b/ionic/components/input/test/clear-input/index.ts new file mode 100644 index 00000000000..fb0b644bf02 --- /dev/null +++ b/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'; + } +} diff --git a/ionic/components/input/test/clear-input/main.html b/ionic/components/input/test/clear-input/main.html new file mode 100644 index 00000000000..e3f743570ef --- /dev/null +++ b/ionic/components/input/test/clear-input/main.html @@ -0,0 +1,20 @@ + + + Clear Input + + + + + + + + + + Text 1: + + + + + + +