✅ test: Added iconOnly props test
This commit is contained in:
parent
e8921723ba
commit
3e80826802
|
@ -14,5 +14,25 @@ describe('VButton', () => {
|
||||||
expect(wrapper.props('label')).toBe('button label')
|
expect(wrapper.props('label')).toBe('button label')
|
||||||
// Checks that the rendering contains the expected value
|
// Checks that the rendering contains the expected value
|
||||||
expect(wrapper.text()).toContain('button label')
|
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')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user