Skip to content
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9f23fb4
potential refactor of resolve-link-to-external util using embroider m…
MelSumner Nov 12, 2025
2c54408
removed async/await where we shouldn't need it
MelSumner Nov 12, 2025
efa0a8a
make the linter happy
MelSumner Nov 12, 2025
a277856
fixing intl & RAF flakiness for embroider
MelSumner Nov 13, 2025
253b148
linter, someday I will learn
MelSumner Nov 13, 2025
18ec891
moar linting
MelSumner Nov 13, 2025
dedeadc
I need to turn on auto-format on save, really...
MelSumner Nov 13, 2025
431e2d1
tests are passing, lets unskip a test
MelSumner Nov 13, 2025
b38a0bc
added a try scenario for the version of ember-source that we are using
MelSumner Nov 13, 2025
9393046
I don't think this test did what it thought it was doing
MelSumner Nov 13, 2025
fa6e5ce
Adding a11y audit tests back in to find out why skipped
MelSumner Nov 13, 2025
1e579dd
Added comment why we need the test but are still skipping it
MelSumner Nov 13, 2025
6ab7d5b
more linting. monorepos are hard I guess.
MelSumner Nov 13, 2025
b0f1c7c
maybe the new scenario is buggy?
MelSumner Nov 13, 2025
b071e74
updated the dropdown toggle icon test
MelSumner Nov 13, 2025
a1a90fa
move intl from devDep to Dep
MelSumner Nov 17, 2025
65bfa2a
Skipping the weird dropdown toggle icon test for now
MelSumner Nov 17, 2025
71c8b1d
Added extra await settled for dropdown toggle icon with comment to ex…
MelSumner Nov 17, 2025
b22f578
using waitFor instead of settled
MelSumner Nov 18, 2025
b7b3490
removed unnecessary try scenario
MelSumner Nov 18, 2025
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 .github/workflows/ci-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
matrix:
try-scenario:
- ember-lts-4.12
# - hds-ember
# - ember-release
- ember-beta
# - ember-canary
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"ember-concurrency": "^4.0.4",
"ember-element-helper": "^0.8.6",
"ember-focus-trap": "^1.1.1",
"ember-intl": "^7.3.0",
"ember-modifier": "^4.2.2",
"ember-power-select": "^8.7.1",
"ember-stargate": "^1.0.2",
Expand Down Expand Up @@ -94,7 +95,6 @@
"babel-plugin-ember-template-compilation": "^2.4.1",
"concurrently": "^9.1.2",
"ember-basic-dropdown": "^8.6.1",
"ember-intl": "^7.3.0",
"ember-source": "^6.4.0",
"ember-template-lint": "^7.0.2",
"ember-template-lint-plugin-prettier": "^5.0.0",
Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shleewhite since we talked about it today I didn't make a lot of changes BUT a lot of tests that were consistently failing stopped failing after adding the destroyed/destroying check.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { tracked } from '@glimmer/tracking';
import { guidFor } from '@ember/object/internals';
import { service } from '@ember/service';
import { modifier } from 'ember-modifier';
import { isDestroyed, isDestroying } from '@ember/destroyable';
import HdsAdvancedTableTableModel from './models/table.ts';

import type Owner from '@ember/owner';
Expand Down Expand Up @@ -559,7 +560,7 @@ export default class HdsAdvancedTable extends Component<HdsAdvancedTableSignatur

if (reorderedMessageText !== undefined) {
this.reorderedMessageText = reorderedMessageText;
} else {
} else if (!isDestroyed(this) && !isDestroying(this)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw: I tried a similar approach a while back and it seemed to solve the issue with hdsIntl service

const newPosition = insertedAt + 1;
const translatedReorderedMessageText = this.hdsIntl.t(
'hds.advanced-table.reordered-message',
Expand Down
6 changes: 2 additions & 4 deletions packages/components/src/components/hds/breadcrumb/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export default class HdsBreadcrumbItem extends Component<HdsBreadcrumbItemSignat
}
}

async resolveLinkToExternal() {
this.linkToExternal = await hdsResolveLinkToExternal(
this.args.isRouteExternal
);
resolveLinkToExternal() {
this.linkToExternal = hdsResolveLinkToExternal(this.args.isRouteExternal);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/components/src/components/hds/interactive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export default class HdsInteractive extends Component<HdsInteractiveSignature> {
}
}

async resolveLinkToExternal() {
this.linkToExternal = await hdsResolveLinkToExternal(
this.args.isRouteExternal
);
resolveLinkToExternal() {
this.linkToExternal = hdsResolveLinkToExternal(this.args.isRouteExternal);
}
/**
* Determines if a @href value is "external" (it adds target="_blank" rel="noopener noreferrer")
Expand Down
15 changes: 2 additions & 13 deletions packages/components/src/services/hds-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Service from '@ember/service';
import { getOwner } from '@ember/owner';
import { service } from '@ember/service';
import { isPresent } from '@ember/utils';
import { assert } from '@ember/debug';

Expand All @@ -18,18 +18,7 @@ export type HdsIntlTOptions = FormatMessageParameters[1] & {
};

export default class HdsIntlService extends Service {
get intl(): IntlService | undefined {
const owner = getOwner(this);

if (
typeof owner?.factoryFor === 'function' &&
owner.factoryFor('service:intl')
) {
return owner.lookup('service:intl');
}

return undefined;
}
@service('intl') declare intl: IntlService;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zamoore I think this is how we are supposed to do it but I'm not 100%, worth a check though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause errors in codebases where ember-intl is not installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have, moved ember-intl from devDep to Dep for the components package, should be fine.


t(key: string, options: HdsIntlTOptions): string {
const { default: defaultString, ...restOptions } = options;
Expand Down
25 changes: 14 additions & 11 deletions packages/components/src/utils/hds-resolve-link-to-external.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure how we'd actually test this w/o creating an engines situation...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only tested in cloud-ui through RC, it only viable option without spinning another test app with engines, I guess we could create a failing test 🤔 in the showcase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be able to do an ember-try scenario

Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@

import { LinkTo } from '@ember/routing';
import { assert } from '@ember/debug';
import {
dependencySatisfies,
macroCondition,
importSync,
} from '@embroider/macros';

/**
* Resolves the correct component to use for the `LinkTo`.
*
* @param isRouteExternal - If true, will return the `LinkToExternal` component. If `ember-engines` is not installed, an assertion will be thrown.
* @returns A promise resolving to the correct component to use for the `LinkTo`.
* @returns The correct component to use for the `LinkTo`.
*/
export async function hdsResolveLinkToExternal(
export function hdsResolveLinkToExternal(
isRouteExternal?: boolean
): Promise<typeof LinkTo> {
): typeof LinkTo {
if (isRouteExternal) {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const mod = await import(
// @ts-expect-error: we list this as optional peer dependency
if (macroCondition(dependencySatisfies('ember-engines', '*'))) {
// Use importSync for compile-time conditional import
const module = importSync(
'ember-engines/components/link-to-external-component'
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return mod.default as typeof LinkTo;
} catch {
) as { default: typeof LinkTo };
return module.default;
} else {
assert(
`@isRouteExternal is only available when using the "ember-engines" addon. Please install it to use this feature.`,
false
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions showcase/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ module.exports = async function () {
},
},
},
{
name: 'hds-ember',
npm: {
devDependencies: {
'ember-source': '~6.4.0',
},
},
},
{
name: 'ember-release',
npm: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ const hbsNestedAdvancedTable = hbs`<Hds::AdvancedTable
</:body>
</Hds::AdvancedTable>`;

const hbsResizableColumnsAdvancedTable = hbs`<div style="width: 1000px;">
const hbsResizableColumnsAdvancedTable = hbs`{{!-- template-lint-disable no-inline-styles --}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting a lot of errors in our showcase and tests because we aren't taking the time to obey the linting rules or do types properly. Maybe this gets fixed with the refactor so we should just wait on it, but I've noted a few things just in case.

<div style="width: 1000px;">
<Hds::AdvancedTable
@model={{this.model}} @columns={{this.columns}} @hasResizableColumns={{true}} id="resize-test-table"
>
Expand All @@ -386,7 +387,7 @@ const hbsResizableColumnsAdvancedTable = hbs`<div style="width: 1000px;">
<B.Td>{{B.data.col2}}</B.Td>
</B.Tr>
</:body>
</Hds::AdvancedTable></div>`;
</Hds::AdvancedTable></div>{{!-- template-lint-enable no-inline-styles --}}`;

module('Integration | Component | hds/advanced-table/index', function (hooks) {
setupRenderingTest(hooks);
Expand Down Expand Up @@ -727,10 +728,14 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) {
);
await focus(firstThElement);
await focus(firstReorderHandle);
// need to flush the frame to let the RAF waiter finish doing its thing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what we need but also not sure why we're finding three things in the DOM and then focusing on two things in direct succession before asserting anything. Do we need the first focus? Could we find and focus the firstReorderHandle directly?

await new Promise((resolve) => requestAnimationFrame(resolve));

assert.dom(firstReorderHandle).isFocused();

await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowRight');
let columnOrder = await getColumnOrder(this.columns);
await settled();
assert.deepEqual(
columnOrder,
[this.columns[1].key, this.columns[0].key, this.columns[2].key],
Expand All @@ -740,6 +745,8 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) {

await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowRight');
columnOrder = await getColumnOrder(this.columns);
// doing this because request animation frame stuff
await settled();
assert.deepEqual(
columnOrder,
[this.columns[1].key, this.columns[2].key, this.columns[0].key],
Expand All @@ -749,6 +756,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) {

await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowLeft');
columnOrder = await getColumnOrder(this.columns);
await settled();
assert.deepEqual(
columnOrder,
[this.columns[1].key, this.columns[0].key, this.columns[2].key],
Expand Down Expand Up @@ -842,7 +850,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) {
];

// when dealing with dynamic columns, you must handle the order of all potential columns rather than just the ones currently rendered
// inital column order is 'artist', 'album', 'year', 'genre'
// initial column order is 'artist', 'album', 'year', 'genre'
const initialColumnOrder = availableColumns.map((col) => col.key);

// initially set the columns in the reverse order to ensure the table respects the column order and ommit the genre column
Expand Down Expand Up @@ -876,6 +884,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) {

// make sure the initial column order is correct based on the columnOrder
let columnOrder = await getColumnOrder(this.columns);
await settled();
assert.deepEqual(
columnOrder,
['artist', 'album', 'year'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
* SPDX-License-Identifier: MPL-2.0
*/

import { module, skip, test } from 'qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'showcase/tests/helpers';
import {
render,
resetOnerror,
settled,
setupOnerror,
} from '@ember/test-helpers';
import { render, resetOnerror, setupOnerror } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | hds/dropdown/toggle/icon', function (hooks) {
Expand Down Expand Up @@ -40,21 +35,17 @@ module('Integration | Component | hds/dropdown/toggle/icon', function (hooks) {

// IMAGE (AVATAR)

test('if an @imageSrc is declared and exists the image should render in the component', async function (assert) {
test('if an @imageSrc is declared and also exists, the image should render in the component', async function (assert) {
await render(
hbs`<Hds::Dropdown::Toggle::Icon @icon="user" @text="user menu" @imageSrc="/assets/images/avatar.png" id="test-toggle-icon" />`,
);
assert.dom('img').exists();
});

skip('if an @imageSrc is declared but does not exist, the flight icon should render in the component', async function (assert) {
this.set('imageSrc', '/assets/images/avatar.png');
test('if an @imageSrc is declared but the file does not exist, the flight icon should render in the component', async function (assert) {
await render(
hbs`<Hds::Dropdown::Toggle::Icon @icon="user" @text="user menu" @imageSrc={{this.imageSrc}} id="test-toggle-icon" />`,
hbs`<Hds::Dropdown::Toggle::Icon @icon="user" @text="user menu" @imageSrc='/assets/images/avatar-broken.png' id="test-toggle-icon" />`,
);
// we load the image dynamically to cover this usecase and also to prevent this test from intermittently failing for no obvious reason
this.set('imageSrc', '/assets/images/avatar-broken.png');
await settled();
assert.dom('img').doesNotExist();
assert.dom('#test-toggle-icon .hds-icon.hds-icon-user').exists();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ module(
.dom('[data-test-id="popover-content"]')
.isNotVisible('The popover is hidden again by the new toggle');
});
// we have to skip this test because no CSS classes are applied to the popover primitive but I want to leave this test here so we don't think a test is missing.
skip('it should toggle the popover visibility on click', async function (assert) {
await render(hbs`
<Hds::PopoverPrimitive @enableClickEvents={{true}}>
Expand Down Expand Up @@ -207,7 +208,7 @@ module(
as |PP|
>
<div {{PP.setupPrimitiveContainer}}>
<button {{PP.setupPrimitiveToggle}} id="test-popover-primitive-toggle" />
<button type="button" {{PP.setupPrimitiveToggle}} id="test-popover-primitive-toggle" />
<div {{PP.setupPrimitivePopover}} />
</div>
</Hds::PopoverPrimitive>
Expand Down
4 changes: 2 additions & 2 deletions website/tests/acceptance/components/breadcrumb-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MPL-2.0
*/

import { module, test, skip } from 'qunit';
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'website/tests/helpers';
import { a11yAudit } from 'ember-a11y-testing/test-support';
Expand All @@ -17,7 +17,7 @@ module('Acceptance | components/breadcrumb', function (hooks) {
assert.strictEqual(currentURL(), '/components/breadcrumb');
});

skip('components/breadcrumb page passes automated a11y checks', async function (assert) {
test('components/breadcrumb page passes automated a11y checks', async function (assert) {
await visit('/components/breadcrumb');
await a11yAudit();
assert.ok(true, 'a11y automation audit passed');
Expand Down
4 changes: 2 additions & 2 deletions website/tests/acceptance/components/tabs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MPL-2.0
*/

import { module, test, skip } from 'qunit';
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'website/tests/helpers';
import { a11yAudit } from 'ember-a11y-testing/test-support';
Expand All @@ -17,7 +17,7 @@ module('Acceptance | components/tabs', function (hooks) {
assert.strictEqual(currentURL(), '/components/tabs');
});

skip('components/tabs passes a11y automated checks', async function (assert) {
test('components/tabs passes a11y automated checks', async function (assert) {
await visit('/components/tabs');
await a11yAudit();
assert.ok(true, 'a11y automation audit passed');
Expand Down
Loading