Skip to content

Commit f60a821

Browse files
committed
use hasAria/doesNotHaveAria
1 parent 1d131bc commit f60a821

File tree

6 files changed

+77
-77
lines changed

6 files changed

+77
-77
lines changed

tests/integration/components/power-select/a11y-test.js

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

tests/integration/components/power-select/custom-search-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ module('Integration | Component | Ember Power Select (Custom search function)',
270270
typeInSearch('teen');
271271

272272
await settled();
273-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first result is highlighted');
273+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first result is highlighted');
274274
});
275275
test('On an empty select, when a syncronous search result complete, the first element is highlighted like with regular filtering', async function(assert) {
276276
assert.expect(1);
@@ -289,7 +289,7 @@ module('Integration | Component | Ember Power Select (Custom search function)',
289289
typeInSearch('teen');
290290

291291
await settled();
292-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first result is highlighted');
292+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first result is highlighted');
293293
});
294294

295295
test('On an select with a selected value, if after a search this value is not among the options the first element is highlighted', async function(assert) {
@@ -312,11 +312,11 @@ module('Integration | Component | Ember Power Select (Custom search function)',
312312
`);
313313

314314
await clickTrigger();
315-
assert.dom('.ember-power-select-option:nth-child(3)').hasAttribute('aria-current', 'true', 'The 3rd result is highlighted');
315+
assert.dom('.ember-power-select-option:nth-child(3)').hasAria('current', 'true', 'The 3rd result is highlighted');
316316
typeInSearch('teen');
317317

318318
await settled();
319-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first result is highlighted');
319+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first result is highlighted');
320320
});
321321

322322
test('Closing a component with a custom search cleans the search box and the results list', async function(assert) {

tests/integration/components/power-select/disabled-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module('Integration | Component | Ember Power Select (Disabled)', function(hooks
1919
</PowerSelect>
2020
`);
2121

22-
assert.dom('.ember-power-select-trigger').hasAttribute('aria-disabled', 'true');
22+
assert.dom('.ember-power-select-trigger').hasAria('disabled', 'true');
2323
await clickTrigger();
2424
assert.dom('.ember-power-select-dropdown').doesNotExist('The select is still closed');
2525
await triggerKeyEvent('.ember-power-select-trigger', 'keydown', 13);
@@ -50,7 +50,7 @@ module('Integration | Component | Ember Power Select (Disabled)', function(hooks
5050

5151
await clickTrigger();
5252
await triggerEvent('.ember-power-select-option[aria-disabled="true"]', 'mouseover');
53-
assert.dom('.ember-power-select-option[aria-disabled="true"]').hasAttribute('aria-current', 'false', 'The hovered option was not highlighted because it\'s disabled');
53+
assert.dom('.ember-power-select-option[aria-disabled="true"]').hasAria('current', 'false', 'The hovered option was not highlighted because it\'s disabled');
5454
});
5555

5656
test('Disabled options are skipped when highlighting items with the keyboard', async function(assert) {
@@ -110,9 +110,9 @@ module('Integration | Component | Ember Power Select (Disabled)', function(hooks
110110
</PowerSelectMultiple>
111111
`);
112112

113-
assert.dom('.ember-power-select-trigger').hasAttribute('aria-disabled', 'true', 'The trigger has `aria-disabled=true`');
113+
assert.dom('.ember-power-select-trigger').hasAria('disabled', 'true', 'The trigger has `aria-disabled=true`');
114114
this.set('shouldBeDisabled', false);
115-
assert.dom('.ember-power-select-trigger').hasAttribute('aria-expanded', 'false')
115+
assert.dom('.ember-power-select-trigger').hasAria('expanded', 'false')
116116
assert.dom('.ember-power-select-trigger-multiple-input').doesNotHaveAttribute('disabled');
117117
});
118118

@@ -283,7 +283,7 @@ module('Integration | Component | Ember Power Select (Disabled)', function(hooks
283283
await clickTrigger();
284284
await click(document.querySelectorAll('.ember-power-select-option')[1]);
285285
assert.dom('.ember-power-select-trigger').hasText('two', 'The option is selected');
286-
assert.dom('.ember-power-select-trigger').hasAttribute('aria-disabled', 'true');
286+
assert.dom('.ember-power-select-trigger').hasAria('disabled', 'true');
287287
});
288288

289289
test('Disabled options cannot be selected', async function(assert) {

tests/integration/components/power-select/general-behaviour-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
500500
await clickTrigger();
501501
assert.dom('.ember-power-select-dropdown').exists('Dropdown is rendered');
502502
assert.dom('.ember-power-select-option[aria-current="true"]').exists({ count: 1 }, 'One element is highlighted');
503-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first one to be precise');
503+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first one to be precise');
504504
});
505505

506506
test('When `selected` option is provided, it appears in the trigger yielded with the same block as the options', async function(assert) {
@@ -549,7 +549,7 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
549549
`);
550550

551551
await clickTrigger();
552-
assert.dom('.ember-power-select-option:nth-child(3)').hasAttribute('aria-selected', 'true', 'The third option is marked as selected');
552+
assert.dom('.ember-power-select-option:nth-child(3)').hasAria('selected', 'true', 'The third option is marked as selected');
553553
});
554554

555555
test('The default search strategy matches disregarding diacritics differences and capitalization', async function(assert) {
@@ -610,7 +610,7 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
610610
await clickTrigger();
611611
assert.dom('.ember-power-select-dropdown').exists('Dropdown is rendered');
612612
assert.dom('.ember-power-select-option[aria-current="true"]').exists({ count: 1 }, 'One element is highlighted');
613-
assert.dom('.ember-power-select-option:nth-child(1)').hasAttribute('aria-current', 'true', 'The first one to be precise');
613+
assert.dom('.ember-power-select-option:nth-child(1)').hasAria('current', 'true', 'The first one to be precise');
614614
});
615615

616616
test('When a option is provided that options is rendered in the trigger using the same block as the options', async function(assert) {
@@ -656,7 +656,7 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
656656

657657
await clickTrigger();
658658
let selectedOption = findContains('.ember-power-select-option', 'ES: Spain');
659-
assert.dom(selectedOption).hasAttribute('aria-selected', 'true', 'The second option is marked as selected');
659+
assert.dom(selectedOption).hasAria('selected', 'true', 'The second option is marked as selected');
660660
});
661661

662662
test('The default search strategy matches disregarding diacritics differences and capitalization', async function(assert) {
@@ -1106,7 +1106,7 @@ module('Integration | Component | Ember Power Select (General behavior)', functi
11061106
await click('.ember-power-select-option:nth-child(2)');
11071107
await clickTrigger();
11081108
await typeInSearch('i');
1109-
assert.dom('.ember-power-select-option:nth-child(1)').hasAttribute('aria-selected', 'true', 'The item in the list is marked as selected');
1109+
assert.dom('.ember-power-select-option:nth-child(1)').hasAria('selected', 'true', 'The item in the list is marked as selected');
11101110
await click('.ember-power-select-option:nth-child(1)');
11111111
assert.equal(onChangeInvocationsCount, 1);
11121112
});

tests/integration/components/power-select/mouse-control-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ module('Integration | Component | Ember Power Select (Mouse control)', function(
2020
`);
2121

2222
await clickTrigger();
23-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first element is highlighted');
23+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first element is highlighted');
2424
await triggerEvent('.ember-power-select-option:nth-child(4)', 'mouseover');
25-
assert.dom('.ember-power-select-option:nth-child(4)').hasAttribute('aria-current', 'true', 'The 4th element is highlighted');
25+
assert.dom('.ember-power-select-option:nth-child(4)').hasAria('current', 'true', 'The 4th element is highlighted');
2626
assert.dom('.ember-power-select-option:nth-child(4)').hasText('four');
2727
});
2828

@@ -37,11 +37,11 @@ module('Integration | Component | Ember Power Select (Mouse control)', function(
3737
`);
3838

3939
await clickTrigger();
40-
assert.dom('.ember-power-select-option').hasAttribute('aria-current', 'true', 'The first element is highlighted');
40+
assert.dom('.ember-power-select-option').hasAria('current', 'true', 'The first element is highlighted');
4141
await triggerEvent('.ember-power-select-option:nth-child(4)', 'mouseover');
4242

43-
assert.dom('.ember-power-select-option:nth-child(4)').hasAttribute('aria-current', 'false', 'The 4th element is not highlighted');
44-
assert.dom('.ember-power-select-option:nth-child(1)').hasAttribute('aria-current', 'true', 'The 1st element is still highlighted');
43+
assert.dom('.ember-power-select-option:nth-child(4)').hasAria('current', 'false', 'The 4th element is not highlighted');
44+
assert.dom('.ember-power-select-option:nth-child(1)').hasAria('current', 'true', 'The 1st element is still highlighted');
4545
});
4646

4747
test('Clicking an item selects it, closes the dropdown and focuses the trigger', async function(assert) {

tests/integration/components/power-select/multiple-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ module('Integration | Component | Ember Power Select (Multiple)', function(hooks
146146
`);
147147

148148
await clickTrigger();
149-
assert.dom('.ember-power-select-option:nth-child(2)').hasAttribute('aria-selected', 'true', 'The second option is styled as selected');
150-
assert.dom('.ember-power-select-option:nth-child(4)').hasAttribute('aria-selected', 'true', 'The 4th option is styled as selected');
149+
assert.dom('.ember-power-select-option:nth-child(2)').hasAria('selected', 'true', 'The second option is styled as selected');
150+
assert.dom('.ember-power-select-option:nth-child(4)').hasAria('selected', 'true', 'The 4th option is styled as selected');
151151
});
152152

153153
test('When the popup opens, the first items is highlighed, even if there is only one selection', async function(assert) {
@@ -830,7 +830,7 @@ module('Integration | Component | Ember Power Select (Multiple)', function(hooks
830830
await typeInSearch('M');
831831
await click('.ember-power-select-option:nth-child(2)');
832832
await typeInSearch('Mi');
833-
assert.dom('.ember-power-select-option').hasAttribute('aria-selected', 'true', 'The item in the list is marked as selected');
833+
assert.dom('.ember-power-select-option').hasAria('selected', 'true', 'The item in the list is marked as selected');
834834
await click('.ember-power-select-option'); // select the same user again should remove it
835835
assert.dom('.ember-power-select-multiple-option').exists({ count: 0 });
836836
});

0 commit comments

Comments
 (0)