diff --git a/packages/angular/demo/e2e/inputs.e2e-spec.ts b/packages/angular/demo/e2e/inputs.e2e-spec.ts index 8c875c6920..a004fdb61d 100644 --- a/packages/angular/demo/e2e/inputs.e2e-spec.ts +++ b/packages/angular/demo/e2e/inputs.e2e-spec.ts @@ -12,11 +12,65 @@ describe('Demo Inputs Page', () => { expect(page.getTitleText()).toEqual('Ionic Core Inputs Demo'); }); - describe('input one', () => { + describe('text input', () => { it('should display the starting text', () => { page.navigateTo(); const el = page.getIonicTextInput(); expect(el.getAttribute('value')).toEqual('This is the Ionic Text Input'); }); + + it('should reflect back the entered data', () => { + page.navigateTo(); + const el = page.getIonicTextInputEditable(); + el.clear(); + el.sendKeys('I am new text'); + expect(page.getIonicTextInputOutputText()).toEqual('I am new text'); + }); + }); + + describe('textarea input', () => { + it('should display the starting text', () => { + page.navigateTo(); + const el = page.getIonicTextareaInput(); + expect(el.getAttribute('value')).toEqual('This is the Ionic Textarea Input'); + }); + + it('should reflect back the entered data', () => { + page.navigateTo(); + const el = page.getIonicTextareaInputEditable(); + el.clear(); + el.sendKeys('I am new text'); + expect(page.getIonicTextareaInputOutputText()).toEqual('I am new text'); + }); + }); + + describe('checkbox input', () => { + it('should be set the initial value', () => { + page.navigateTo(); + const el = page.getIonicCheckbox(); + expect(el.getAttribute('checked')).toEqual('true'); + }); + + it('should reflect toggling the value', () => { + page.navigateTo(); + const el = page.getIonicCheckbox(); + el.click(); + expect(page.getIonicCheckboxOutputText()).toEqual('false'); + }); + }); + + describe('toggle input', () => { + it('should be set the initial value', () => { + page.navigateTo(); + const el = page.getIonicToggle(); + expect(el.getAttribute('checked')).toBeNull(); + }); + + it('should reflect toggling the value', () => { + page.navigateTo(); + const el = page.getIonicToggle(); + el.click(); + expect(page.getIonicToggleOutputText()).toEqual('true'); + }); }); }); diff --git a/packages/angular/demo/e2e/inputs.po.ts b/packages/angular/demo/e2e/inputs.po.ts index 165985d22a..7ad749d1fb 100644 --- a/packages/angular/demo/e2e/inputs.po.ts +++ b/packages/angular/demo/e2e/inputs.po.ts @@ -5,18 +5,6 @@ export class InputsPage { return browser.get('/inputs'); } - getTitleText() { - return element(by.css('.title')).getText(); - } - - getIonicTextInput() { - return element(by.id('ionTextInput')); - } - - getIonicTextInputOutputText() { - return element(by.id('ionTextInputOutput')).getText(); - } - getIonicCheckbox() { return element(by.id('ionCheckbox')); } @@ -24,4 +12,42 @@ export class InputsPage { getIonicCheckboxOutputText() { return element(by.id('ionCheckboxOutput')).getText(); } + + getIonicToggle() { + return element(by.id('ionToggle')); + } + + getIonicToggleOutputText() { + return element(by.id('ionToggleOutput')).getText(); + } + + getTitleText() { + return element(by.css('.title')).getText(); + } + + getIonicTextareaInput() { + return element(by.id('ionTextareaInput')); + } + + getIonicTextareaInputEditable() { + const parent = this.getIonicTextareaInput(); + return parent.all(by.css('textarea')).first(); + } + + getIonicTextareaInputOutputText() { + return element(by.id('ionTextareaInputOutput')).getText(); + } + + getIonicTextInput() { + return element(by.id('ionTextInput')); + } + + getIonicTextInputEditable() { + const parent = this.getIonicTextInput(); + return parent.all(by.css('input')).first(); + } + + getIonicTextInputOutputText() { + return element(by.id('ionTextInputOutput')).getText(); + } } diff --git a/packages/angular/demo/src/app/inputs/inputs-test-page.component.html b/packages/angular/demo/src/app/inputs/inputs-test-page.component.html index 9e27f2ea41..edddc7683e 100644 --- a/packages/angular/demo/src/app/inputs/inputs-test-page.component.html +++ b/packages/angular/demo/src/app/inputs/inputs-test-page.component.html @@ -23,7 +23,7 @@ Ionic Text Input - + @@ -35,12 +35,12 @@ Ionic Text Area Input - + Ionic Text Input: - {{ionTextareaInput}} + {{ionTextareaInput}} @@ -80,7 +80,7 @@ Ionic Toggle: - {{ionToggle}} + {{ionToggle}}