From 259d8b27d8648067658a93c695e3fbdf8f9b7408 Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Fri, 25 Oct 2024 13:29:34 +0200 Subject: [PATCH] Improve tests --- packages/react/src/Button/Button.test.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react/src/Button/Button.test.tsx b/packages/react/src/Button/Button.test.tsx index 50413e5e34..1476bb0799 100644 --- a/packages/react/src/Button/Button.test.tsx +++ b/packages/react/src/Button/Button.test.tsx @@ -122,9 +122,9 @@ describe('Button', () => { const button = screen.getByRole('button', { name: 'Sluiten', }) + const icon = button.querySelector('.ams-icon:last-child') expect(button).toBeInTheDocument() - const icon = button.querySelector('.ams-icon:last-child') expect(icon).toBeInTheDocument() }) @@ -138,9 +138,9 @@ describe('Button', () => { const button = screen.getByRole('button', { name: 'Sluiten', }) + const icon = button.querySelector('.ams-icon:first-child') expect(button).toBeInTheDocument() - const icon = button.querySelector('.ams-icon:first-child') expect(icon).toBeInTheDocument() }) @@ -154,9 +154,11 @@ describe('Button', () => { const button = screen.getByRole('button', { name: 'Sluiten', }) + const icon = button.querySelector('.ams-icon') + const label = button.querySelector('.ams-visually-hidden') expect(button).toBeInTheDocument() - const label = button.querySelector('.ams-visually-hidden') - expect(label).toHaveTextContent('Sluiten') + expect(icon).toBeInTheDocument() + expect(label).toBeInTheDocument() }) })