Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add ariaLabelledBy attribute #824

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ember-amount-input/src/components/amount-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
placeholder={{this.placeholder}}
disabled={{@disabled}}
readonly={{@readonly}}
aria-labelledby={{@ariaLabelledBy}}
{{on 'keydown' this.onKeyDown}}
{{on 'input' this.onInput}}
{{on 'paste' this.onPaste}}
Expand Down
5 changes: 5 additions & 0 deletions ember-amount-input/src/components/amount-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const KEY_FULLSTOP = '.';
const KEY_COMMA = ',';

export interface AmountInputArgs {
/**
* The arial label for the input
*/
ariaLabelledBy?: string;

/**
* The currency displayed in the input
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module('Integration | Component | amount-input', function (hooks) {
@value={{this.value}}
@min={{5}}
@max={{10}}
@update={{fn (mut this.value)}} />
@update={{fn (mut this.value)}}
@ariaLabelledBy="foo" />
`);

assert.dom('.amount-input__currency').hasText('USD');
Expand All @@ -59,6 +60,7 @@ module('Integration | Component | amount-input', function (hooks) {
assert.dom('input').hasAttribute('placeholder', '1.000.000');
assert.dom('input').hasAttribute('min', '5');
assert.dom('input').hasAttribute('max', '10');
assert.dom('input').hasAttribute('aria-labelledby', 'foo');
});

test('uses named property declared (even if undefined) instead of defaults', async function (this: TestContext, assert) {
Expand Down
Loading