From 3e80826802562ecf898c3c627b4c3f1146bc4def Mon Sep 17 00:00:00 2001 From: Paul Valerie GOMA Date: Sat, 19 Jul 2025 14:24:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20Added=20iconOnly=20props=20?= =?UTF-8?q?test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/VButton.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/VButton.spec.ts b/test/VButton.spec.ts index f4e1d31..c93369f 100644 --- a/test/VButton.spec.ts +++ b/test/VButton.spec.ts @@ -14,5 +14,25 @@ describe('VButton', () => { expect(wrapper.props('label')).toBe('button label') // Checks that the rendering contains the expected value expect(wrapper.text()).toContain('button label') + }); + + test('Displays only icon button when iconOnly props is set', () => { + const wrapper = mount(VButton, { + props: { + icon: 'ri-settings-4-line', + iconOnly: true, + label: 'label', + title: 'button' + } + }) + const button = wrapper.find('button') + // check the rendering doesn't contain any button label + expect(button.text()).toBe('') + // Check the icon is present + const icon = button.find('.p-button-icon') + expect(icon.exists()).toBe(true) + expect(icon.classes()).toContain('ri-settings-4-line') + // check that the aria-label attribute is correctly defined + expect(button.attributes('aria-label')).toBe('label') }) })