Skip to content

Commit b5b8f45

Browse files
authoredMar 20, 2024
Merge pull request #485 from appuniversum/chore/au-accordion-test-tweaks
Remove the icon tests from the `AuAccordion` component
2 parents 654711a + 9a64173 commit b5b8f45

File tree

2 files changed

+6
-73
lines changed

2 files changed

+6
-73
lines changed
 

‎addon/components/au-accordion.gts

+6-17
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,12 @@ export default class AuAccordion extends Component<AuAccordionSignature> {
101101
</div>
102102
</Group>
103103
<Group>
104-
{{#if this.isOpen}}
105-
<AuIcon
106-
@icon={{this.iconOpen}}
107-
@alignment="left"
108-
@size="large"
109-
@ariaHidden={{true}}
110-
data-test-accordion-icon-open={{this.iconOpen}}
111-
/>
112-
{{else}}
113-
<AuIcon
114-
@icon={{this.iconClosed}}
115-
@alignment="left"
116-
@size="large"
117-
@ariaHidden={{true}}
118-
data-test-accordion-icon-closed={{this.iconClosed}}
119-
/>
120-
{{/if}}
104+
<AuIcon
105+
@icon={{if this.isOpen this.iconOpen this.iconClosed}}
106+
@alignment="left"
107+
@size="large"
108+
@ariaHidden={{true}}
109+
/>
121110
</Group>
122111
</AuToolbar>
123112
{{#if this.isOpen}}

‎tests/integration/components/au-accordion-test.gts

-56
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const ACCORDION = {
99
CONTENT: '[data-test-accordion-content]',
1010
BUTTON: '[data-test-accordion-button]',
1111
SUBTITLE: '[data-test-accordion-subtitle]',
12-
ICON_OPEN: '[data-test-accordion-icon-open]',
13-
ICON_CLOSED: '[data-test-accordion-icon-closed]',
1412
LOADER: '[data-test-accordion-loader]',
1513
};
1614

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

90-
test('it shows a different icon depending on the open state', async function (assert) {
91-
await render(
92-
<template>
93-
<AuAccordion>
94-
Some content
95-
</AuAccordion>
96-
</template>,
97-
);
98-
99-
assert.dom(ACCORDION.ICON_OPEN).doesNotExist();
100-
assert.dom(ACCORDION.ICON_CLOSED).exists();
101-
102-
await toggleAccordion();
103-
assert.dom(ACCORDION.ICON_OPEN).exists();
104-
assert.dom(ACCORDION.ICON_CLOSED).doesNotExist();
105-
});
106-
107-
test('it supports choosing different icons', async function (assert) {
108-
const state = new TestState();
109-
await render(
110-
<template>
111-
<AuAccordion
112-
@iconOpen={{state.iconOpen}}
113-
@iconClosed={{state.iconClosed}}
114-
>
115-
Some content
116-
</AuAccordion>
117-
</template>,
118-
);
119-
120-
assert
121-
.dom(ACCORDION.ICON_CLOSED)
122-
.hasAttribute('data-test-accordion-icon-closed', 'nav-right');
123-
124-
state.iconClosed = 'other-closed-icon';
125-
await settled();
126-
127-
assert
128-
.dom(ACCORDION.ICON_CLOSED)
129-
.hasAttribute('data-test-accordion-icon-closed', 'other-closed-icon');
130-
131-
await toggleAccordion();
132-
assert
133-
.dom(ACCORDION.ICON_OPEN)
134-
.hasAttribute('data-test-accordion-icon-open', 'nav-down');
135-
136-
state.iconOpen = 'other-open-icon';
137-
await settled();
138-
139-
assert
140-
.dom(ACCORDION.ICON_OPEN)
141-
.hasAttribute('data-test-accordion-icon-open', 'other-open-icon');
142-
});
143-
14488
test('it can show a loading indicator instead of content', async function (assert) {
14589
const state = new TestState();
14690
state.isLoading = true;

0 commit comments

Comments
 (0)
Failed to load comments.