@nexxtmove/ui 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +113 -17
- package/dist/index.js +146 -111
- package/dist/nuxt.js +26 -25
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.vue +49 -0
- package/src/components/Calendar/_CalendarDayView.vue +1 -1
- package/src/components/Chip/Chip.vue +9 -4
- package/src/components/Table/Table.vue +2 -2
- package/src/components.json +1 -0
- package/src/index.ts +1 -0
- package/src/components/AnimatedNumber/AnimatedNumber.stories.ts +0 -15
- package/src/components/AnimatedNumber/AnimatedNumber.test.ts +0 -56
- package/src/components/Button/Button.stories.ts +0 -212
- package/src/components/Button/Button.test.ts +0 -318
- package/src/components/Calendar/Calendar.stories.ts +0 -91
- package/src/components/Calendar/Calendar.test.ts +0 -279
- package/src/components/Calendar/_CalendarDayView.test.ts +0 -104
- package/src/components/Calendar/_CalendarHeader.test.ts +0 -86
- package/src/components/Calendar/_CalendarMonthView.test.ts +0 -52
- package/src/components/Calendar/_CalendarYearView.test.ts +0 -56
- package/src/components/Checkbox/Checkbox.stories.ts +0 -35
- package/src/components/Checkbox/Checkbox.test.ts +0 -55
- package/src/components/Chip/Chip.stories.ts +0 -42
- package/src/components/Chip/Chip.test.ts +0 -51
- package/src/components/CustomerJourneyTile/CustomerJourneyTile.stories.ts +0 -86
- package/src/components/CustomerJourneyTile/CustomerJourneyTile.test.ts +0 -178
- package/src/components/DatePicker/DatePicker.stories.ts +0 -149
- package/src/components/DatePicker/DatePicker.test.ts +0 -191
- package/src/components/DropdownButton/DropdownButton.stories.ts +0 -68
- package/src/components/DropdownButton/DropdownButton.test.ts +0 -124
- package/src/components/Header/Header.stories.ts +0 -54
- package/src/components/Header/Header.test.ts +0 -183
- package/src/components/Icon/Icon.stories.ts +0 -50
- package/src/components/Icon/Icon.test.ts +0 -73
- package/src/components/InfoBlock/InfoBlock.stories.ts +0 -90
- package/src/components/InfoBlock/InfoBlock.test.ts +0 -101
- package/src/components/ProgressBar/ProgressBar.stories.ts +0 -30
- package/src/components/ProgressBar/ProgressBar.test.ts +0 -314
- package/src/components/SocialIcons/SocialIcons.stories.ts +0 -34
- package/src/components/SocialIcons/SocialIcons.test.ts +0 -58
- package/src/components/SocialMediaCustomTemplate/SocialMediaCustomTemplate.stories.ts +0 -11
- package/src/components/SocialMediaCustomTemplate/SocialMediaCustomTemplate.test.ts +0 -131
- package/src/components/SocialMediaTemplate/SocialMediaTemplate.stories.ts +0 -71
- package/src/components/SocialMediaTemplate/SocialMediaTemplate.test.ts +0 -466
- package/src/components/SocialMediaType/SocialMediaType.stories.ts +0 -43
- package/src/components/SocialMediaType/SocialMediaType.test.ts +0 -126
- package/src/components/StepperHeader/StepperHeader.stories.ts +0 -47
- package/src/components/StepperHeader/StepperHeader.test.ts +0 -244
- package/src/components/Table/Table.stories.ts +0 -283
- package/src/components/Table/Table.test.ts +0 -220
- package/src/components/TimelineEvent/TimelineEvent.stories.ts +0 -291
- package/src/components/TimelineEvent/TimelineEvent.test.ts +0 -166
- package/src/components/TimelinePhaseblock/TimelinePhaseblock.stories.ts +0 -198
- package/src/components/TimelinePhaseblock/TimelinePhaseblock.test.ts +0 -283
- package/src/components/Tooltip/Tooltip.stories.ts +0 -146
- package/src/components/Tooltip/Tooltip.test.ts +0 -122
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import CalendarDayView from './_CalendarDayView.vue'
|
|
4
|
-
import { nl } from 'date-fns/locale'
|
|
5
|
-
import { startOfMonth, endOfMonth, startOfWeek, endOfWeek, eachDayOfInterval } from 'date-fns'
|
|
6
|
-
|
|
7
|
-
const VIEW_DATE = new Date(2026, 2, 20) // March 20, 2026
|
|
8
|
-
const start = startOfWeek(startOfMonth(VIEW_DATE), { weekStartsOn: 1 })
|
|
9
|
-
const end = endOfWeek(endOfMonth(VIEW_DATE), { weekStartsOn: 1 })
|
|
10
|
-
const DAYS = eachDayOfInterval({ start, end })
|
|
11
|
-
|
|
12
|
-
const defaults = {
|
|
13
|
-
viewDate: VIEW_DATE,
|
|
14
|
-
calendarDays: DAYS,
|
|
15
|
-
modelValue: null,
|
|
16
|
-
markedDates: [],
|
|
17
|
-
locale: nl,
|
|
18
|
-
isDisabled: () => false,
|
|
19
|
-
timezone: 'UTC',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const mountDayView = (props: Record<string, unknown> = {}) =>
|
|
23
|
-
mount(CalendarDayView, {
|
|
24
|
-
props: { ...defaults, ...props },
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
describe('CalendarDayView', () => {
|
|
28
|
-
it('renders the correct number of days', () => {
|
|
29
|
-
const wrapper = mountDayView()
|
|
30
|
-
const dayButtons = wrapper.findAll('button')
|
|
31
|
-
expect(dayButtons.length).toBe(DAYS.length)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('highlights the selected day', () => {
|
|
35
|
-
const selectedDate = new Date(2026, 2, 15)
|
|
36
|
-
const wrapper = mountDayView({
|
|
37
|
-
modelValue: selectedDate,
|
|
38
|
-
})
|
|
39
|
-
const selectedCell = wrapper.find('[role="gridcell"][aria-selected="true"]')
|
|
40
|
-
expect(selectedCell.exists()).toBe(true)
|
|
41
|
-
expect(selectedCell.text()).toBe('15')
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('marks dates correctly', () => {
|
|
45
|
-
const markedDates = [new Date(2026, 2, 10)]
|
|
46
|
-
const wrapper = mountDayView({
|
|
47
|
-
markedDates,
|
|
48
|
-
})
|
|
49
|
-
// In our component, isMarked(day) is used to show a small dot.
|
|
50
|
-
// The dot is a span with bg-cornflower-blue-500 class.
|
|
51
|
-
expect(wrapper.find('.bg-cornflower-blue-500').exists()).toBe(true)
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('disables dates based on isDisabled prop', () => {
|
|
55
|
-
const wrapper = mountDayView({
|
|
56
|
-
isDisabled: (day: Date) => day.getDate() === 15,
|
|
57
|
-
})
|
|
58
|
-
const disabledButton = wrapper.find('button[disabled]')
|
|
59
|
-
expect(disabledButton.exists()).toBe(true)
|
|
60
|
-
expect(disabledButton.text()).toBe('15')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('emits select event when a day is clicked', async () => {
|
|
64
|
-
const wrapper = mountDayView()
|
|
65
|
-
const button = wrapper.findAll('button')[10]
|
|
66
|
-
if (button) {
|
|
67
|
-
await button.trigger('click')
|
|
68
|
-
expect(wrapper.emitted('select')).toBeTruthy()
|
|
69
|
-
expect(wrapper.emitted('select')?.[0]?.[0]).toBeInstanceOf(Date)
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('handles keyboard navigation (ArrowRight)', async () => {
|
|
74
|
-
const wrapper = mountDayView({
|
|
75
|
-
attachTo: document.body,
|
|
76
|
-
})
|
|
77
|
-
const button = wrapper.findAll('button')[0]
|
|
78
|
-
if (button) {
|
|
79
|
-
await button.trigger('keydown', { key: 'ArrowRight' })
|
|
80
|
-
}
|
|
81
|
-
// In vitest/jsdom, focus might not move as easily, so we check if the method logic runs
|
|
82
|
-
// For unit tests, we can also check if emit('select') is called on Enter/Space
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('emits select when Enter or Space is pressed', async () => {
|
|
86
|
-
const wrapper = mountDayView()
|
|
87
|
-
const button = wrapper.findAll('button')[0]
|
|
88
|
-
if (button) {
|
|
89
|
-
await button.trigger('keydown', { key: 'Enter' })
|
|
90
|
-
expect(wrapper.emitted('select')).toBeTruthy()
|
|
91
|
-
await button.trigger('keydown', { key: ' ' })
|
|
92
|
-
expect(wrapper.emitted('select')?.[1]).toBeTruthy()
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it('does not emit select for other keys', async () => {
|
|
97
|
-
const wrapper = mountDayView()
|
|
98
|
-
const button = wrapper.findAll('button')[0]
|
|
99
|
-
if (button) {
|
|
100
|
-
await button.trigger('keydown', { key: 'Tab' })
|
|
101
|
-
expect(wrapper.emitted('select')).toBeFalsy()
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
})
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import CalendarHeader from './_CalendarHeader.vue'
|
|
4
|
-
import { nl } from 'date-fns/locale'
|
|
5
|
-
|
|
6
|
-
const VIEW_DATE = new Date(2026, 2, 20) // March 20, 2026
|
|
7
|
-
|
|
8
|
-
describe('CalendarHeader', () => {
|
|
9
|
-
it('renders the correct month and year label', () => {
|
|
10
|
-
const wrapper = mount(CalendarHeader, {
|
|
11
|
-
props: {
|
|
12
|
-
viewDate: VIEW_DATE,
|
|
13
|
-
pickerView: 'days',
|
|
14
|
-
monthYearPicker: false,
|
|
15
|
-
locale: nl,
|
|
16
|
-
canGoPrev: true,
|
|
17
|
-
canGoNext: true,
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
expect(wrapper.text()).toContain('Mrt.')
|
|
21
|
-
expect(wrapper.text()).toContain('2026')
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('renders month and year as buttons if monthYearPicker is true', () => {
|
|
25
|
-
const wrapper = mount(CalendarHeader, {
|
|
26
|
-
props: {
|
|
27
|
-
viewDate: VIEW_DATE,
|
|
28
|
-
pickerView: 'days',
|
|
29
|
-
monthYearPicker: true,
|
|
30
|
-
locale: nl,
|
|
31
|
-
canGoPrev: true,
|
|
32
|
-
canGoNext: true,
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
const buttons = wrapper.findAll('.flex.items-center.gap-1 button')
|
|
36
|
-
expect(buttons.length).toBe(2)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('emits openMonthPicker when month label button is clicked', async () => {
|
|
40
|
-
const wrapper = mount(CalendarHeader, {
|
|
41
|
-
props: {
|
|
42
|
-
viewDate: VIEW_DATE,
|
|
43
|
-
pickerView: 'days',
|
|
44
|
-
monthYearPicker: true,
|
|
45
|
-
locale: nl,
|
|
46
|
-
canGoPrev: true,
|
|
47
|
-
canGoNext: true,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
await wrapper.findAll('.flex.items-center.gap-1 button')[0].trigger('click')
|
|
51
|
-
expect(wrapper.emitted('openMonthPicker')).toBeTruthy()
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('emits prev and next events', async () => {
|
|
55
|
-
const wrapper = mount(CalendarHeader, {
|
|
56
|
-
props: {
|
|
57
|
-
viewDate: VIEW_DATE,
|
|
58
|
-
pickerView: 'days',
|
|
59
|
-
monthYearPicker: false,
|
|
60
|
-
locale: nl,
|
|
61
|
-
canGoPrev: true,
|
|
62
|
-
canGoNext: true,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
const navButtons = wrapper.findAll('button[aria-label]')
|
|
66
|
-
await navButtons[0].trigger('click')
|
|
67
|
-
expect(wrapper.emitted('prev')).toBeTruthy()
|
|
68
|
-
await navButtons[1].trigger('click')
|
|
69
|
-
expect(wrapper.emitted('next')).toBeTruthy()
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('shows back arrow instead of chevron when in years view', () => {
|
|
73
|
-
const wrapper = mount(CalendarHeader, {
|
|
74
|
-
props: {
|
|
75
|
-
viewDate: VIEW_DATE,
|
|
76
|
-
pickerView: 'years',
|
|
77
|
-
monthYearPicker: true,
|
|
78
|
-
locale: nl,
|
|
79
|
-
canGoPrev: false,
|
|
80
|
-
canGoNext: false,
|
|
81
|
-
},
|
|
82
|
-
})
|
|
83
|
-
const backButton = wrapper.find('button[aria-label="Terug naar maanden"]')
|
|
84
|
-
expect(backButton.exists()).toBe(true)
|
|
85
|
-
})
|
|
86
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import CalendarMonthView from './_CalendarMonthView.vue'
|
|
4
|
-
import { nl } from 'date-fns/locale'
|
|
5
|
-
|
|
6
|
-
const VIEW_YEAR = 2026
|
|
7
|
-
const CURRENT_MONTH = 2 // March
|
|
8
|
-
|
|
9
|
-
const mountMonthView = (props: Record<string, unknown>) =>
|
|
10
|
-
mount(CalendarMonthView, {
|
|
11
|
-
props: {
|
|
12
|
-
viewYear: VIEW_YEAR,
|
|
13
|
-
modelValue: null,
|
|
14
|
-
currentMonth: CURRENT_MONTH,
|
|
15
|
-
locale: nl,
|
|
16
|
-
timezone: 'UTC',
|
|
17
|
-
...(props as Record<string, unknown>),
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
describe('CalendarMonthView', () => {
|
|
22
|
-
it('renders all 12 months', () => {
|
|
23
|
-
const wrapper = mountMonthView({})
|
|
24
|
-
const buttons = wrapper.findAll('button')
|
|
25
|
-
expect(buttons.length).toBe(12)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('highlights the selected month', () => {
|
|
29
|
-
const selectedDate = new Date(Date.UTC(VIEW_YEAR, 5, 15)) // June
|
|
30
|
-
const wrapper = mountMonthView({ modelValue: selectedDate })
|
|
31
|
-
const selectedButton = wrapper.find('button[aria-selected="true"]')
|
|
32
|
-
expect(selectedButton.text()).toBe('Jun')
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('disables months based on minDate and maxDate', () => {
|
|
36
|
-
const minDate = new Date(Date.UTC(VIEW_YEAR, 2, 1)) // March 1st
|
|
37
|
-
const wrapper = mountMonthView({ minDate })
|
|
38
|
-
// January (0) and February (1) should be disabled
|
|
39
|
-
const disabledButtons = wrapper.findAll('button[disabled]')
|
|
40
|
-
expect(disabledButtons.length).toBe(2)
|
|
41
|
-
expect(disabledButtons[0]?.text()).toBe('Jan')
|
|
42
|
-
expect(disabledButtons[1]?.text()).toBe('Feb')
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('emits select event when a month is clicked', async () => {
|
|
46
|
-
const wrapper = mountMonthView({})
|
|
47
|
-
await wrapper.findAll('button')[5]?.trigger('click')
|
|
48
|
-
const emitted = wrapper.emitted('select')
|
|
49
|
-
expect(emitted).toBeTruthy()
|
|
50
|
-
expect(emitted?.[0]?.[0]).toBe(5)
|
|
51
|
-
})
|
|
52
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import CalendarYearView from './_CalendarYearView.vue'
|
|
4
|
-
|
|
5
|
-
describe('CalendarYearView', () => {
|
|
6
|
-
it('renders a range of years', () => {
|
|
7
|
-
const wrapper = mount(CalendarYearView, {
|
|
8
|
-
props: {
|
|
9
|
-
viewYear: 2024,
|
|
10
|
-
timezone: 'UTC',
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
const items = wrapper.findAll('button')
|
|
14
|
-
expect(items.length).toBeGreaterThan(100) // Default range is viewYear - 100 to + 20
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('respects minDate and maxDate', () => {
|
|
18
|
-
const wrapper = mount(CalendarYearView, {
|
|
19
|
-
props: {
|
|
20
|
-
viewYear: 2024,
|
|
21
|
-
minDate: new Date(Date.UTC(2020, 0, 1)),
|
|
22
|
-
maxDate: new Date(Date.UTC(2025, 0, 1)),
|
|
23
|
-
timezone: 'UTC',
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
const items = wrapper.findAll('button')
|
|
27
|
-
// 2020 to 2025 inclusive is 6 years
|
|
28
|
-
expect(items.length).toBe(6)
|
|
29
|
-
expect(items[0]?.text()).toBe('2020')
|
|
30
|
-
expect(items[5]?.text()).toBe('2025')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('emits select when a year is clicked', async () => {
|
|
34
|
-
const wrapper = mount(CalendarYearView, {
|
|
35
|
-
props: {
|
|
36
|
-
viewYear: 2024,
|
|
37
|
-
timezone: 'UTC',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
const year2024 = wrapper.findAll('button').find((i) => i.text() === '2024')
|
|
41
|
-
await year2024?.trigger('click')
|
|
42
|
-
expect(wrapper.emitted('select')).toBeTruthy()
|
|
43
|
-
expect(wrapper.emitted('select')?.[0]?.[0]).toBe(2024)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('highlights the current year', async () => {
|
|
47
|
-
const wrapper = mount(CalendarYearView, {
|
|
48
|
-
props: {
|
|
49
|
-
viewYear: 2024,
|
|
50
|
-
timezone: 'UTC',
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
const activeYear = wrapper.find('button.text-cornflower-blue-500')
|
|
54
|
-
expect(activeYear.text()).toBe('2024')
|
|
55
|
-
})
|
|
56
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import Checkbox from './Checkbox.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Checkbox',
|
|
6
|
-
component: Checkbox,
|
|
7
|
-
} satisfies Meta<typeof Checkbox>
|
|
8
|
-
|
|
9
|
-
type Story = StoryObj<typeof Checkbox>
|
|
10
|
-
|
|
11
|
-
export const Default: Story = {
|
|
12
|
-
args: {
|
|
13
|
-
modelValue: false,
|
|
14
|
-
},
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const Checked: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
modelValue: true,
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Disabled: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
modelValue: false,
|
|
26
|
-
disabled: true,
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const DisabledChecked: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
modelValue: true,
|
|
33
|
-
disabled: true,
|
|
34
|
-
},
|
|
35
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import Checkbox from './Checkbox.vue'
|
|
4
|
-
|
|
5
|
-
describe('Checkbox', () => {
|
|
6
|
-
it('renders a checkbox input', () => {
|
|
7
|
-
const wrapper = mount(Checkbox)
|
|
8
|
-
|
|
9
|
-
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('is unchecked by default', () => {
|
|
13
|
-
const wrapper = mount(Checkbox)
|
|
14
|
-
|
|
15
|
-
expect((wrapper.find('input').element as HTMLInputElement).checked).toBe(false)
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('is checked when modelValue is true', () => {
|
|
19
|
-
const wrapper = mount(Checkbox, { props: { modelValue: true } })
|
|
20
|
-
|
|
21
|
-
expect((wrapper.find('input').element as HTMLInputElement).checked).toBe(true)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('emits update:modelValue when toggled', async () => {
|
|
25
|
-
const wrapper = mount(Checkbox, { props: { modelValue: false } })
|
|
26
|
-
|
|
27
|
-
await wrapper.find('input').setValue(true)
|
|
28
|
-
|
|
29
|
-
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('disables the input when disabled prop is true', () => {
|
|
33
|
-
const wrapper = mount(Checkbox, { props: { disabled: true } })
|
|
34
|
-
|
|
35
|
-
expect((wrapper.find('input').element as HTMLInputElement).disabled).toBe(true)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('applies opacity class when disabled', () => {
|
|
39
|
-
const wrapper = mount(Checkbox, { props: { disabled: true } })
|
|
40
|
-
|
|
41
|
-
expect(wrapper.find('label').classes()).toContain('opacity-50')
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('forwards attributes to the input', () => {
|
|
45
|
-
const wrapper = mount(Checkbox, { attrs: { 'aria-label': 'Accept terms' } })
|
|
46
|
-
|
|
47
|
-
expect(wrapper.find('input').attributes('aria-label')).toBe('Accept terms')
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('renders the check icon', () => {
|
|
51
|
-
const wrapper = mount(Checkbox)
|
|
52
|
-
|
|
53
|
-
expect(wrapper.find('i.fa-check').exists()).toBe(true)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import Chip from './Chip.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Chip',
|
|
6
|
-
component: Chip,
|
|
7
|
-
parameters: {
|
|
8
|
-
design: {
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System?node-id=526-66&t=CbHvOQfEMIr7M5mO-4',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof Chip>
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof Chip>
|
|
16
|
-
|
|
17
|
-
export const Default: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
default: 'Default',
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Warning: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
variant: 'warning',
|
|
26
|
-
default: 'Warning',
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const Success: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
variant: 'success',
|
|
33
|
-
default: 'Succes',
|
|
34
|
-
},
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const Danger: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
variant: 'danger',
|
|
40
|
-
default: 'Danger',
|
|
41
|
-
},
|
|
42
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import Chip from './Chip.vue'
|
|
4
|
-
|
|
5
|
-
describe('Chip', () => {
|
|
6
|
-
it('renders correctly with default slot content', () => {
|
|
7
|
-
const wrapper = mount(Chip, {
|
|
8
|
-
slots: {
|
|
9
|
-
default: 'Test Chip',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
expect(wrapper.text()).toBe('Test Chip')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('renders default text when no slot is provided', () => {
|
|
16
|
-
const wrapper = mount(Chip)
|
|
17
|
-
expect(wrapper.text()).toBe('Chip')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('applies the correct background color for default variant', () => {
|
|
21
|
-
const wrapper = mount(Chip)
|
|
22
|
-
expect(wrapper.classes()).toContain('bg-cornflower-blue-600')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('applies the correct background color for warning variant', () => {
|
|
26
|
-
const wrapper = mount(Chip, {
|
|
27
|
-
props: {
|
|
28
|
-
variant: 'warning',
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
expect(wrapper.classes()).toContain('bg-orange-500')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('applies the correct background color for success variant', () => {
|
|
35
|
-
const wrapper = mount(Chip, {
|
|
36
|
-
props: {
|
|
37
|
-
variant: 'success',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
expect(wrapper.classes()).toContain('bg-green-500')
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('applies the correct background color for danger variant', () => {
|
|
44
|
-
const wrapper = mount(Chip, {
|
|
45
|
-
props: {
|
|
46
|
-
variant: 'danger',
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
expect(wrapper.classes()).toContain('bg-brick-500')
|
|
50
|
-
})
|
|
51
|
-
})
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import CustomerJourneyTile from './CustomerJourneyTile.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Customer Journey Tile',
|
|
6
|
-
component: CustomerJourneyTile,
|
|
7
|
-
} satisfies Meta<typeof CustomerJourneyTile>
|
|
8
|
-
|
|
9
|
-
type Story = StoryObj<typeof CustomerJourneyTile>
|
|
10
|
-
|
|
11
|
-
export const Default: Story = {
|
|
12
|
-
args: {
|
|
13
|
-
title: 'Latent',
|
|
14
|
-
amount: 270,
|
|
15
|
-
percentage: 14,
|
|
16
|
-
percentageExplanaition: 'vorige maand',
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const CustomTitle: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
title: 'Custom Title',
|
|
23
|
-
amount: 270,
|
|
24
|
-
percentage: -8,
|
|
25
|
-
percentageExplanaition: 'vorige maand',
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const NegativePercentage: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
title: 'Latent',
|
|
32
|
-
amount: 270,
|
|
33
|
-
percentage: -8,
|
|
34
|
-
percentageExplanaition: 'vorige maand',
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const WithoutPercentage: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
title: 'Wonen',
|
|
41
|
-
amount: 54,
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const WithoutAmount: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
title: 'Actief zoeken',
|
|
48
|
-
percentage: 5,
|
|
49
|
-
percentageExplanaition: 'vorige maand',
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const Orientatie: Story = {
|
|
54
|
-
args: {
|
|
55
|
-
title: 'Oriëntatie',
|
|
56
|
-
amount: 142,
|
|
57
|
-
percentage: 3,
|
|
58
|
-
percentageExplanaition: 'vorige maand',
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const Selectie: Story = {
|
|
63
|
-
args: {
|
|
64
|
-
title: 'Selectie',
|
|
65
|
-
amount: 89,
|
|
66
|
-
percentage: -2,
|
|
67
|
-
percentageExplanaition: 'vorige maand',
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const Transactie: Story = {
|
|
72
|
-
args: {
|
|
73
|
-
title: 'Transactie',
|
|
74
|
-
amount: 31,
|
|
75
|
-
percentage: 21,
|
|
76
|
-
percentageExplanaition: 'vorige maand',
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const WithoutPhase: Story = {
|
|
81
|
-
args: {
|
|
82
|
-
amount: 270,
|
|
83
|
-
percentage: 14,
|
|
84
|
-
percentageExplanaition: 'vorige maand',
|
|
85
|
-
},
|
|
86
|
-
}
|