Skip to content

Commit

Permalink
Add a playground example
Browse files Browse the repository at this point in the history
  • Loading branch information
samdemaeyer committed Jan 16, 2020
1 parent 8b762ef commit 71de005
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default Component.extend({
updateSeparateDialOption(separateDialNumber, metaData) {
this.set('separateDialNumber', separateDialNumber);
this.setProperties(metaData);
},

submitForm() {
alert('The form has been submitted');
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@

{{demo.snippet "phone-input-allow-dropdown-option.hbs"}}
{{/docs-demo}}

<h2>`required` option</h2>
{{#docs-demo as |demo|}}
{{#demo.example name="phone-input-required-option.hbs"}}
<form {{action "submitForm" on="submit"}}>
<p>{{phone-input required=true initialCountry="us" number=number}}</p>

<p>The input is required.</p>

<p>The input is required and you will not be able to submit the form when the field is empty as the clients-side HTML5 form validation will prvent it.</p>

<button name="button" type="submit" class="docs-bg-grey-darkest docs-text-white docs-no-underline docs-rounded docs-py-2 docs-px-4">submit</button>
</form>
{{/demo.example}}

{{demo.snippet "phone-input-required-option.hbs"}}
{{/docs-demo}}

2 changes: 1 addition & 1 deletion tests/integration/components/phone-input-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module('Integration | Component | phone-input', function(hooks) {
assert.notOk(find('input').required);

await render(hbs`{{phone-input required=true number=number}}`);

assert.ok(find('input').required);
});

Expand Down

0 comments on commit 71de005

Please sign in to comment.