- `);
-
- // eslint-disable-next-line ember/no-settled-after-test-helper
- await settled();
-
- const table = find('#data-test-advanced-table');
- const container = find('#resize-test-container');
-
- assert.ok(
- table.offsetWidth >= container.offsetWidth,
- 'Table width is greater than the container width',
- );
-
- this.set('width', '100%');
-
- await settled();
-
- assert.ok(
- table.offsetWidth === container.offsetWidth,
- 'Table width grows to fit container width',
- );
- });
-
- test('it should render correct columns when columns are added or removed dynamically', async function (assert) {
- setTableData(this);
-
- const columns = [
- { key: 'name', label: 'Name' },
- { key: 'age', label: 'Age' },
- { key: 'country', label: 'Country' },
- ];
- const bodyContent = [
- ['Bob', '20', 'USA'],
- ['Alice', '25', 'UK'],
- ['Charlie', '30', 'Canada'],
- ];
-
- this.set('columns', columns);
-
- await render(hbs`
- <:body as |B|>
-
- {{#each this.columns as |column|}}
- {{get B.data column.key}}
- {{/each}}
-
-
-`);
-
- let columnOrder = await getColumnOrder(this.columns);
- assert.deepEqual(
- columnOrder,
- ['name', 'age', 'country'],
- 'Initial columns are correct',
- );
- assert.deepEqual(getBodyContent(), bodyContent);
-
- this.set(
- 'columns',
- this.columns.filter((col) => col.key !== 'age'),
- );
- columnOrder = await getColumnOrder(this.columns);
- assert.deepEqual(
- columnOrder,
- ['name', 'country'],
- 'Columns are correct after removing age',
- );
- assert.deepEqual(getBodyContent(), [
- ['Bob', 'USA'],
- ['Alice', 'UK'],
- ['Charlie', 'Canada'],
- ]);
-
- this.set('columns', columns);
- columnOrder = await getColumnOrder(this.columns);
- assert.deepEqual(
- columnOrder,
- ['name', 'age', 'country'],
- 'Columns are correct after adding age back',
- );
- assert.deepEqual(getBodyContent(), bodyContent);
- });
-});
diff --git a/showcase/tests/integration/components/hds/advanced-table/td-test.js b/showcase/tests/integration/components/hds/advanced-table/td-test.gts
similarity index 71%
rename from showcase/tests/integration/components/hds/advanced-table/td-test.js
rename to showcase/tests/integration/components/hds/advanced-table/td-test.gts
index 490dd38c43c..5dd5e8026be 100644
--- a/showcase/tests/integration/components/hds/advanced-table/td-test.js
+++ b/showcase/tests/integration/components/hds/advanced-table/td-test.gts
@@ -4,16 +4,20 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAdvancedTableTd } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module('Integration | Component | hds/advanced-table/td', function (hooks) {
setupRenderingTest(hooks);
test('it renders with a CSS class that matches the component name', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
.dom('#data-test-advanced-table-td')
@@ -22,14 +26,18 @@ module('Integration | Component | hds/advanced-table/td', function (hooks) {
test('it should render with the appropriate role', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-td').hasAttribute('role', 'gridcell');
});
test('it should render with the appropriate `@align` CSS class', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
.dom('#data-test-advanced-table-td')
@@ -38,7 +46,9 @@ module('Integration | Component | hds/advanced-table/td', function (hooks) {
test('it should render with the appropriate span information by default', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-td').hasNoAttribute('aria-rowspan');
@@ -51,11 +61,13 @@ module('Integration | Component | hds/advanced-table/td', function (hooks) {
test('it should render with the appropriate span information when pass rowspan and colspan', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
@@ -74,7 +86,9 @@ module('Integration | Component | hds/advanced-table/td', function (hooks) {
test('it should support splattributes', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-td').hasAttribute('lang', 'es');
});
diff --git a/showcase/tests/integration/components/hds/advanced-table/th-sort-test.js b/showcase/tests/integration/components/hds/advanced-table/th-sort-test.gts
similarity index 62%
rename from showcase/tests/integration/components/hds/advanced-table/th-sort-test.js
rename to showcase/tests/integration/components/hds/advanced-table/th-sort-test.gts
index 78d759adffe..3462628a45e 100644
--- a/showcase/tests/integration/components/hds/advanced-table/th-sort-test.js
+++ b/showcase/tests/integration/components/hds/advanced-table/th-sort-test.gts
@@ -4,9 +4,11 @@
*/
import { module, test } from 'qunit';
+import { render, click, focus, setupOnerror, find } from '@ember/test-helpers';
+
+import { HdsAdvancedTableThSort } from '@hashicorp/design-system-components/components';
+
import { setupRenderingTest } from 'showcase/tests/helpers';
-import { render, click, focus, setupOnerror } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
module(
'Integration | Component | hds/advanced-table/th-sort',
@@ -14,7 +16,11 @@ module(
setupRenderingTest(hooks);
test('it renders with a CSS class that matches the component name', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -31,7 +37,11 @@ module(
test('it renders text content yielded within the cell', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom(
@@ -44,7 +54,14 @@ module(
test('it should render with the appropriate `@align` CSS class', async function (assert) {
await render(
- hbs`Year`,
+
+
+ Year
+
+ ,
);
assert
.dom('#data-test-advanced-table-th-sort')
@@ -55,7 +72,9 @@ module(
test('if @sortOrder is not defined, the swap-vertical icon should be displayed', async function (assert) {
await render(
- hbs`Artist`,
+
+ Artist
+ ,
);
assert.dom('[data-test-icon="swap-vertical"]').exists();
@@ -63,13 +82,21 @@ module(
test('if sorted, and `@sortOrder` is set, the correct icon should be displayed', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert.dom('[data-test-icon="arrow-up"]').exists();
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert.dom('[data-test-icon="arrow-down"]').exists();
@@ -79,14 +106,20 @@ module(
test('it should support splattributes', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert.dom('#data-test-advanced-table-th').hasAttribute('lang', 'es');
});
test('it has a role and it is set to columnheader by default', async function (assert) {
await render(
- hbs`Artist`,
+
+ Artist
+ ,
);
assert
@@ -95,7 +128,9 @@ module(
});
test('the default `scope` attribute can not be overwritten', async function (assert) {
await render(
- hbs`Artist`,
+
+ Artist
+ ,
);
assert
@@ -105,7 +140,11 @@ module(
test('if unsorted, the aria-sort attribute value should be set to none', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -114,7 +153,14 @@ module(
});
test('if sorted, the aria-sort attribute value should reflect the direction', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -123,15 +169,22 @@ module(
});
test('it renders the `aria-labelledby` attribute for the sort button with the correct IDs', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
- const prefixLabel = this.element.querySelector(
+ const prefixLabel = find(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-button-aria-label-hidden-segment:nth-of-type(1)',
);
- const buttonLabel = this.element.querySelector(
+ const buttonLabel = find(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-content > span',
);
- const suffixLabel = this.element.querySelector(
+ const suffixLabel = find(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-button-aria-label-hidden-segment:nth-of-type(2)',
);
assert
@@ -140,7 +193,7 @@ module(
)
.hasAria(
'labelledby',
- `${prefixLabel.id} ${buttonLabel.id} ${suffixLabel.id}`,
+ `${prefixLabel?.id} ${buttonLabel?.id} ${suffixLabel?.id}`,
);
assert.dom(suffixLabel).hasText('ascending');
});
@@ -154,11 +207,13 @@ module(
});
await render(
- hbs``,
+
+
+ ,
);
assert.throws(function () {
@@ -176,11 +231,13 @@ module(
});
await render(
- hbs``,
+
+
+ ,
);
assert.throws(function () {
@@ -192,9 +249,19 @@ module(
test('it should call the `@onClickSort` function if provided', async function (assert) {
let isClicked = false;
- this.set('onClickSort', () => (isClicked = true));
+ const onClickSort = () => {
+ isClicked = true;
+ };
+
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
await click(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-button--sort',
@@ -206,7 +273,11 @@ module(
test('if @tooltip is undefined a tooltip button toggle should not be present', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -217,7 +288,14 @@ module(
});
test('if @tooltip is defined a tooltip should be added to the table cell header', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -234,19 +312,26 @@ module(
});
test('it renders the `aria-labelledby` attribute for the tooltip button with the correct IDs', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
- let prefixLabel = this.element.querySelector(
+ const prefixLabel = find(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-button-aria-label-hidden-segment',
);
- let buttonLabel = this.element.querySelector(
+ const buttonLabel = find(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-content > span',
);
assert
.dom(
'#data-test-advanced-table-th-sort .hds-advanced-table__th-button--tooltip',
)
- .hasAria('labelledby', `${prefixLabel.id} ${buttonLabel.id}`);
+ .hasAria('labelledby', `${prefixLabel?.id} ${buttonLabel?.id}`);
});
},
);
diff --git a/showcase/tests/integration/components/hds/advanced-table/th-test.js b/showcase/tests/integration/components/hds/advanced-table/th-test.gts
similarity index 64%
rename from showcase/tests/integration/components/hds/advanced-table/th-test.js
rename to showcase/tests/integration/components/hds/advanced-table/th-test.gts
index 69048fe5486..efc81ad6277 100644
--- a/showcase/tests/integration/components/hds/advanced-table/th-test.js
+++ b/showcase/tests/integration/components/hds/advanced-table/th-test.gts
@@ -4,18 +4,25 @@
*/
import { module, test } from 'qunit';
+import { render, focus, click, setupOnerror, find } from '@ember/test-helpers';
+
+import {
+ HdsAdvancedTable,
+ HdsAdvancedTableTh,
+} from '@hashicorp/design-system-components/components';
+
import { setupRenderingTest } from 'showcase/tests/helpers';
-import { render, focus, click, setupOnerror } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | hds/advanced-table/th', function (hooks) {
setupRenderingTest(hooks);
test('it should render with a CSS class that matches the component name', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -27,9 +34,11 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it renders text content yielded within the cell (no tooltip)', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom(
@@ -40,10 +49,14 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it renders text content yielded within the cell (with tooltip)', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom(
@@ -56,9 +69,11 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it does not render an expand button by default', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert.dom('.hds-advanced-table__th-button--expand').doesNotExist();
@@ -66,10 +81,14 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it renders an expand button when `@isExpandable` is true and defaults to collapsed', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom(
@@ -81,11 +100,15 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it renders an expand button when `@isExpandable` is true and is expanded if `@isExpanded`', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom(
@@ -99,14 +122,20 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it should call the `@onClickToggle` function if provided', async function (assert) {
let isClicked = false;
- this.set('onClickToggle', () => (isClicked = true));
+ const onClickToggle = () => {
+ isClicked = true;
+ };
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
await click(
@@ -120,10 +149,11 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it should render with the appropriate `@align` CSS class', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom('#data-advanced-test-table-th')
@@ -134,7 +164,9 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it should render with the appropriate span information by default', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-th').hasNoAttribute('aria-rowspan');
@@ -147,11 +179,13 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it should render with the appropriate span information when pass rowspan and colspan', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
@@ -177,11 +211,13 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
});
await render(
- hbs``,
+
+
+ ,
);
assert.throws(function () {
@@ -199,11 +235,13 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
});
await render(
- hbs``,
+
+
+ ,
);
assert.throws(function () {
@@ -213,19 +251,22 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('it should support splattributes', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert.dom('#data-advanced-test-table-th').hasAttribute('lang', 'es');
});
test('it has the role attribute set to columnheader by default', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
.dom('#data-advanced-test-table-th')
@@ -233,24 +274,28 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
});
test('it has the role rowheader if inside a tbody', async function (assert) {
- this.set('model', [
+ const model = [
{ key: 'artist', name: 'Test 1', description: 'Test 1 description' },
{ key: 'album', name: 'Test 2', description: 'Test 2 description' },
{ key: 'year', name: 'Test 3', description: 'Test 3 description' },
- ]);
+ ];
- this.set('columns', [
+ const columns = [
{ key: 'artist', label: 'components.table.headers.artist' },
{ key: 'album', label: 'components.table.headers.album' },
{ key: 'year', label: 'components.table.headers.year' },
- ]);
+ ];
await render(
- hbs`<:body
- as |B|
- >Artist`,
+
+
+ <:body as |B|>
+
+ Artist
+
+
+
+ ,
);
assert
.dom('#data-advanced-test-table-th')
@@ -261,9 +306,11 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
test('if @tooltip is undefined a tooltip button toggle should not be present', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -274,10 +321,14 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
});
test('if @tooltip is defined a tooltip should be added to the table cell header', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
assert
@@ -294,18 +345,25 @@ module('Integration | Component | hds/advanced-table/th', function (hooks) {
});
test('it renders the `aria-labelledby` attribute for the tooltip button with the correct IDs', async function (assert) {
await render(
- hbs`Artist`,
+
+
+ Artist
+
+ ,
);
- let prefixLabel = this.element.querySelector(
+ const prefixLabel = find(
'#data-advanced-test-table-th .hds-advanced-table__th-button-aria-label-hidden-segment',
);
- let buttonLabel = this.element.querySelector(
+ const buttonLabel = find(
'#data-advanced-test-table-th .hds-advanced-table__th-content > span',
);
assert
.dom(
'#data-advanced-test-table-th .hds-advanced-table__th-button--tooltip',
)
- .hasAria('labelledby', `${prefixLabel.id} ${buttonLabel.id}`);
+ .hasAria('labelledby', `${prefixLabel?.id} ${buttonLabel?.id}`);
});
});
diff --git a/showcase/tests/integration/components/hds/advanced-table/tr-test.js b/showcase/tests/integration/components/hds/advanced-table/tr-test.gts
similarity index 59%
rename from showcase/tests/integration/components/hds/advanced-table/tr-test.js
rename to showcase/tests/integration/components/hds/advanced-table/tr-test.gts
index b31291c43f8..97c375df564 100644
--- a/showcase/tests/integration/components/hds/advanced-table/tr-test.js
+++ b/showcase/tests/integration/components/hds/advanced-table/tr-test.gts
@@ -4,16 +4,22 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render, click, setupOnerror } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+import { TrackedObject } from 'tracked-built-ins';
+
+import { HdsAdvancedTableTr } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
+import NOOP from 'showcase/utils/noop';
module('Integration | Component | hds/advanced-table/tr', function (hooks) {
setupRenderingTest(hooks);
test('it should render with a CSS class that matches the component name', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
@@ -23,7 +29,9 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
test('it should render with the appropriate role', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-tr').hasAttribute('role', 'row');
});
@@ -32,8 +40,10 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
test('it should render the yielded content', async function (assert) {
await render(
- hbs`
`,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-tr > td').exists();
});
@@ -45,50 +55,60 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
test('it should not render a checkbox if `@isSelectable` is not set', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom(checkboxSelector).doesNotExist();
});
test('it should render a checkbox if `@isSelectable` is `true`', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom(checkboxSelector).exists();
});
test('the checkbox should be checked if `@isSelected` is `true`', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom(checkboxSelector).isChecked();
});
test('the checkbox contains the `@selectionAriaLabelSuffix` suffix', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom(checkboxSelector).hasAria('label', 'Select row 123');
});
test('the `th` element has the correct `role` attribute value provided via `@selectionScope`', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
.dom(
@@ -98,33 +118,41 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
});
test('it should invoke the `onSelectionChange` callback when the checkbox is selected', async function (assert) {
- let key;
- this.set(
- 'onSelectionChange',
- (_checkbox, selectionKey) => (key = selectionKey),
- );
+ const context = new TrackedObject<{ key?: string }>({
+ key: undefined,
+ });
+
+ const onSelectionChange = (
+ _checkbox?: HTMLInputElement,
+ selectionKey?: string,
+ ) => {
+ context.key = selectionKey;
+ };
+
await render(
- hbs``,
+
+
+ ,
);
await click(checkboxSelector);
- assert.strictEqual(key, 'row123');
+ assert.strictEqual(context.key, 'row123');
});
test('it should render a sort button in the checkbox cell if `@onClickSortBySelected` is provided and `@isSelectable` is `true`', async function (assert) {
- this.set('noop', () => {});
-
await render(
- hbs``,
+
+
+ ,
);
assert
@@ -134,10 +162,12 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
test('it should not render a sort button in the checkbox cell if `@isSelectable` is `true`, and `@onClickSortBySelected` is undefined', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
@@ -149,7 +179,9 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
test('it should support splattributes', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#data-test-advanced-table-tr').hasAttribute('lang', 'es');
});
@@ -164,7 +196,9 @@ module('Integration | Component | hds/advanced-table/tr', function (hooks) {
assert.strictEqual(error.message, errorMessage);
});
await render(
- hbs``,
+
+
+ ,
);
assert.throws(function () {
throw new Error(errorMessage);
diff --git a/showcase/tests/integration/components/hds/alert/index-test.js b/showcase/tests/integration/components/hds/alert/index-test.gts
similarity index 64%
rename from showcase/tests/integration/components/hds/alert/index-test.js
rename to showcase/tests/integration/components/hds/alert/index-test.gts
index d418865a48e..40b6346b96c 100644
--- a/showcase/tests/integration/components/hds/alert/index-test.js
+++ b/showcase/tests/integration/components/hds/alert/index-test.gts
@@ -4,9 +4,12 @@
*/
import { module, test } from 'qunit';
+import { render, resetOnerror, setupOnerror, find } from '@ember/test-helpers';
+
+import { HdsAlert } from '@hashicorp/design-system-components/components';
+
import { setupRenderingTest } from 'showcase/tests/helpers';
-import { render, resetOnerror, setupOnerror } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+import NOOP from 'showcase/utils/noop';
module('Integration | Component | hds/alert/index', function (hooks) {
setupRenderingTest(hooks);
@@ -16,14 +19,18 @@ module('Integration | Component | hds/alert/index', function (hooks) {
});
test('it should render the component with a CSS class that matches the component name', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('#test-alert').hasClass('hds-alert');
});
// TYPE
test('it should render the correct CSS type class depending on the @type prop', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('#test-alert').hasClass('hds-alert--type-page');
});
@@ -31,29 +38,43 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render an icon by default depending on the type and color', async function (assert) {
// here we don't test all the possible combinations, only some of them as precaution
- await render(hbs``);
+ await render();
assert.dom('.hds-icon-info').exists();
- await render(hbs``);
+ await render();
assert.dom('.hds-icon-info-fill').exists();
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-info').exists();
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-check-circle').exists();
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-alert-triangle').exists();
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-alert-diamond').exists();
});
test('if an icon is declared, the icon should render in the component and override the default one', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-clipboard-copy').exists();
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon-clipboard-copy').exists();
});
test('it should display no icon when @icon is set to false', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('.hds-icon').doesNotExist();
});
@@ -61,19 +82,32 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render the title when the "title" contextual component is provided', async function (assert) {
await render(
- hbs`This is the title`,
+
+ This is the title
+ ,
);
- assert.dom(this.element).hasText('This is the title');
+ assert.dom('.hds-alert').hasText('This is the title');
});
test('it should render the description when the "description" contextual component is provided', async function (assert) {
await render(
- hbs`This is the description`,
+
+ This is the description
+ ,
);
- assert.dom(this.element).hasText('This is the description');
+ assert.dom('.hds-alert').hasText('This is the description');
});
test('it should render rich HTML when the "description" contextual component contains HTML tags', async function (assert) {
await render(
- hbs`Hello strong and em and code and link`,
+
+ Hello
+ strong
+ and
+ em
+ and
+ code
+ and
+ link
+ ,
);
assert.dom('.hds-alert__description strong').exists().hasText('strong');
assert.dom('.hds-alert__description em').exists().hasText('em');
@@ -81,17 +115,23 @@ module('Integration | Component | hds/alert/index', function (hooks) {
assert.dom('.hds-alert__description a').exists().hasText('link');
});
test('it should render a div when the @tag argument is not provided', async function (assert) {
- await render(hbs`
-
- This is the title
- `);
+ await render(
+
+
+ This is the title
+
+ ,
+ );
assert.dom('.hds-alert__title').hasTagName('div');
});
test('it should render the custom title tag when the @tag argument is provided', async function (assert) {
- await render(hbs`
-
- This is the title
- `);
+ await render(
+
+
+ This is the title
+
+ ,
+ );
assert.dom('.hds-alert__title').hasTagName('h2');
});
@@ -99,7 +139,19 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render an Hds::Button component yielded to the "actions" container', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
.dom('#test-alert .hds-alert__actions button')
@@ -111,7 +163,21 @@ module('Integration | Component | hds/alert/index', function (hooks) {
});
test('it should render an Hds::Link::Standalone component yielded to the "actions" container', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert
.dom('#test-alert .hds-alert__actions a')
@@ -126,7 +192,10 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render any content passed to the "generic" contextual component', async function (assert) {
await render(
- hbs`
test
`,
+
+
test
+ ,
);
assert.dom('#test-alert .hds-alert__content pre').exists().hasText('test');
});
@@ -134,12 +203,13 @@ module('Integration | Component | hds/alert/index', function (hooks) {
// DISMISS
test('it should not render the "dismiss" button by default', async function (assert) {
- await render(hbs``);
+ await render();
assert.dom('button.hds-alert__dismiss').doesNotExist();
});
test('it should render the "dismiss" button if a callback function is passed to the @onDismiss argument', async function (assert) {
- this.set('NOOP', () => {});
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('button.hds-alert__dismiss').exists();
});
@@ -149,7 +219,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render the component with role="alert" and aria-live="polite" for the "success" color', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alert');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -157,7 +229,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render the component with role="alert" and aria-live="polite" for the "warning" color', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alert');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -165,7 +239,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render the component with role="alert" and aria-live="polite" for the "critical" color', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alert');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -175,7 +251,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should not render the component with role="alert" and aria-live="polite" for the "neutral" color', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-alert').doesNotHaveAttribute('role', 'alert');
assert.dom('#test-alert').doesNotHaveAttribute('aria-live', 'polite');
@@ -183,7 +261,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should not render the component with role="alert" and aria-live="polite" for the "highlight" color', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-alert').doesNotHaveAttribute('role', 'alert');
assert.dom('#test-alert').doesNotHaveAttribute('aria-live', 'polite');
@@ -193,28 +273,28 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render with an auto-generated `aria-labelledby` when a title is provided', async function (assert) {
await render(
- hbs`
-
+
+ This is the title
-
- `,
+
+ ,
);
- let title = this.element.querySelector('#test-alert .hds-alert__title');
- assert.dom('#test-alert').hasAttribute('aria-labelledby', title.id);
+ const title = find('#test-alert .hds-alert__title');
+ assert.dom('#test-alert').hasAttribute('aria-labelledby', title?.id ?? '');
});
test('it should render with an auto-generated `aria-labelledby` when description is provided', async function (assert) {
await render(
- hbs`
-
+
+ This is the title
-
- `,
+
+ ,
);
- let description = this.element.querySelector(
- '#test-alert .hds-alert__description',
- );
- assert.dom('#test-alert').hasAttribute('aria-labelledby', description.id);
+ const description = find('#test-alert .hds-alert__description');
+ assert
+ .dom('#test-alert')
+ .hasAttribute('aria-labelledby', description?.id ?? '');
});
// Alert dialogs
@@ -223,11 +303,11 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render with with role="alertdialog" and aria-live="polite" for the "success" color when actions are provided', async function (assert) {
await render(
- hbs`
-
+
+
-
- `,
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alertdialog');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -235,11 +315,11 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render with with role="alertdialog" and aria-live="polite" for the "warning" color when actions are provided', async function (assert) {
await render(
- hbs`
-
+
+
-
- `,
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alertdialog');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -247,11 +327,11 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should render with with role="alertdialog" and aria-live="polite" for the "critical" color when actions are provided', async function (assert) {
await render(
- hbs`
-
+
+
-
- `,
+
+ ,
);
assert.dom('#test-alert').hasAttribute('role', 'alertdialog');
assert.dom('#test-alert').hasAttribute('aria-live', 'polite');
@@ -261,11 +341,11 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should not render with with role="alertdialog" and aria-live="polite" for the "neutral" color when actions are provided', async function (assert) {
await render(
- hbs`
-
+
+
-
- `,
+
+ ,
);
assert.dom('#test-alert').doesNotHaveAttribute('role', 'alertdialog');
assert.dom('#test-alert').doesNotHaveAttribute('aria-live', 'polite');
@@ -273,11 +353,11 @@ module('Integration | Component | hds/alert/index', function (hooks) {
test('it should not render with with role="alertdialog" and aria-live="polite" for the "highlight" color when actions are provided', async function (assert) {
await render(
- hbs`
-
+
+
-
- `,
+
+ ,
);
assert.dom('#test-alert').doesNotHaveAttribute('role', 'alertdialog');
assert.dom('#test-alert').doesNotHaveAttribute('aria-live', 'polite');
@@ -292,7 +372,12 @@ module('Integration | Component | hds/alert/index', function (hooks) {
setupOnerror(function (error) {
assert.strictEqual(error.message, `Assertion Failed: ${errorMessage}`);
});
- await render(hbs``);
+ await render(
+
+ {{! @glint-expect-error - assertion testing invalid value }}
+
+ ,
+ );
assert.throws(function () {
throw new Error(errorMessage);
});
@@ -304,7 +389,9 @@ module('Integration | Component | hds/alert/index', function (hooks) {
setupOnerror(function (error) {
assert.strictEqual(error.message, `Assertion Failed: ${errorMessage}`);
});
- await render(hbs``);
+ await render(
+ ,
+ );
assert.throws(function () {
throw new Error(errorMessage);
});
@@ -316,7 +403,12 @@ module('Integration | Component | hds/alert/index', function (hooks) {
setupOnerror(function (error) {
assert.strictEqual(error.message, `Assertion Failed: ${errorMessage}`);
});
- await render(hbs``);
+ await render(
+
+ {{! @glint-expect-error - assertion testing invalid value }}
+
+ ,
+ );
assert.throws(function () {
throw new Error(errorMessage);
});
diff --git a/showcase/tests/integration/components/hds/app-footer/copyright-test.js b/showcase/tests/integration/components/hds/app-footer/copyright-test.gts
similarity index 65%
rename from showcase/tests/integration/components/hds/app-footer/copyright-test.js
rename to showcase/tests/integration/components/hds/app-footer/copyright-test.gts
index ffea2d39105..6051097517a 100644
--- a/showcase/tests/integration/components/hds/app-footer/copyright-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/copyright-test.gts
@@ -4,9 +4,11 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooterCopyright } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module('Integration | Component | hds/app-footer/copyright', function (hooks) {
setupRenderingTest(hooks);
@@ -14,20 +16,26 @@ module('Integration | Component | hds/app-footer/copyright', function (hooks) {
const currentYear = new Date().getFullYear();
test('it should render the component with a CSS class that matches the component name', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('#test-copyright').hasClass('hds-app-footer__copyright');
});
// OPTIONS
test('it renders the copyright with the current year by default', async function (assert) {
- await render(hbs``);
- assert.dom('#test-copyright').includesText(currentYear);
+ await render(
+ ,
+ );
+ assert.dom('#test-copyright').includesText(`${currentYear}`);
});
test('it renders the copyright with the passed in year value', async function (assert) {
await render(
- hbs``,
+
+
+ ,
);
assert.dom('#test-copyright').includesText('1984');
});
diff --git a/showcase/tests/integration/components/hds/app-footer/index-test.js b/showcase/tests/integration/components/hds/app-footer/index-test.gts
similarity index 58%
rename from showcase/tests/integration/components/hds/app-footer/index-test.js
rename to showcase/tests/integration/components/hds/app-footer/index-test.gts
index 1c3f4abc169..aaa9eb1940d 100644
--- a/showcase/tests/integration/components/hds/app-footer/index-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/index-test.gts
@@ -4,38 +4,46 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooter } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module('Integration | Component | hds/app-footer/index', function (hooks) {
setupRenderingTest(hooks);
test('it should render the component with a CSS class that matches the component name', async function (assert) {
- await render(hbs``);
+ await render();
assert.dom('#test-app-footer').hasClass('hds-app-footer');
});
// CONTENT
test('it renders the default content', async function (assert) {
- await render(hbs``);
+ await render();
assert.dom('.hds-app-footer__copyright').exists();
});
test('it renders the passed in content', async function (assert) {
- await render(hbs`
-
- Before
- Custom item
-
- Custom link
-
-
-
- After
-
- `);
+ await render(
+
+
+ Before
+ Custom item
+
+ Custom link
+
+
+
+ After
+
+ ,
+ );
assert.dom('#test-extra-before').hasText('Before');
assert.dom('#test-custom-item').hasText('Custom item');
assert
@@ -51,12 +59,14 @@ module('Integration | Component | hds/app-footer/index', function (hooks) {
// OPTIONS
test('it renders with the default "light" theme', async function (assert) {
- await render(hbs``);
+ await render();
assert.dom('#test-app-footer').hasClass('hds-app-footer--theme-light');
});
test('it renders with the passed in "dark" theme', async function (assert) {
- await render(hbs``);
+ await render(
+ ,
+ );
assert.dom('#test-app-footer').hasClass('hds-app-footer--theme-dark');
});
});
diff --git a/showcase/tests/integration/components/hds/app-footer/item-test.js b/showcase/tests/integration/components/hds/app-footer/item-test.gts
similarity index 69%
rename from showcase/tests/integration/components/hds/app-footer/item-test.js
rename to showcase/tests/integration/components/hds/app-footer/item-test.gts
index 97246a9f68a..588615d1fe5 100644
--- a/showcase/tests/integration/components/hds/app-footer/item-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/item-test.gts
@@ -4,15 +4,21 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooterItem } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module('Integration | Component | hds/app-footer/item', function (hooks) {
setupRenderingTest(hooks);
test('it should render the component with a CSS class that matches the component name', async function (assert) {
- await render(hbs`
`);
+ await render(
+
+
+ ,
+ );
assert.dom('#test-item').hasClass('hds-app-footer__list-item');
});
@@ -20,7 +26,9 @@ module('Integration | Component | hds/app-footer/item', function (hooks) {
test('it renders text content yielded within the Item', async function (assert) {
await render(
- hbs`
Custom item
`,
+
+
Custom item
+ ,
);
assert.dom('#test-item').hasText('Custom item');
});
diff --git a/showcase/tests/integration/components/hds/app-footer/legal-links-test.js b/showcase/tests/integration/components/hds/app-footer/legal-links-test.gts
similarity index 76%
rename from showcase/tests/integration/components/hds/app-footer/legal-links-test.js
rename to showcase/tests/integration/components/hds/app-footer/legal-links-test.gts
index c10734686bb..86370690916 100644
--- a/showcase/tests/integration/components/hds/app-footer/legal-links-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/legal-links-test.gts
@@ -4,9 +4,11 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooterLegalLinks } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module(
'Integration | Component | hds/app-footer/legal-links',
@@ -15,7 +17,9 @@ module(
test('it should render the component with a CSS class that matches the component name', async function (assert) {
await render(
- hbs`
`,
+
+
+ ,
);
assert.dom('#test-legal-links').hasClass('hds-app-footer__legal-links');
});
@@ -24,7 +28,9 @@ module(
test('it contains the default links with default href values', async function (assert) {
await render(
- hbs`
`,
+
+
+ ,
);
assert
.dom('#test-legal-links li:nth-child(1) a')
@@ -51,16 +57,18 @@ module(
// OPTIONS
test('it uses the passed in custom href values', async function (assert) {
- await render(hbs`
-
- `);
+ await render(
+
+
+ ,
+ );
assert
.dom('#test-legal-links li:nth-child(1) a')
.hasText('Support')
diff --git a/showcase/tests/integration/components/hds/app-footer/link-test.js b/showcase/tests/integration/components/hds/app-footer/link-test.gts
similarity index 63%
rename from showcase/tests/integration/components/hds/app-footer/link-test.js
rename to showcase/tests/integration/components/hds/app-footer/link-test.gts
index bc47c0e285b..de8307ee467 100644
--- a/showcase/tests/integration/components/hds/app-footer/link-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/link-test.gts
@@ -4,20 +4,25 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooterLink } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module('Integration | Component | hds/app-footer/link', function (hooks) {
setupRenderingTest(hooks);
test('it should render the component with a CSS class that matches the component name', async function (assert) {
- await render(hbs`
-
-
- Custom link
-
-
`);
+ await render(
+
+
+
+ Custom link
+
+
+ ,
+ );
assert.dom('#test-link').hasClass('hds-app-footer__link');
});
@@ -25,12 +30,13 @@ module('Integration | Component | hds/app-footer/link', function (hooks) {
test('it renders text content yielded within the Link', async function (assert) {
await render(
- hbs`
+
-
+
Custom link
-
-
`,
+
+
+ ,
);
assert
.dom('#test-link')
diff --git a/showcase/tests/integration/components/hds/app-footer/status-link-test.js b/showcase/tests/integration/components/hds/app-footer/status-link-test.gts
similarity index 68%
rename from showcase/tests/integration/components/hds/app-footer/status-link-test.js
rename to showcase/tests/integration/components/hds/app-footer/status-link-test.gts
index f594c3245b1..ff22b2610b9 100644
--- a/showcase/tests/integration/components/hds/app-footer/status-link-test.js
+++ b/showcase/tests/integration/components/hds/app-footer/status-link-test.gts
@@ -4,9 +4,11 @@
*/
import { module, test } from 'qunit';
-import { setupRenderingTest } from 'showcase/tests/helpers';
import { render, setupOnerror } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
+
+import { HdsAppFooterStatusLink } from '@hashicorp/design-system-components/components';
+
+import { setupRenderingTest } from 'showcase/tests/helpers';
module(
'Integration | Component | hds/app-footer/status-link',
@@ -15,7 +17,12 @@ module(
test('it should render the component with a CSS class that matches the component name', async function (assert) {
await render(
- hbs`
`,
+
+
+ ,
);
assert.dom('#test-status-link').hasClass('hds-app-footer__status-link');
});
@@ -25,12 +32,22 @@ module(
// status
test('it should display text, icon, and icon color matching the passed in status', async function (assert) {
- await render(hbs`
-
-
-
-
-
`);
+ await render(
+
+
+
+
+
+
+
+ ,
+ );
// operational
assert
.dom('#test-operational')
@@ -68,13 +85,15 @@ module(
// text, statusIcon, statusIconColor
test('it should display the custom text, icon color, and icon passed in', async function (assert) {
- await render(hbs`
-
- `);
+ await render(
+
+
+ ,
+ );
assert.dom('.hds-app-footer__status-link').hasText('Waypoint');
assert.dom('.hds-app-footer__status-link .hds-icon').exists();
// .hasStyle({'--hds-app-footer-status-icon-color': 'var(--token-color-waypoint-brand)'})
@@ -83,9 +102,14 @@ module(
// href
test('it should use the passed in href for the link', async function (assert) {
- await render(hbs`
-