diff --git a/packages/demos/angular/e2e/basic-inputs.e2e-spec.ts b/packages/demos/angular/e2e/basic-inputs.e2e-spec.ts index f7b2f39921..27ca3396b7 100644 --- a/packages/demos/angular/e2e/basic-inputs.e2e-spec.ts +++ b/packages/demos/angular/e2e/basic-inputs.e2e-spec.ts @@ -14,6 +14,30 @@ describe('Basic Inputs Page', () => { expect(page.getTitleText()).toEqual('Ionic Core Basic Inputs Demo'); }); + describe('search input', () => { + it('should display the starting text', () => { + page.navigateTo(); + const el = page.getIonicSearchInput(); + expect(el.getAttribute('value')).toEqual(null); + }); + + it('should reflect back the entered data', () => { + page.navigateTo(); + const el = page.getIonicSearchInputEditable(); + el.clear(); + el.sendKeys('I am new text'); + expect(page.getSearchOutput()).toEqual('I am new text'); + }); + + // it('should disable', () => { + // page.navigateTo(); + // const inp = page.getIonicSearchInputEditable(); + // const cb = page.getDisableButton(); + // cb.click(); + // expect(inp.isEnabled()).toEqual(false); + // }); + }); + describe('text input', () => { it('should display the starting text', () => { page.navigateTo(); @@ -40,6 +64,14 @@ describe('Basic Inputs Page', () => { inp.sendKeys('X'); expect(hasClass(el, 'ng-invalid')).toEqual(false); }); + + it('should disable', () => { + page.navigateTo(); + const inp = page.getIonicTextInputEditable(); + const cb = page.getDisableButton(); + cb.click(); + expect(inp.isEnabled()).toEqual(false); + }); }); describe('numeric input', () => { @@ -56,6 +88,14 @@ describe('Basic Inputs Page', () => { inp.sendKeys('.48859'); expect(page.getNumericOutputType()).toEqual('number'); }); + + it('should disable', () => { + page.navigateTo(); + const inp = page.getIonicNumericInputEditable(); + const cb = page.getDisableButton(); + cb.click(); + expect(inp.isEnabled()).toEqual(false); + }); }); describe('textarea input', () => { @@ -84,6 +124,14 @@ describe('Basic Inputs Page', () => { inp.sendKeys('X'); expect(hasClass(el, 'ng-invalid')).toEqual(false); }); + + it('should disable', () => { + page.navigateTo(); + const inp = page.getIonicTextareaInputEditable(); + const cb = page.getDisableButton(); + cb.click(); + expect(inp.isEnabled()).toEqual(false); + }); }); describe('checkbox input', () => { diff --git a/packages/demos/angular/e2e/basic-inputs.po.ts b/packages/demos/angular/e2e/basic-inputs.po.ts index 6a0c433f92..13202331d4 100644 --- a/packages/demos/angular/e2e/basic-inputs.po.ts +++ b/packages/demos/angular/e2e/basic-inputs.po.ts @@ -46,6 +46,19 @@ export class BasicInputsPage { return element(by.id('textareaOutput')).getText(); } + getIonicSearchInput() { + return element(by.id('ionSearchInput')); + } + + getIonicSearchInputEditable() { + const parent = this.getIonicSearchInput(); + return parent.all(by.css('input')).first(); + } + + getSearchOutput() { + return element(by.id('searchOutput')).getText(); + } + getIonicTextInput() { return element(by.id('ionTextInput')); } @@ -71,4 +84,8 @@ export class BasicInputsPage { getNumericOutputType() { return element(by.id('numericOutputType')).getText(); } + + getDisableButton() { + return element(by.id('disableCheckbox')); + } } diff --git a/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.html b/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.html index d0bb3cee28..d3ff07d239 100644 --- a/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.html +++ b/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.html @@ -4,6 +4,15 @@ + + + + Disable Inputs + + + + +

Text Input

@@ -12,7 +21,7 @@ - + Value: @@ -23,7 +32,7 @@ Ionic Text Input - + @@ -39,7 +48,7 @@ Ionic Text Input - + @@ -57,7 +66,7 @@ Ionic Numeric Input - + @@ -80,7 +89,7 @@ - + Value: @@ -91,7 +100,7 @@ Ionic Textarea Input - + @@ -106,7 +115,7 @@ - + Value: @@ -117,7 +126,7 @@ Ionic Checkbox - + @@ -127,7 +136,8 @@ Ionic Checkbox No ngModel - + @@ -142,7 +152,7 @@ - + Value: @@ -153,7 +163,7 @@ Ionic Toggle - + @@ -168,7 +178,8 @@ - + Value: @@ -180,7 +191,7 @@ Ionic Date + [(ngModel)]="datetimeValue" [disabled]="disableInputs"> @@ -195,7 +206,7 @@ - + Value: @@ -206,7 +217,7 @@ - + diff --git a/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.ts b/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.ts index 0ad89479c6..5e47d81f7e 100644 --- a/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.ts +++ b/packages/demos/angular/src/app/basic-inputs-page/basic-inputs-page.component.ts @@ -7,6 +7,8 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; encapsulation: ViewEncapsulation.None }) export class BasicInputsPageComponent implements OnInit { + disableInputs = false; + datetimeValue = '2017-11-18T14:17:45-06:00'; textareaValue = 'This is the Textarea Input'; textValue = 'This is the Text Input';