diff --git a/test/VButton.spec.ts b/test/VButton.spec.ts index 2f6208c..d0cc48f 100644 --- a/test/VButton.spec.ts +++ b/test/VButton.spec.ts @@ -133,4 +133,80 @@ describe('VButton', () => { expect(button.classes()).not.toContain('p-button-sm') expect(button.classes().some(c => c.includes('text-body-MD'))).toBe(true) }) + + test('primary button', () => { + const wrapper = mount(VButton, { + props: { + title: 'button', + label: 'label', + } + }) + const button = wrapper.find('button') + expect(button.classes()).not.toContain('p-button-secondary') + expect(button.classes()).not.toContain('p-button-outlined') + expect(button.classes()).not.toContain('p-button-text') + expect(button.classes()).not.toContain('p-button-danger') + }) + + test('secondary button', () => { + const wrapper = mount(VButton, { + props: { + title: 'button', + label: 'label', + secondary: true, + } + }) + const button = wrapper.find('button') + expect(button.classes()).toContain('p-button-secondary') + expect(button.classes()).toContain('p-button-outlined') + expect(button.classes()).not.toContain('p-button-text') + expect(button.classes()).not.toContain('p-button-danger') + expect(button.attributes('data-p-severity')).toBe('secondary') + }) + + test('tertiary button', () => { + const wrapper = mount(VButton, { + props: { + title: 'button', + label: 'label', + tertiary: true + } + }) + const button = wrapper.find('button') + expect(button.classes()).not.toContain('p-button-secondary') + expect(button.classes()).toContain('p-button-outlined') + expect(button.classes()).not.toContain('p-button-text') + expect(button.classes()).not.toContain('p-button-danger') + }) + + test('no outlined button', () => { + const wrapper = mount(VButton, { + props: { + title: 'button', + label: 'label', + noOutline: true, + } + }) + const button = wrapper.find('button') + expect(button.classes()).not.toContain('p-button-secondary') + expect(button.classes()).not.toContain('p-button-outlined') + expect(button.classes()).toContain('p-button-text') + expect(button.classes()).not.toContain('p-button-danger') + }) + + test('danger variant button', () => { + const wrapper = mount(VButton, { + props: { + title: 'button', + label: 'label', + danger: true, + } + }) + const button = wrapper.find('button') + expect(button.classes()).not.toContain('p-button-secondary') + expect(button.classes()).not.toContain('p-button-outlined') + expect(button.classes()).not.toContain('p-button-text') + expect(button.classes()).toContain('p-button-danger') + expect(button.attributes('data-p-severity')).toBe('danger') + }) })