diff --git a/src/components/alert/alert-component.ts b/src/components/alert/alert-component.ts index 86afcde1ce..e55ea4df59 100644 --- a/src/components/alert/alert-component.ts +++ b/src/components/alert/alert-component.ts @@ -52,7 +52,7 @@ import { AlertInputOptions, AlertOptions, AlertButton } from './alert-options'; '' + @@ -149,6 +149,8 @@ export class AlertCmp { disabled: !!input.disabled, id: isPresent(input.id) ? input.id : `alert-input-${this.id}-${index}`, handler: isPresent(input.handler) ? input.handler : null, + min: isPresent(input.min) ? input.min : null, + max: isPresent(input.max) ? input.max : null }; return r; }); diff --git a/src/components/alert/alert-options.ts b/src/components/alert/alert-options.ts index a2a664a58e..74c9804ba5 100644 --- a/src/components/alert/alert-options.ts +++ b/src/components/alert/alert-options.ts @@ -20,6 +20,8 @@ export interface AlertInputOptions { disabled?: boolean; id?: string; handler?: Function; + min?: string | number; + max?: string | number; } export interface AlertButton { diff --git a/src/components/alert/alert.ts b/src/components/alert/alert.ts index 177858a178..33490002c8 100644 --- a/src/components/alert/alert.ts +++ b/src/components/alert/alert.ts @@ -250,6 +250,12 @@ export class Alert extends ViewController { * | label | `string` | The input's label (only for radio/checkbox inputs) | * | checked | `boolean` | Whether or not the input is checked. | * | id | `string` | The input's id. | + * | min | `string | number` | The input's minimum authorized value (string only for date inputs, number + * only for number inputs) + * | + * | max | `string | number` | The input's maximum authorized value (string only for date inputs, number + * only for number inputs) + * | * * Button options * diff --git a/src/components/alert/test/basic/app.module.ts b/src/components/alert/test/basic/app.module.ts index 057b9639bc..cce713319c 100644 --- a/src/components/alert/test/basic/app.module.ts +++ b/src/components/alert/test/basic/app.module.ts @@ -108,6 +108,28 @@ export class E2EPage { type: 'url', placeholder: 'Favorite site ever' }); + // input date with min & max + alert.addInput({ + name: 'name4', + type: 'date', + min: '2017-03-01', + max: '2018-01-12' + }); + // input date without min nor max + alert.addInput({ + name: 'name5', + type: 'date' + }); + alert.addInput({ + name: 'name6', + type: 'number', + min: -5, + max: 10 + }); + alert.addInput({ + name: 'name7', + type: 'number' + }); alert.addButton({ text: 'Cancel', handler: (data: any) => {