From d407de5d6c6141cc197f23e3d7c5a33d6abefa8e Mon Sep 17 00:00:00 2001 From: giuliana Date: Fri, 24 Jan 2025 12:19:00 +0000 Subject: [PATCH] test(select): add required prop tests --- .../components/select/test/select.spec.tsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/core/src/components/select/test/select.spec.tsx b/core/src/components/select/test/select.spec.tsx index ef1b23306a..f00c4c6688 100644 --- a/core/src/components/select/test/select.spec.tsx +++ b/core/src/components/select/test/select.spec.tsx @@ -125,3 +125,35 @@ describe('select: slot interactivity', () => { expect(divSpy).toHaveBeenCalled(); }); }); + +describe('ion-select: required', () => { + it('should have a aria-required attribute as true in inner button', async () => { + const page = await newSpecPage({ + components: [Select], + html: ` + + `, + }); + + const select = page.body.querySelector('ion-select')!; + + const nativeButton = select.shadowRoot!.querySelector('button')!; + + expect(nativeButton.getAttribute('aria-required')).toBe('true'); + }); + + it('should not have a aria-required attribute as false in inner button', async () => { + const page = await newSpecPage({ + components: [Select], + html: ` + + `, + }); + + const select = page.body.querySelector('ion-select')!; + + const nativeButton = select.shadowRoot!.querySelector('button')!; + + expect(nativeButton.getAttribute('aria-required')).toBe('false'); + }); +});