Skip to content

Commit

Permalink
Merge pull request #485 from appuniversum/chore/au-accordion-test-tweaks
Browse files Browse the repository at this point in the history
Remove the icon tests from the `AuAccordion` component
  • Loading branch information
Windvis authored Mar 20, 2024
2 parents 654711a + 9a64173 commit b5b8f45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 73 deletions.
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

0 comments on commit b5b8f45

Please sign in to comment.