Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an isOpenInitially argument to the AuAccordion component #469

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Changes from 1 commit
Commits
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
Next Next commit
Add Glint support to the AuToolbar component
  • Loading branch information
Windvis committed Feb 15, 2024
commit 75e54ed8f66be53d3c1eb96874bb9bf45e7cfbf9
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import type { TOC } from '@ember/component/template-only';
import Component from '@glimmer/component';

export default class AuToolbar extends Component {
export interface AuToolbarSignature {
Args: {
reverse?: boolean;
border?: 'top' | 'bottom';
skin?: 'tint';
size?: 'small' | 'medium' | 'large';
nowrap?: boolean;
};
Blocks: {
default: [typeof Group];
};
Element: HTMLDivElement;
}

export default class AuToolbar extends Component<AuToolbarSignature> {
get reverse() {
if (this.args.reverse) return 'au-c-toolbar--reverse';
else return '';
@@ -44,7 +59,14 @@ export default class AuToolbar extends Component {
</template>
}

const Group = <template>
interface GroupSignature {
Blocks: {
default: [];
};
Element: HTMLDivElement;
}

const Group: TOC<GroupSignature> = <template>
<div class="au-c-toolbar__group" ...attributes>
{{yield}}
</div>
2 changes: 2 additions & 0 deletions addon/template-registry.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import type AuLinkExternal from '@appuniversum/ember-appuniversum/components/au-
import type AuLink from '@appuniversum/ember-appuniversum/components/au-link';
import type AuList from '@appuniversum/ember-appuniversum/components/au-list';
import type AuLoader from '@appuniversum/ember-appuniversum/components/au-loader';
import type AuToolbar from '@appuniversum/ember-appuniversum/components/au-toolbar';

// Modifiers
import type AuDateInputModifier from '@appuniversum/ember-appuniversum/modifiers/au-date-input';
@@ -43,6 +44,7 @@ export default interface AppuniversumRegistry {
AuLink: typeof AuLink;
AuList: typeof AuList;
AuLoader: typeof AuLoader;
AuToolbar: typeof AuToolbar;

// Modifiers
'au-date-input': typeof AuDateInputModifier;
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import AuToolbar from '@appuniversum/ember-appuniversum/components/au-toolbar';

module('Integration | Component | au-toolbar', function (hooks) {
setupRenderingTest(hooks);

test('it yields a group component', async function (assert) {
await render(hbs`
<AuToolbar as |Group|>
<Group data-test-foo>Foo</Group>
<Group data-test-bar>Bar</Group>
</AuToolbar>
`);
await render(
<template>
<AuToolbar as |Group|>
<Group data-test-foo>Foo</Group>
<Group data-test-bar>Bar</Group>
</AuToolbar>
</template>,
);

assert.dom('[data-test-foo]').hasText('Foo');
assert.dom('[data-test-bar]').hasText('Bar');
});

test('it passes through extra html attributes', async function (assert) {
await render(hbs`
<AuToolbar data-test-foo="bar"></AuToolbar>
`);
await render(<template><AuToolbar data-test-foo="bar" /></template>);

assert.dom('[data-test-foo]').exists();
});
7 changes: 7 additions & 0 deletions tests/integration/components/loose-mode-test.ts
Original file line number Diff line number Diff line change
@@ -139,6 +139,13 @@ module('Integration | Component | Loose mode', function (hooks) {
`);
assert.dom('[data-test-loader]').exists();
});

test('`<AuToolbar>` resolves in loose mode', async function (assert) {
await render(hbs`
<AuToolbar data-test-toolbar></AuToolbar>
`);
assert.dom('[data-test-toolbar]').exists();
});
});

module('Integration | Modifier | Loose mode', function (hooks) {