Skip to content

Commit

Permalink
Unit test ButtonMultiAction.vue
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
  • Loading branch information
rak-phillip committed Sep 26, 2024
1 parent 997da50 commit 2307ce3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions shell/components/__tests__/ButtonMultiAction.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { shallowMount } from '@vue/test-utils';
import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';

describe('buttonMultiAction.vue', () => {
it('renders correct classes when props are provided', () => {
const wrapper = shallowMount(ButtonMultiAction, {
props: {
borderless: true,
invisible: true,
},
});

expect(wrapper.find('button').classes()).toContain('borderless');
expect(wrapper.find('button').classes()).toContain('invisible');
});

it('renders correct classes when props are absent', () => {
const wrapper = shallowMount(ButtonMultiAction);

expect(wrapper.find('button').classes()).not.toContain('borderless');
expect(wrapper.find('button').classes()).not.toContain('invisible');
});

it('emits click event when button is clicked', () => {
const wrapper = shallowMount(ButtonMultiAction);

wrapper.find('button').trigger('click');

expect(wrapper.emitted('click')).toBeTruthy();
});
});

0 comments on commit 2307ce3

Please sign in to comment.