diff --git a/ionic/components/popup/test/basic/e2e.ts b/ionic/components/popup/test/basic/e2e.ts new file mode 100644 index 0000000000..763d094d31 --- /dev/null +++ b/ionic/components/popup/test/basic/e2e.ts @@ -0,0 +1,31 @@ + +it('should open alert', function() { + element(by.css('#e2eOpenAlert')).click(); +}); + + +it('should close alert', function() { + element(by.css('.popup-buttons button:last-of-type')).click(); +}); + + +it('should open prompt', function() { + element(by.css('#e2eOpenPrompt')).click(); +}); + + +it('should close prompt', function() { + var inputEle = element(by.css('.popup-body input')); + inputEle.sendKeys('prompt text'); + element(by.css('.popup-buttons button:last-of-type')).click(); +}); + + +it('should open confirm', function() { + element(by.css('#e2eOpenConfirm')).click(); +}); + + +it('should close confirm', function() { + element(by.css('.popup-buttons button:last-of-type')).click(); +}); diff --git a/ionic/components/popup/test/basic/index.ts b/ionic/components/popup/test/basic/index.ts index e68255e377..c5b29fc893 100644 --- a/ionic/components/popup/test/basic/index.ts +++ b/ionic/components/popup/test/basic/index.ts @@ -1,35 +1,46 @@ -import {App, IonicView, IonicApp, IonicConfig, Platform} from 'ionic/ionic'; -import {Popup} from 'ionic/ionic'; +import {App, Popup} from 'ionic/ionic'; @App({ templateUrl: 'main.html' }) -class MyAppCmp { +class E2EApp { - constructor(popup: Popup, app: IonicApp, ionicConfig: IonicConfig) { + constructor(popup: Popup) { this.popup = popup; - + this.alertOpen = false; + this.promptOpen = false; + this.promptResult = ''; + this.confirmOpen = false; + this.confirmResult = ''; } doAlert() { - this.popup.alert('What!?').then(() => { - }, () => { + this.alertOpen = true; + this.popup.alert('Alert').then(() => { + this.alertOpen = false; }); } doPrompt() { - this.popup.prompt('What is your name?').then((name, event) => { - console.log('Got response', name); + this.promptOpen = true; + this.popup.prompt('What is your name?').then((name) => { + this.promptResult = name; + this.promptOpen = false; }, () => { console.error('Prompt closed'); + this.promptOpen = false; }); } doConfirm() { - this.popup.confirm('Are you sure?').then((yes, event) => { - console.log('CONFIRMED', yes); + this.confirmOpen = true; + this.popup.confirm('Are you sure?').then((result, ev) => { + console.log('CONFIRMED', result); + this.confirmResult = result; + this.confirmOpen = false; }, () => { + this.confirmOpen = false; console.error('NOT CONFIRMED'); }); } diff --git a/ionic/components/popup/test/basic/main.html b/ionic/components/popup/test/basic/main.html index 0a028e7ceb..a53c92e8d3 100644 --- a/ionic/components/popup/test/basic/main.html +++ b/ionic/components/popup/test/basic/main.html @@ -1,6 +1,16 @@ + - - - - + + + + + +
+    Alert Opened: {{alertOpen}}
+    Prompt Opened: {{promptOpen}}
+    Prompt Result: {{promptResult}}
+    Confirm Opened: {{confirmOpen}}
+    Confirm Result: {{confirmResult}}
+  
+