Skip to content

Commit d407de5

Browse files
test(select): add required prop tests
1 parent d1bc696 commit d407de5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

core/src/components/select/test/select.spec.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,35 @@ describe('select: slot interactivity', () => {
125125
expect(divSpy).toHaveBeenCalled();
126126
});
127127
});
128+
129+
describe('ion-select: required', () => {
130+
it('should have a aria-required attribute as true in inner button', async () => {
131+
const page = await newSpecPage({
132+
components: [Select],
133+
html: `
134+
<ion-select required="true"></ion-select>
135+
`,
136+
});
137+
138+
const select = page.body.querySelector('ion-select')!;
139+
140+
const nativeButton = select.shadowRoot!.querySelector('button')!;
141+
142+
expect(nativeButton.getAttribute('aria-required')).toBe('true');
143+
});
144+
145+
it('should not have a aria-required attribute as false in inner button', async () => {
146+
const page = await newSpecPage({
147+
components: [Select],
148+
html: `
149+
<ion-select required="false"></ion-select>
150+
`,
151+
});
152+
153+
const select = page.body.querySelector('ion-select')!;
154+
155+
const nativeButton = select.shadowRoot!.querySelector('button')!;
156+
157+
expect(nativeButton.getAttribute('aria-required')).toBe('false');
158+
});
159+
});

0 commit comments

Comments
 (0)