mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
test(alert): add alert checkbox and fast close tests
This commit is contained in:
@ -148,6 +148,75 @@ class E2EPage {
|
||||
});
|
||||
}
|
||||
|
||||
doCheckbox() {
|
||||
let alert = Alert.create();
|
||||
alert.setTitle('Checkbox!');
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 1',
|
||||
value: 'value1',
|
||||
checked: true
|
||||
});
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 2',
|
||||
value: 'value2'
|
||||
});
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 3',
|
||||
value: 'value3'
|
||||
});
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 4',
|
||||
value: 'value4'
|
||||
});
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 5',
|
||||
value: 'value5'
|
||||
});
|
||||
|
||||
alert.addInput({
|
||||
type: 'checkbox',
|
||||
label: 'Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6',
|
||||
value: 'value6'
|
||||
});
|
||||
|
||||
alert.addButton('Cancel');
|
||||
alert.addButton({
|
||||
text: 'Ok',
|
||||
handler: data => {
|
||||
console.log('Checkbox data:', data);
|
||||
this.testCheckboxOpen = false;
|
||||
this.testCheckboxResult = data;
|
||||
}
|
||||
});
|
||||
|
||||
this.nav.present(alert).then(() => {
|
||||
this.testCheckboxOpen = true;
|
||||
});
|
||||
}
|
||||
|
||||
doFastClose() {
|
||||
let alert = Alert.create({
|
||||
title: 'Alert!',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
this.nav.present(alert);
|
||||
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
<button block class="e2eOpenConfirm" (click)="doConfirm()">Confirm</button>
|
||||
<button block class="e2eOpenPrompt" (click)="doPrompt()">Prompt</button>
|
||||
<button block class="e2eOpenRadio" (click)="doRadio()">Radio</button>
|
||||
<button block class="e2eOpenCheckbox" (click)="doCheckbox()">Checkbox</button>
|
||||
<button block class="e2eFastClose" (click)="doFastClose()">Fast Close</button>
|
||||
|
||||
<pre>
|
||||
Confirm Opened: {{testConfirmOpen}}
|
||||
@ -17,6 +19,8 @@
|
||||
Prompt Result: {{testPromptResult | json}}
|
||||
Radio Opened: {{testRadioOpen}}
|
||||
Radio Result: {{testRadioResult}}
|
||||
Checkbox Opened: {{testCheckboxOpen}}
|
||||
Checkbox Result: {{testCheckboxResult}}
|
||||
</pre>
|
||||
|
||||
</ion-content>
|
||||
|
Reference in New Issue
Block a user