diff --git a/package.json b/package.json
index 6ccc365..94be2ea 100644
--- a/package.json
+++ b/package.json
@@ -84,7 +84,7 @@
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"dotenv-cli": "^4.0.0",
- "ember-auto-import": "^1.11.2",
+ "ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-deprecation-workflow": "^2.0.0",
@@ -99,6 +99,7 @@
"ember-maybe-import-regenerator": "^0.1.6",
"ember-on-helper": "^0.1.0",
"ember-page-title": "^6.2.1",
+ "ember-popperjs": "^1.0.0",
"ember-qunit": "^5.1.4",
"ember-resolver": "^8.0.2",
"ember-source": "~3.28.0",
@@ -126,7 +127,8 @@
"tailwindcss": "^2.2.7",
"testdouble": "^3.16.1",
"testdouble-qunit": "^3.0.0",
- "typescript": "^4.4.3"
+ "typescript": "^4.4.3",
+ "webpack": "^5.56.0"
},
"resolutions": {
"@embroider/core": "^0.43.5",
diff --git a/tests/accessibility-assertions.js b/tests/accessibility-assertions.js
index 65ff871..eb3802b 100644
--- a/tests/accessibility-assertions.js
+++ b/tests/accessibility-assertions.js
@@ -129,86 +129,81 @@ function assertDialog(options, dialog = getDialog()) {
return;
}
- try {
- switch (options.state) {
- case DialogState.InvisibleHidden: {
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
-
- return;
- }
+ switch (options.state) {
+ case DialogState.InvisibleHidden: {
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertHidden(dialog);
+ return;
+ }
- Qunit.assert.dom(dialog).hasAttribute('role', 'dialog');
- Qunit.assert.dom(dialog).doesNotHaveAttribute('aria-modal');
+ assertHidden(dialog);
- if (options.textContent) {
- Qunit.assert.dom(dialog).hasText(options.textContent);
- }
+ Qunit.assert.dom(dialog).hasAttribute('role', 'dialog');
+ Qunit.assert.dom(dialog).doesNotHaveAttribute('aria-modal');
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(dialog).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(dialog).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(dialog).hasAttribute(attributeName, attributeValue);
}
- case DialogState.Visible: {
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
+ break;
+ }
- return;
- }
+ case DialogState.Visible: {
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertVisible(dialog);
+ return;
+ }
- Qunit.assert.dom(dialog).hasAttribute('role', 'dialog');
- Qunit.assert.dom(dialog).hasAttribute('aria-modal', 'true');
+ assertVisible(dialog);
- if (options.textContent) {
- Qunit.assert.dom(dialog).hasText(options.textContent);
- }
+ Qunit.assert.dom(dialog).hasAttribute('role', 'dialog');
+ Qunit.assert.dom(dialog).hasAttribute('aria-modal', 'true');
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(dialog).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(dialog).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(dialog).hasAttribute(attributeName, attributeValue);
}
- case DialogState.InvisibleUnmounted: {
- Qunit.assert.equal(dialog, null);
- break;
- }
+ break;
+ }
- default: {
- assertNever(options.state);
- }
+ case DialogState.InvisibleUnmounted: {
+ Qunit.assert.equal(dialog, null);
+ break;
+ }
+
+ default: {
+ assertNever(options.state);
}
- } catch (err) {
- Error.captureStackTrace(err, assertDialog);
- throw err;
}
}
@@ -225,81 +220,76 @@ function assertDialogOverlay(options, overlay = getDialogOverlay()) {
return;
}
- try {
- switch (options.state) {
- case DialogState.InvisibleHidden: {
- if (overlay === null) {
- Qunit.assert.notEqual(overlay, null);
-
- return;
- }
+ switch (options.state) {
+ case DialogState.InvisibleHidden: {
+ if (overlay === null) {
+ Qunit.assert.notEqual(overlay, null);
- assertHidden(overlay);
+ return;
+ }
- if (options.textContent) {
- Qunit.assert.dom(overlay).hasText(options.textContent);
- }
+ assertHidden(overlay);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(overlay).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(overlay).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(overlay).hasAttribute(attributeName, attributeValue);
}
- case DialogState.Visible: {
- if (overlay === null) {
- Qunit.assert.notEqual(overlay, null);
+ break;
+ }
- return;
- }
+ case DialogState.Visible: {
+ if (overlay === null) {
+ Qunit.assert.notEqual(overlay, null);
- assertVisible(overlay);
+ return;
+ }
- if (options.textContent) {
- Qunit.assert.dom(overlay).hasText(options.textContent);
- }
+ assertVisible(overlay);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(overlay).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(overlay).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(overlay).hasAttribute(attributeName, attributeValue);
}
- case DialogState.InvisibleUnmounted: {
- Qunit.assert.equal(overlay, null);
+ break;
+ }
- break;
- }
+ case DialogState.InvisibleUnmounted: {
+ Qunit.assert.equal(overlay, null);
- default: {
- assertNever(options.state);
- }
+ break;
+ }
+
+ default: {
+ assertNever(options.state);
}
- } catch (err) {
- Error.captureStackTrace(err, assertDialogOverlay);
- throw err;
}
}
@@ -320,99 +310,94 @@ function assertDialogTitle(
return;
}
- try {
- switch (options.state) {
- case DialogState.InvisibleHidden: {
- if (title === null) {
- Qunit.assert.notEqual(title, null);
-
- return;
- }
+ switch (options.state) {
+ case DialogState.InvisibleHidden: {
+ if (title === null) {
+ Qunit.assert.notEqual(title, null);
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
+ return;
+ }
- return;
- }
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertHidden(title);
+ return;
+ }
- Qunit.assert.dom(title).hasAttribute('id');
- Qunit.assert.dom(dialog).hasAttribute('aria-labelledby', title.id);
+ assertHidden(title);
- if (options.textContent) {
- Qunit.assert.dom(title).hasText(options.textContent);
- }
+ Qunit.assert.dom(title).hasAttribute('id');
+ Qunit.assert.dom(dialog).hasAttribute('aria-labelledby', title.id);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(title).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(title).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(title).hasAttribute(attributeName, attributeValue);
}
- case DialogState.Visible: {
- if (title === null) {
- Qunit.assert.notEqual(title, null);
+ break;
+ }
- return;
- }
+ case DialogState.Visible: {
+ if (title === null) {
+ Qunit.assert.notEqual(title, null);
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
+ return;
+ }
- return;
- }
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertVisible(title);
+ return;
+ }
- Qunit.assert.dom(title).hasAttribute('id');
- Qunit.assert.dom(dialog).hasAttribute('aria-labelledby', title.id);
+ assertVisible(title);
- if (options.textContent) {
- Qunit.assert.dom(title).hasText(options.textContent);
- }
+ Qunit.assert.dom(title).hasAttribute('id');
+ Qunit.assert.dom(dialog).hasAttribute('aria-labelledby', title.id);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(title).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert.dom(title).hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert.dom(title).hasAttribute(attributeName, attributeValue);
}
- case DialogState.InvisibleUnmounted: {
- Qunit.assert.equal(title, null);
+ break;
+ }
- break;
- }
+ case DialogState.InvisibleUnmounted: {
+ Qunit.assert.equal(title, null);
- default: {
- assertNever(options.state);
- }
+ break;
+ }
+
+ default: {
+ assertNever(options.state);
}
- } catch (err) {
- Error.captureStackTrace(err, assertDialogTitle);
- throw err;
}
}
@@ -433,107 +418,98 @@ function assertDialogDescription(
return;
}
- try {
- switch (options.state) {
- case DialogState.InvisibleHidden: {
- if (description === null) {
- Qunit.assert.notEqual(description, null);
-
- return;
- }
+ switch (options.state) {
+ case DialogState.InvisibleHidden: {
+ if (description === null) {
+ Qunit.assert.notEqual(description, null);
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
+ return;
+ }
- return;
- }
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertHidden(description);
+ return;
+ }
- Qunit.assert.dom(description).hasAttribute('id');
- Qunit.assert
- .dom(dialog)
- .hasAttribute('aria-describedby', description.id);
+ assertHidden(description);
- if (options.textContent) {
- Qunit.assert.dom(description).hasText(options.textContent);
- }
+ Qunit.assert.dom(description).hasAttribute('id');
+ Qunit.assert.dom(dialog).hasAttribute('aria-describedby', description.id);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(description).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert
- .dom(description)
- .hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert
+ .dom(description)
+ .hasAttribute(attributeName, attributeValue);
}
- case DialogState.Visible: {
- if (description === null) {
- Qunit.assert.notEqual(description, null);
+ break;
+ }
- return;
- }
+ case DialogState.Visible: {
+ if (description === null) {
+ Qunit.assert.notEqual(description, null);
- if (dialog === null) {
- Qunit.assert.notEqual(dialog, null);
+ return;
+ }
- return;
- }
+ if (dialog === null) {
+ Qunit.assert.notEqual(dialog, null);
- assertVisible(description);
+ return;
+ }
- Qunit.assert.dom(description).hasAttribute('id');
- Qunit.assert
- .dom(dialog)
- .hasAttribute('aria-describedby', description.id);
+ assertVisible(description);
- if (options.textContent) {
- Qunit.assert.dom(description).hasText(options.textContent);
- }
+ Qunit.assert.dom(description).hasAttribute('id');
+ Qunit.assert.dom(dialog).hasAttribute('aria-describedby', description.id);
- for (let attributeName in options.attributes) {
- let attributeValue = options.attributes[attributeName];
+ if (options.textContent) {
+ Qunit.assert.dom(description).hasText(options.textContent);
+ }
- if (attributeName === 'class') {
- attributeValue = `ember-view ${attributeValue}`;
- }
+ for (let attributeName in options.attributes) {
+ let attributeValue = options.attributes[attributeName];
- if (attributeName === 'id') {
- attributeValue = new RegExp(`${attributeValue}$`);
- }
+ if (attributeName === 'class') {
+ attributeValue = `ember-view ${attributeValue}`;
+ }
- Qunit.assert
- .dom(description)
- .hasAttribute(attributeName, attributeValue);
+ if (attributeName === 'id') {
+ attributeValue = new RegExp(`${attributeValue}$`);
}
- break;
+ Qunit.assert
+ .dom(description)
+ .hasAttribute(attributeName, attributeValue);
}
- case DialogState.InvisibleUnmounted: {
- Qunit.assert.equal(description, null);
+ break;
+ }
- break;
- }
+ case DialogState.InvisibleUnmounted: {
+ Qunit.assert.equal(description, null);
- default: {
- assertNever(options.state);
- }
+ break;
+ }
+
+ default: {
+ assertNever(options.state);
}
- } catch (err) {
- Error.captureStackTrace(err, assertDialogDescription);
- throw err;
}
}
@@ -561,44 +537,39 @@ function assertListboxButton(
{ state, attributes, textContent },
button = getListboxButton()
) {
- try {
- if (button === null) return Qunit.assert.ok(button);
- Qunit.assert.dom(button).hasAttribute('id');
- Qunit.assert.dom(button).hasAria('haspopup', 'listbox');
- if (textContent) {
- Qunit.assert.dom(button).hasText(textContent);
- }
- switch (state) {
- case ListboxState.InvisibleUnmounted: {
- Qunit.assert.dom(button).doesNotHaveAria('listbox');
- if (button.hasAttribute('disabled')) {
- Qunit.assert.dom(button).doesNotHaveAria('expanded');
- Qunit.assert.dom(button).isDisabled();
- } else {
- Qunit.assert.dom(button).hasAria('expanded', 'false');
- }
- break;
- }
- case ListboxState.Visible: {
- Qunit.assert.dom(button).hasAria('controls', { any: true });
- Qunit.assert.dom(button).hasAria('expanded', 'true');
- break;
+ if (button === null) return Qunit.assert.ok(button);
+ Qunit.assert.dom(button).hasAttribute('id');
+ Qunit.assert.dom(button).hasAria('haspopup', 'listbox');
+ if (textContent) {
+ Qunit.assert.dom(button).hasText(textContent);
+ }
+ switch (state) {
+ case ListboxState.InvisibleUnmounted: {
+ Qunit.assert.dom(button).doesNotHaveAria('listbox');
+ if (button.hasAttribute('disabled')) {
+ Qunit.assert.dom(button).doesNotHaveAria('expanded');
+ Qunit.assert.dom(button).isDisabled();
+ } else {
+ Qunit.assert.dom(button).hasAria('expanded', 'false');
}
- default:
- Qunit.assert.ok(
- state,
- 'you have to provide state to assertListboxButton'
- );
+ break;
}
-
- for (let attributeName in attributes) {
- Qunit.assert
- .dom(button)
- .hasAttribute(attributeName, attributes[attributeName]);
+ case ListboxState.Visible: {
+ Qunit.assert.dom(button).hasAria('controls', { any: true });
+ Qunit.assert.dom(button).hasAria('expanded', 'true');
+ break;
}
- } catch (err) {
- Error.captureStackTrace(err, assertListboxButton);
- throw err;
+ default:
+ Qunit.assert.ok(
+ state,
+ 'you have to provide state to assertListboxButton'
+ );
+ }
+
+ for (let attributeName in attributes) {
+ Qunit.assert
+ .dom(button)
+ .hasAttribute(attributeName, attributes[attributeName]);
}
}
@@ -606,166 +577,126 @@ function assertListboxLabelLinkedWithListbox(
label = getListboxLabel(),
listbox = getListbox()
) {
- try {
- if (label === null) return Qunit.assert.ok(label);
- if (listbox === null) return Qunit.assert.ok(listbox);
+ if (label === null) return Qunit.assert.ok(label);
+ if (listbox === null) return Qunit.assert.ok(listbox);
- Qunit.assert
- .dom(listbox)
- .hasAttribute('aria-labelledby', label.getAttribute('id'));
- } catch (err) {
- Error.captureStackTrace(err, assertListboxLabelLinkedWithListbox);
- throw err;
- }
+ Qunit.assert
+ .dom(listbox)
+ .hasAttribute('aria-labelledby', label.getAttribute('id'));
}
function assertListboxButtonLinkedWithListbox(
button = getListboxButton(),
listbox = getListbox()
) {
- try {
- if (button === null) return Qunit.assert.ok(button);
- if (listbox === null) return Qunit.assert.ok(listbox);
-
- // Ensure link between button & listbox is correct
- Qunit.assert
- .dom(button)
- .hasAttribute('aria-controls', listbox.getAttribute('id'));
- Qunit.assert
- .dom(listbox)
- .hasAttribute('aria-labelledby', button.getAttribute('id'));
- } catch (err) {
- Error.captureStackTrace(err, assertListboxButtonLinkedWithListbox);
- throw err;
- }
+ if (button === null) return Qunit.assert.ok(button);
+ if (listbox === null) return Qunit.assert.ok(listbox);
+
+ // Ensure link between button & listbox is correct
+ Qunit.assert
+ .dom(button)
+ .hasAttribute('aria-controls', listbox.getAttribute('id'));
+ Qunit.assert
+ .dom(listbox)
+ .hasAttribute('aria-labelledby', button.getAttribute('id'));
}
function assertActiveListboxOption(item, listbox = getListbox()) {
- try {
- if (item === null) return Qunit.assert.ok(item);
- if (listbox === null) return Qunit.assert.ok(listbox);
+ if (item === null) return Qunit.assert.ok(item);
+ if (listbox === null) return Qunit.assert.ok(listbox);
- // Ensure link between listbox & listbox item is correct
- Qunit.assert
- .dom(listbox)
- .hasAttribute('aria-activedescendant', item.getAttribute('id'));
- } catch (err) {
- Error.captureStackTrace(err, assertActiveListboxOption);
- throw err;
- }
+ // Ensure link between listbox & listbox item is correct
+ Qunit.assert
+ .dom(listbox)
+ .hasAttribute('aria-activedescendant', item.getAttribute('id'));
}
function assertNoActiveListboxOption(listbox = getListbox()) {
- try {
- if (listbox === null) return Qunit.assert.ok(listbox);
+ if (listbox === null) return Qunit.assert.ok(listbox);
- // Ensure we don't have an active listbox
- Qunit.assert.dom(listbox).doesNotHaveAttribute('aria-activedescendant');
- } catch (err) {
- Error.captureStackTrace(err, assertNoActiveListboxOption);
- throw err;
- }
+ // Ensure we don't have an active listbox
+ Qunit.assert.dom(listbox).doesNotHaveAttribute('aria-activedescendant');
}
function assertNoSelectedListboxOption(items = getListboxOptions()) {
- try {
- for (let item of items)
- Qunit.assert.dom(item).doesNotHaveAttribute('aria-selected');
- } catch (err) {
- Error.captureStackTrace(err, assertNoSelectedListboxOption);
- throw err;
- }
+ for (let item of items)
+ Qunit.assert.dom(item).doesNotHaveAttribute('aria-selected');
}
function assertListboxButtonLinkedWithListboxLabel(
button = getListboxButton(),
label = getListboxLabel()
) {
- try {
- if (button === null) return Qunit.assert.ok(button);
- if (label === null) return Qunit.assert.ok(label);
+ if (button === null) return Qunit.assert.ok(button);
+ if (label === null) return Qunit.assert.ok(label);
- // Ensure link between button & label is correct
- Qunit.assert
- .dom(button)
- .hasAttribute('aria-labelledby', `${label.id} ${button.id}`);
- } catch (err) {
- Error.captureStackTrace(err, assertListboxButtonLinkedWithListboxLabel);
- throw err;
- }
+ // Ensure link between button & label is correct
+ Qunit.assert
+ .dom(button)
+ .hasAttribute('aria-labelledby', `${label.id} ${button.id}`);
}
function assertListboxLabel(
{ attributes, tag, textContent },
label = getListboxLabel()
) {
- try {
- if (label === null) return Qunit.assert.ok(label);
+ if (label === null) return Qunit.assert.ok(label);
- // Ensure menu button have these properties
- Qunit.assert.dom(label).hasAttribute('id');
+ // Ensure menu button have these properties
+ Qunit.assert.dom(label).hasAttribute('id');
- if (textContent) {
- Qunit.assert.dom(label).hasText(textContent);
- }
+ if (textContent) {
+ Qunit.assert.dom(label).hasText(textContent);
+ }
- if (tag) {
- Qunit.assert.dom(label).hasTagName(tag);
- }
+ if (tag) {
+ Qunit.assert.dom(label).hasTagName(tag);
+ }
- // Ensure menu button has the following attributes
- for (let attributeName in attributes) {
- Qunit.assert
- .dom(label)
- .hasAttribute(attributeName, attributes[attributeName]);
- }
- } catch (err) {
- Error.captureStackTrace(err, assertListboxLabel);
- throw err;
+ // Ensure menu button has the following attributes
+ for (let attributeName in attributes) {
+ Qunit.assert
+ .dom(label)
+ .hasAttribute(attributeName, attributes[attributeName]);
}
}
export function assertListboxOption({ tag, attributes, selected }, item) {
- try {
- if (item === null) return Qunit.assert.notOk(item);
+ if (item === null) return Qunit.assert.notOk(item);
- // Check that some attributes exists, doesn't really matter what the values are at this point in
- // time, we just require them.
- Qunit.assert.dom(item).hasAttribute('id');
+ // Check that some attributes exists, doesn't really matter what the values are at this point in
+ // time, we just require them.
+ Qunit.assert.dom(item).hasAttribute('id');
- // Check that we have the correct values for certain attributes
- Qunit.assert.dom(item).hasAttribute('role', 'option');
- if (!item.getAttribute('aria-disabled'))
- Qunit.assert.dom(item).hasAttribute('tabindex', '-1');
+ // Check that we have the correct values for certain attributes
+ Qunit.assert.dom(item).hasAttribute('role', 'option');
+ if (!item.getAttribute('aria-disabled'))
+ Qunit.assert.dom(item).hasAttribute('tabindex', '-1');
- // Ensure listbox button has the following attributes
- if (!tag && !attributes && !selected) return;
+ // Ensure listbox button has the following attributes
+ if (!tag && !attributes && !selected) return;
- for (let attributeName in attributes) {
- Qunit.assert
- .dom(item)
- .hasAttribute(attributeName, attributes[attributeName]);
- }
+ for (let attributeName in attributes) {
+ Qunit.assert
+ .dom(item)
+ .hasAttribute(attributeName, attributes[attributeName]);
+ }
- if (tag) {
- Qunit.assert.dom(item).hasTagName(tag);
- }
+ if (tag) {
+ Qunit.assert.dom(item).hasTagName(tag);
+ }
- if (selected != null) {
- switch (selected) {
- case true:
- return Qunit.assert.dom(item).hasAttribute('aria-selected', 'true');
+ if (selected != null) {
+ switch (selected) {
+ case true:
+ return Qunit.assert.dom(item).hasAttribute('aria-selected', 'true');
- case false:
- return Qunit.assert.dom(item).doesNotHaveAttribute('aria-selected');
+ case false:
+ return Qunit.assert.dom(item).doesNotHaveAttribute('aria-selected');
- default:
- Qunit.assert.ok();
- }
+ default:
+ Qunit.assert.ok();
}
- } catch (err) {
- Error.captureStackTrace(err, assertListboxOption);
- throw err;
}
}
@@ -774,53 +705,48 @@ function assertListbox(
listbox = getListbox(),
orientation = 'vertical'
) {
- try {
- switch (state) {
- case ListboxState.InvisibleHidden: {
- if (listbox === null) return Qunit.assert.dom(listbox).exists();
+ switch (state) {
+ case ListboxState.InvisibleHidden: {
+ if (listbox === null) return Qunit.assert.dom(listbox).exists();
- assertHidden(listbox);
+ assertHidden(listbox);
- Qunit.assert.dom(listbox).hasAria('labelledby');
- Qunit.assert.dom(listbox).hasAria('orientation', orientation);
- Qunit.assert.dom(listbox).hasAttribute('role', 'listbox');
+ Qunit.assert.dom(listbox).hasAria('labelledby');
+ Qunit.assert.dom(listbox).hasAria('orientation', orientation);
+ Qunit.assert.dom(listbox).hasAttribute('role', 'listbox');
- if (textContent) Qunit.assert.dom(listbox).hasText(textContent);
+ if (textContent) Qunit.assert.dom(listbox).hasText(textContent);
- for (let attributeName in attributes) {
- Qunit.assert
- .dom(listbox)
- .hasAttribute(attributeName, attributes[attributeName]);
- }
- break;
- }
- case ListboxState.InvisibleUnmounted: {
- Qunit.assert.dom(listbox).doesNotExist();
- break;
+ for (let attributeName in attributes) {
+ Qunit.assert
+ .dom(listbox)
+ .hasAttribute(attributeName, attributes[attributeName]);
}
- case ListboxState.Visible: {
- // Qunit.assert.dom(listbox).isVisible();
- Qunit.assert.dom(listbox).exists();
+ break;
+ }
+ case ListboxState.InvisibleUnmounted: {
+ Qunit.assert.dom(listbox).doesNotExist();
+ break;
+ }
+ case ListboxState.Visible: {
+ // Qunit.assert.dom(listbox).isVisible();
+ Qunit.assert.dom(listbox).exists();
- Qunit.assert.dom(listbox).hasAria('labelledby', { any: true });
- Qunit.assert.dom(listbox).hasAttribute('aria-orientation', orientation);
- Qunit.assert.dom(listbox).hasAttribute('role', 'listbox');
+ Qunit.assert.dom(listbox).hasAria('labelledby', { any: true });
+ Qunit.assert.dom(listbox).hasAttribute('aria-orientation', orientation);
+ Qunit.assert.dom(listbox).hasAttribute('role', 'listbox');
- if (textContent) Qunit.assert.dom(listbox).hasText(textContent);
+ if (textContent) Qunit.assert.dom(listbox).hasText(textContent);
- for (let attributeName in attributes) {
- Qunit.assert
- .dom(listbox)
- .hasAttribute(attributeName, attributes[attributeName]);
- }
- break;
+ for (let attributeName in attributes) {
+ Qunit.assert
+ .dom(listbox)
+ .hasAttribute(attributeName, attributes[attributeName]);
}
- default:
- Qunit.assert.ok(state, 'you have to provide state to assertListbox');
+ break;
}
- } catch (err) {
- Error.captureStackTrace(err, assertListbox);
- throw err;
+ default:
+ Qunit.assert.ok(state, 'you have to provide state to assertListbox');
}
}
diff --git a/tests/dummy/app/templates/index.hbs b/tests/dummy/app/templates/index.hbs
index 5b27ab2..cd24e6f 100644
--- a/tests/dummy/app/templates/index.hbs
+++ b/tests/dummy/app/templates/index.hbs
@@ -10,7 +10,7 @@
Menu (basic)
- Menu with Popper [todo]
+ Menu with Popper
diff --git a/tests/dummy/app/templates/menu/menu-with-popper.hbs b/tests/dummy/app/templates/menu/menu-with-popper.hbs
index 623476f..85bf3b7 100644
--- a/tests/dummy/app/templates/menu/menu-with-popper.hbs
+++ b/tests/dummy/app/templates/menu/menu-with-popper.hbs
@@ -1 +1,69 @@
-menu-with-popper will go here
\ No newline at end of file
+