diff --git a/src/App.vue b/src/App.vue
index 6dbd0cb..ac826ea 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,8 +1,10 @@
-
+
+
diff --git a/src/components/button/VButtonGroup.vue b/src/components/button/VButtonGroup.vue
new file mode 100644
index 0000000..cd542be
--- /dev/null
+++ b/src/components/button/VButtonGroup.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
diff --git a/test/VButton.spec.ts b/test/VButton.spec.ts
index d0cc48f..c0c1974 100644
--- a/test/VButton.spec.ts
+++ b/test/VButton.spec.ts
@@ -93,6 +93,21 @@ describe('VButton', () => {
expect(onClick).not.toHaveBeenCalled()
})
+ test('Clicked button', async () => {
+ const onClick = vi.fn()
+ const wrapper = mount(VButton, {
+ props: {
+ title: 'button',
+ label: 'label',
+ onClick,
+ }
+ })
+ const button = wrapper.find('button')
+ await button.trigger('click')
+ // check that the onClck function has been called
+ expect(onClick).toHaveBeenCalled()
+ })
+
test('small button', () => {
const wrapper = mount(VButton, {
props: {
diff --git a/test/VButtonGroup.spec.ts b/test/VButtonGroup.spec.ts
new file mode 100644
index 0000000..68918b4
--- /dev/null
+++ b/test/VButtonGroup.spec.ts
@@ -0,0 +1,46 @@
+import { mount } from "@vue/test-utils";
+import VButtonGroup from '../src/components/button/VButtonGroup.vue';
+import {test, expect, describe, vi} from 'vitest';
+
+const buttons = [
+ {title: 'button 1', label: 'label 1', onClick: vi.fn()},
+ {title: 'button 2', label: 'label 2', onClick: vi.fn()}
+]
+
+describe('VButtonGroup', () => {
+ test('Displays all buttons passed as props', () => {
+ const wrapper = mount(VButtonGroup, {
+ props: {
+ buttons,
+ title: 'button group',
+ }
+ })
+ const buttonElements = wrapper.findAll('button')
+ expect(buttonElements).toHaveLength(2)
+ expect(buttonElements[0].text()).toContain('label 1')
+ expect(buttonElements[1].text()).toContain('label 2')
+ })
+
+ test('applies the inline class when inlineLayoutWhen is “always”', () => {
+ const wrapper = mount(VButtonGroup, {
+ props: {
+ buttons,
+ title: 'button group',
+ inlineLayoutWhen: 'always',
+ }
+ })
+ expect(wrapper.classes()).toContain('btns-group--inline')
+ })
+
+ test('clicked button', async () => {
+ const onClick = vi.fn()
+ const wrapper = mount(VButtonGroup, {
+ props: {
+ buttons: [{title: 'button 1', label: 'label 1', onClick}],
+ title: 'button group',
+ }
+ })
+ await wrapper.find('button').trigger('click')
+ expect(onClick).toHaveBeenCalled()
+ })
+})