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

Remove the icon tests from the AuAccordion component #485

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 6 additions & 17 deletions addon/components/au-accordion.gts
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,12 @@ export default class AuAccordion extends Component<AuAccordionSignature> {
</div>
</Group>
<Group>
{{#if this.isOpen}}
<AuIcon
@icon={{this.iconOpen}}
@alignment="left"
@size="large"
@ariaHidden={{true}}
data-test-accordion-icon-open={{this.iconOpen}}
/>
{{else}}
<AuIcon
@icon={{this.iconClosed}}
@alignment="left"
@size="large"
@ariaHidden={{true}}
data-test-accordion-icon-closed={{this.iconClosed}}
/>
{{/if}}
<AuIcon
@icon={{if this.isOpen this.iconOpen this.iconClosed}}
@alignment="left"
@size="large"
@ariaHidden={{true}}
/>
</Group>
</AuToolbar>
{{#if this.isOpen}}
Expand Down
56 changes: 0 additions & 56 deletions tests/integration/components/au-accordion-test.gts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const ACCORDION = {
CONTENT: '[data-test-accordion-content]',
BUTTON: '[data-test-accordion-button]',
SUBTITLE: '[data-test-accordion-subtitle]',
ICON_OPEN: '[data-test-accordion-icon-open]',
ICON_CLOSED: '[data-test-accordion-icon-closed]',
LOADER: '[data-test-accordion-loader]',
};

Expand Down Expand Up @@ -87,60 +85,6 @@ module('Integration | Component | au-accordion', function (hooks) {
assert.dom(ACCORDION.BUTTON).exists().hasText('Foo button');
});

test('it shows a different icon depending on the open state', async function (assert) {
await render(
<template>
<AuAccordion>
Some content
</AuAccordion>
</template>,
);

assert.dom(ACCORDION.ICON_OPEN).doesNotExist();
assert.dom(ACCORDION.ICON_CLOSED).exists();

await toggleAccordion();
assert.dom(ACCORDION.ICON_OPEN).exists();
assert.dom(ACCORDION.ICON_CLOSED).doesNotExist();
});

test('it supports choosing different icons', async function (assert) {
const state = new TestState();
await render(
<template>
<AuAccordion
@iconOpen={{state.iconOpen}}
@iconClosed={{state.iconClosed}}
>
Some content
</AuAccordion>
</template>,
);

assert
.dom(ACCORDION.ICON_CLOSED)
.hasAttribute('data-test-accordion-icon-closed', 'nav-right');

state.iconClosed = 'other-closed-icon';
await settled();

assert
.dom(ACCORDION.ICON_CLOSED)
.hasAttribute('data-test-accordion-icon-closed', 'other-closed-icon');

await toggleAccordion();
assert
.dom(ACCORDION.ICON_OPEN)
.hasAttribute('data-test-accordion-icon-open', 'nav-down');

state.iconOpen = 'other-open-icon';
await settled();

assert
.dom(ACCORDION.ICON_OPEN)
.hasAttribute('data-test-accordion-icon-open', 'other-open-icon');
});

test('it can show a loading indicator instead of content', async function (assert) {
const state = new TestState();
state.isLoading = true;
Expand Down
Loading