diff --git a/apps/ember-test-app/app/components/f/form.gts b/apps/ember-test-app/app/components/f/form.gts index 57808b634..900f1cd64 100644 --- a/apps/ember-test-app/app/components/f/form.gts +++ b/apps/ember-test-app/app/components/f/form.gts @@ -26,11 +26,33 @@ const Validators = { console.log('Validating: ' + value); return value !== 'foo'; }, + isWarning: true, + }), + ], + radio: [validator('exclusion', { in: ['A', 'B'], isWarning: true })], + phone: [ + validator('length', { + min: 10, + message: 'Phone number must contain a 3-digit area code', + disabled() { + return !this.requirePhoneLength; + }, + }), + validator('length', { + max: 10, + isWarning: true, + message: 'Phone number cannot contain a country code', + disabled() { + return !this.requirePhoneLength; + }, }), ], }; class Model { + @tracked + requirePhoneLength = true; + @tracked textField = ''; @@ -40,6 +62,9 @@ class Model { @tracked select = ''; + @tracked + phone = ''; + @tracked radio = ''; @@ -86,6 +111,11 @@ export default class extends Component { this.required = !this.required; } + @action + toggleRequirePhoneLength() { + this.model.requirePhoneLength = !this.model.requirePhoneLength; + } + @action onSubmit() { alert('Form submitted'); @@ -138,12 +168,29 @@ export default class extends Component { +