Skip to content

Commit 4862368

Browse files
committed
Add Glint support to the AuTable component
1 parent 1877626 commit 4862368

File tree

4 files changed

+38
-22
lines changed

4 files changed

+38
-22
lines changed

addon/components/au-table.gjs addon/components/au-table.gts

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import Component from '@glimmer/component';
22

3-
export default class AuTable extends Component {
3+
export interface AuTableSignature {
4+
Args: {
5+
size?: 'small';
6+
};
7+
Blocks: {
8+
body: [];
9+
footer: [];
10+
header: [];
11+
title: [];
12+
};
13+
Element: HTMLTableElement;
14+
}
15+
16+
export default class AuTable extends Component<AuTableSignature> {
417
get size() {
518
if (this.args.size == 'small') return 'au-c-table--small';
619
else return '';

addon/template-registry.ts

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import type AuPanel from '@appuniversum/ember-appuniversum/components/au-panel';
3737
import type AuPill from '@appuniversum/ember-appuniversum/components/au-pill';
3838
import type AuRadioGroup from '@appuniversum/ember-appuniversum/components/au-radio-group';
3939
import type AuRadio from '@appuniversum/ember-appuniversum/components/au-radio';
40+
import type AuTable from '@appuniversum/ember-appuniversum/components/au-table';
4041
import type AuToolbar from '@appuniversum/ember-appuniversum/components/au-toolbar';
4142

4243
// Modifiers
@@ -82,6 +83,7 @@ export default interface AppuniversumRegistry {
8283
AuPill: typeof AuPill;
8384
AuRadioGroup: typeof AuRadioGroup;
8485
AuRadio: typeof AuRadio;
86+
AuTable: typeof AuTable;
8587
AuToolbar: typeof AuToolbar;
8688

8789
// Modifiers

tests/integration/components/au-table-test.js tests/integration/components/au-table-test.gts

+15-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { module, test } from 'qunit';
2-
import { setupRenderingTest } from 'ember-qunit';
1+
import AuTable from '@appuniversum/ember-appuniversum/components/au-table';
32
import { render } from '@ember/test-helpers';
4-
import { hbs } from 'ember-cli-htmlbars';
3+
import { setupRenderingTest } from 'ember-qunit';
4+
import { module, test } from 'qunit';
55

66
const TABLE = {
77
TABLE: '[data-test-table]',
@@ -15,26 +15,24 @@ module('Integration | Component | au-table', function (hooks) {
1515
setupRenderingTest(hooks);
1616

1717
test('it has optional named blocks', async function (assert) {
18-
await render(hbs`
19-
<AuTable>
20-
default block content
21-
</AuTable>
22-
`);
18+
await render(<template><AuTable /></template>);
2319

2420
assert.dom(TABLE.TABLE).hasNoText();
2521
assert.dom(TABLE.TITLE).doesNotExist();
2622
assert.dom(TABLE.HEADER).doesNotExist();
2723
assert.dom(TABLE.BODY).doesNotExist();
2824
assert.dom(TABLE.FOOTER).doesNotExist();
2925

30-
await render(hbs`
31-
<AuTable>
32-
<:title>Title</:title>
33-
<:header>Header</:header>
34-
<:body>Body</:body>
35-
<:footer>Footer</:footer>
36-
</AuTable>
37-
`);
26+
await render(
27+
<template>
28+
<AuTable>
29+
<:title>Title</:title>
30+
<:header>Header</:header>
31+
<:body>Body</:body>
32+
<:footer>Footer</:footer>
33+
</AuTable>
34+
</template>,
35+
);
3836

3937
assert.dom(TABLE.TITLE).hasText('Title');
4038
assert.dom(TABLE.HEADER).hasText('Header');
@@ -43,11 +41,7 @@ module('Integration | Component | au-table', function (hooks) {
4341
});
4442

4543
test('it accepts extra html attributes', async function (assert) {
46-
await render(hbs`
47-
<AuTable class="test">
48-
default block content
49-
</AuTable>
50-
`);
44+
await render(<template><AuTable class="test" /></template>);
5145

5246
assert.dom(TABLE.TABLE).hasClass('test');
5347
});

tests/integration/components/loose-mode-test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ module('Integration | Component | Loose mode', function (hooks) {
269269
assert.dom('[data-test-radio]').exists();
270270
});
271271

272+
test('`<AuTable>` resolves in loose mode', async function (assert) {
273+
await render(hbs`
274+
<AuTable data-test-table />
275+
`);
276+
assert.dom('[data-test-table]').exists();
277+
});
278+
272279
test('`<AuToolbar>` resolves in loose mode', async function (assert) {
273280
await render(hbs`
274281
<AuToolbar data-test-toolbar></AuToolbar>

0 commit comments

Comments
 (0)