@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,124 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import type { IconName } from '@awesome.me/kit-37b149f3ef/icons'
|
|
4
|
-
import DropdownButton, { type NexxtDropdownButtonProps } from './DropdownButton.vue'
|
|
5
|
-
|
|
6
|
-
const stubs = { NexxtIcon: { template: '<span :data-name="name" />', props: ['name'] } }
|
|
7
|
-
|
|
8
|
-
const defaultProps: NexxtDropdownButtonProps = {
|
|
9
|
-
label: 'Actions',
|
|
10
|
-
action: '/main-action',
|
|
11
|
-
options: [
|
|
12
|
-
{ label: 'Edit', action: '/edit', icon: 'pencil' as IconName },
|
|
13
|
-
{ label: 'Delete', action: '/delete', icon: 'trash-can' as IconName },
|
|
14
|
-
],
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const mountDropdown = (props = {}) =>
|
|
18
|
-
mount(DropdownButton, {
|
|
19
|
-
props: { ...defaultProps, ...props } as NexxtDropdownButtonProps,
|
|
20
|
-
global: { stubs },
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('DropdownButton', () => {
|
|
24
|
-
describe('rendering', () => {
|
|
25
|
-
it('renders the main label', () => {
|
|
26
|
-
const wrapper = mountDropdown()
|
|
27
|
-
expect(wrapper.text()).toContain('Actions')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('renders the main icon when provided', () => {
|
|
31
|
-
const wrapper = mountDropdown({ icon: 'download' })
|
|
32
|
-
expect(wrapper.find('[data-name="download"]').exists()).toBe(true)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('renders the primary variant by default', () => {
|
|
36
|
-
const wrapper = mountDropdown()
|
|
37
|
-
expect(wrapper.find('.bg-button-bg-primary-default').exists()).toBe(true)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('renders the secondary variant when specified', () => {
|
|
41
|
-
const wrapper = mountDropdown({ variant: 'secondary' })
|
|
42
|
-
expect(wrapper.find('.bg-button-bg-secondary-default').exists()).toBe(true)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('does not show the dropdown menu by default', () => {
|
|
46
|
-
const wrapper = mountDropdown()
|
|
47
|
-
expect(wrapper.find('[role="menu"]').exists()).toBe(false)
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
describe('interactions', () => {
|
|
52
|
-
it('emits navigate when main button is clicked with a string action', async () => {
|
|
53
|
-
const wrapper = mountDropdown()
|
|
54
|
-
const mainButton = wrapper.findAll('button')[0]
|
|
55
|
-
await mainButton.trigger('click')
|
|
56
|
-
|
|
57
|
-
expect(wrapper.emitted('navigate')).toBeTruthy()
|
|
58
|
-
expect(wrapper.emitted('navigate')?.[0]).toEqual(['/main-action'])
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('executes function when main button is clicked with function action', async () => {
|
|
62
|
-
const action = vi.fn()
|
|
63
|
-
const wrapper = mountDropdown({ action })
|
|
64
|
-
const mainButton = wrapper.findAll('button')[0]
|
|
65
|
-
await mainButton.trigger('click')
|
|
66
|
-
|
|
67
|
-
expect(action).toHaveBeenCalled()
|
|
68
|
-
expect(wrapper.emitted('navigate')).toBeFalsy()
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('toggles the dropdown menu when chevron is clicked', async () => {
|
|
72
|
-
const wrapper = mountDropdown()
|
|
73
|
-
const toggleButton = wrapper.findAll('button')[1]
|
|
74
|
-
|
|
75
|
-
await toggleButton.trigger('click')
|
|
76
|
-
expect(wrapper.find('[role="menu"]').exists()).toBe(true)
|
|
77
|
-
expect(toggleButton.attributes('aria-expanded')).toBe('true')
|
|
78
|
-
|
|
79
|
-
await toggleButton.trigger('click')
|
|
80
|
-
expect(wrapper.find('[role="menu"]').exists()).toBe(false)
|
|
81
|
-
expect(toggleButton.attributes('aria-expanded')).toBe('false')
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('closes the dropdown and emits navigate when an option is clicked', async () => {
|
|
85
|
-
const wrapper = mountDropdown()
|
|
86
|
-
await wrapper.findAll('button')[1].trigger('click')
|
|
87
|
-
|
|
88
|
-
const option = wrapper.find('[role="menuitem"]')
|
|
89
|
-
await option.trigger('click')
|
|
90
|
-
|
|
91
|
-
expect(wrapper.emitted('navigate')).toBeTruthy()
|
|
92
|
-
expect(wrapper.emitted('navigate')?.[0]).toEqual(['/edit'])
|
|
93
|
-
expect(wrapper.find('[role="menu"]').exists()).toBe(false)
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
describe('placement', () => {
|
|
98
|
-
it('aligns to right by default', () => {
|
|
99
|
-
const wrapper = mountDropdown()
|
|
100
|
-
expect(wrapper.find('.items-end').exists()).toBe(true)
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('aligns to left when placement is set to left', () => {
|
|
104
|
-
const wrapper = mountDropdown({ placement: 'left' })
|
|
105
|
-
expect(wrapper.find('.items-start').exists()).toBe(true)
|
|
106
|
-
})
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
describe('accessibility', () => {
|
|
110
|
-
it('has correct ARIA roles', async () => {
|
|
111
|
-
const wrapper = mountDropdown()
|
|
112
|
-
await wrapper.findAll('button')[1].trigger('click')
|
|
113
|
-
|
|
114
|
-
expect(wrapper.find('[role="menu"]').exists()).toBe(true)
|
|
115
|
-
expect(wrapper.find('[role="menuitem"]').exists()).toBe(true)
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
it('has aria-haspopup on the toggle button', () => {
|
|
119
|
-
const wrapper = mountDropdown()
|
|
120
|
-
const toggleButton = wrapper.findAll('button')[1]
|
|
121
|
-
expect(toggleButton.attributes('aria-haspopup')).toBe('menu')
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
})
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import Header from './Header.vue'
|
|
3
|
-
import Button from '../Button/Button.vue'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Components/Atoms/Header',
|
|
7
|
-
component: Header,
|
|
8
|
-
parameters: {
|
|
9
|
-
design: {
|
|
10
|
-
type: 'figma',
|
|
11
|
-
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System?node-id=441-280&t=CbHvOQfEMIr7M5mO-4',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
} satisfies Meta<typeof Header>
|
|
15
|
-
|
|
16
|
-
type Story = StoryObj<typeof Header>
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
args: {
|
|
20
|
-
title: 'Header Title',
|
|
21
|
-
backButtonText: 'Back',
|
|
22
|
-
backButtonAction: () => console.log('Back button clicked'),
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const WithoutBackButton: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
title: 'Header Title',
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const WithSlots: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
title: 'Header Title',
|
|
35
|
-
backButtonText: 'Go Back',
|
|
36
|
-
backButtonAction: () => console.log('Back clicked'),
|
|
37
|
-
},
|
|
38
|
-
render: (args) => ({
|
|
39
|
-
components: { Header, Button },
|
|
40
|
-
setup() {
|
|
41
|
-
return { args }
|
|
42
|
-
},
|
|
43
|
-
template: `
|
|
44
|
-
<Header v-bind="args">
|
|
45
|
-
<template #center>
|
|
46
|
-
<span class="font-bold">Centered Content</span>
|
|
47
|
-
</template>
|
|
48
|
-
<template #right>
|
|
49
|
-
<Button variant="primary" icon="arrow-right" :icon-right="true">Next</Button>
|
|
50
|
-
</template>
|
|
51
|
-
</Header>
|
|
52
|
-
`,
|
|
53
|
-
}),
|
|
54
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import Header from './Header.vue'
|
|
4
|
-
import Button from '../Button/Button.vue'
|
|
5
|
-
|
|
6
|
-
describe('Header', () => {
|
|
7
|
-
it('renders the title', () => {
|
|
8
|
-
const wrapper = mount(Header, {
|
|
9
|
-
props: {
|
|
10
|
-
title: 'My Page Title',
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
expect(wrapper.text()).toContain('My Page Title')
|
|
15
|
-
expect(wrapper.find('span.heading-4').text()).toBe('My Page Title')
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('renders the back button with explicit text', () => {
|
|
19
|
-
const wrapper = mount(Header, {
|
|
20
|
-
props: {
|
|
21
|
-
title: 'Test',
|
|
22
|
-
backButtonText: 'Back',
|
|
23
|
-
},
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const button = wrapper.findComponent(Button)
|
|
27
|
-
expect(button.exists()).toBe(true)
|
|
28
|
-
expect(button.text()).toBe('Back')
|
|
29
|
-
expect(button.props('variant')).toBe('secondary')
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('does not render the back button when backButtonText is not provided', () => {
|
|
33
|
-
const wrapper = mount(Header, {
|
|
34
|
-
props: {
|
|
35
|
-
title: 'Test',
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const button = wrapper.findComponent(Button)
|
|
40
|
-
expect(button.exists()).toBe(false)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('renders the back button with custom text', () => {
|
|
44
|
-
const wrapper = mount(Header, {
|
|
45
|
-
props: {
|
|
46
|
-
title: 'Test',
|
|
47
|
-
backButtonText: 'Go Back',
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const button = wrapper.findComponent(Button)
|
|
52
|
-
expect(button.text()).toBe('Go Back')
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('calls backButtonAction when back button is clicked', async () => {
|
|
56
|
-
const backButtonAction = vi.fn()
|
|
57
|
-
const wrapper = mount(Header, {
|
|
58
|
-
props: {
|
|
59
|
-
title: 'Test',
|
|
60
|
-
backButtonText: 'Back',
|
|
61
|
-
backButtonAction,
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const button = wrapper.findComponent(Button)
|
|
66
|
-
await button.trigger('click')
|
|
67
|
-
|
|
68
|
-
expect(backButtonAction).toHaveBeenCalledOnce()
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('calls window.history.back() by default when back button is clicked', async () => {
|
|
72
|
-
const historyBackSpy = vi.spyOn(window.history, 'back').mockImplementation(() => {})
|
|
73
|
-
|
|
74
|
-
const wrapper = mount(Header, {
|
|
75
|
-
props: {
|
|
76
|
-
title: 'Test',
|
|
77
|
-
backButtonText: 'Back',
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const button = wrapper.findComponent(Button)
|
|
82
|
-
await button.trigger('click')
|
|
83
|
-
|
|
84
|
-
expect(historyBackSpy).toHaveBeenCalledOnce()
|
|
85
|
-
|
|
86
|
-
historyBackSpy.mockRestore()
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('renders center slot content', () => {
|
|
90
|
-
const wrapper = mount(Header, {
|
|
91
|
-
props: {
|
|
92
|
-
title: 'Test',
|
|
93
|
-
},
|
|
94
|
-
slots: {
|
|
95
|
-
center: '<span class="logo">Logo</span>',
|
|
96
|
-
},
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
expect(wrapper.find('.logo').text()).toBe('Logo')
|
|
100
|
-
expect(wrapper.find('.col-start-2').exists()).toBe(true)
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('does not render center slot wrapper when slot is empty', () => {
|
|
104
|
-
const wrapper = mount(Header, {
|
|
105
|
-
props: {
|
|
106
|
-
title: 'Test',
|
|
107
|
-
},
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
expect(wrapper.find('.col-start-2').exists()).toBe(false)
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('renders right slot content', () => {
|
|
114
|
-
const wrapper = mount(Header, {
|
|
115
|
-
props: {
|
|
116
|
-
title: 'Test',
|
|
117
|
-
},
|
|
118
|
-
slots: {
|
|
119
|
-
right: '<button class="next">Next</button>',
|
|
120
|
-
},
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
expect(wrapper.find('.next').text()).toBe('Next')
|
|
124
|
-
expect(wrapper.find('.ml-auto').exists()).toBe(true)
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('does not render right slot wrapper when slot is empty', () => {
|
|
128
|
-
const wrapper = mount(Header, {
|
|
129
|
-
props: {
|
|
130
|
-
title: 'Test',
|
|
131
|
-
},
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
expect(wrapper.find('.col-start-3').exists()).toBe(false)
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
it('uses grid layout with 3 columns when center slot is provided', () => {
|
|
138
|
-
const wrapper = mount(Header, {
|
|
139
|
-
props: {
|
|
140
|
-
title: 'Test',
|
|
141
|
-
},
|
|
142
|
-
slots: {
|
|
143
|
-
center: '<span>Center</span>',
|
|
144
|
-
},
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
const header = wrapper.find('.header')
|
|
148
|
-
expect(header.classes()).toContain('grid')
|
|
149
|
-
expect(header.classes()).toContain('grid-cols-3')
|
|
150
|
-
expect(header.classes()).toContain('items-center')
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
it('uses flex layout when no center slot is provided', () => {
|
|
154
|
-
const wrapper = mount(Header, {
|
|
155
|
-
props: {
|
|
156
|
-
title: 'Test',
|
|
157
|
-
},
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
const header = wrapper.find('.header')
|
|
161
|
-
expect(header.classes()).toContain('flex')
|
|
162
|
-
expect(header.classes()).toContain('items-center')
|
|
163
|
-
expect(header.classes()).not.toContain('grid')
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
it('renders all slots correctly', () => {
|
|
167
|
-
const wrapper = mount(Header, {
|
|
168
|
-
props: {
|
|
169
|
-
title: 'Test Title',
|
|
170
|
-
backButtonText: 'Previous',
|
|
171
|
-
},
|
|
172
|
-
slots: {
|
|
173
|
-
center: '<div class="center-content">Center</div>',
|
|
174
|
-
right: '<div class="right-content">Right</div>',
|
|
175
|
-
},
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
expect(wrapper.text()).toContain('Previous')
|
|
179
|
-
expect(wrapper.text()).toContain('Test Title')
|
|
180
|
-
expect(wrapper.find('.center-content').text()).toBe('Center')
|
|
181
|
-
expect(wrapper.find('.right-content').text()).toBe('Right')
|
|
182
|
-
})
|
|
183
|
-
})
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import Icon from './Icon.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Icon',
|
|
6
|
-
component: Icon,
|
|
7
|
-
parameters: {
|
|
8
|
-
design: {
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System?node-id=162-97&t=CbHvOQfEMIr7M5mO-11',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof Icon>
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof Icon>
|
|
16
|
-
|
|
17
|
-
export const Regular: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
name: 'star',
|
|
20
|
-
type: 'regular',
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const Light: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
name: 'star',
|
|
27
|
-
type: 'light',
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const Solid: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
name: 'star',
|
|
34
|
-
type: 'solid',
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const Duotone: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
name: 'star',
|
|
41
|
-
type: 'duotone',
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const Brands: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
name: 'github',
|
|
48
|
-
type: 'brands',
|
|
49
|
-
},
|
|
50
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import Icon from './Icon.vue'
|
|
4
|
-
|
|
5
|
-
describe('Icon', () => {
|
|
6
|
-
it('renders as an <i> tag', () => {
|
|
7
|
-
const wrapper = mount(Icon, {
|
|
8
|
-
props: {
|
|
9
|
-
name: 'star',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
expect(wrapper.element.tagName).toBe('I')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('renders correctly with name', async () => {
|
|
17
|
-
const wrapper = mount(Icon, {
|
|
18
|
-
props: {
|
|
19
|
-
name: 'star',
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
expect(wrapper.classes()).toContain('fa-star')
|
|
24
|
-
|
|
25
|
-
await wrapper.setProps({ name: 'arrows-up-down' })
|
|
26
|
-
|
|
27
|
-
expect(wrapper.classes()).toContain('fa-arrows-up-down')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('applies default type "light"', () => {
|
|
31
|
-
const wrapper = mount(Icon, {
|
|
32
|
-
props: {
|
|
33
|
-
name: 'star',
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
expect(wrapper.classes()).toContain('fa-light')
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('applies specified type', async () => {
|
|
41
|
-
const wrapper = mount(Icon, {
|
|
42
|
-
props: {
|
|
43
|
-
name: 'star',
|
|
44
|
-
type: 'regular',
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
expect(wrapper.classes()).toContain('fa-regular')
|
|
49
|
-
|
|
50
|
-
await wrapper.setProps({ type: 'light' })
|
|
51
|
-
expect(wrapper.classes()).toContain('fa-light')
|
|
52
|
-
|
|
53
|
-
await wrapper.setProps({ type: 'solid' })
|
|
54
|
-
expect(wrapper.classes()).toContain('fa-solid')
|
|
55
|
-
|
|
56
|
-
await wrapper.setProps({ type: 'duotone' })
|
|
57
|
-
expect(wrapper.classes()).toContain('fa-duotone')
|
|
58
|
-
|
|
59
|
-
await wrapper.setProps({ type: 'brands' })
|
|
60
|
-
expect(wrapper.classes()).toContain('fa-brands')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('applies basic layout classes', () => {
|
|
64
|
-
const wrapper = mount(Icon, {
|
|
65
|
-
props: {
|
|
66
|
-
name: 'star',
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
expect(wrapper.classes()).toContain('items-center')
|
|
71
|
-
expect(wrapper.classes()).toContain('justify-center')
|
|
72
|
-
})
|
|
73
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import InfoBlock from './InfoBlock.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Info Block',
|
|
6
|
-
component: InfoBlock,
|
|
7
|
-
parameters: {
|
|
8
|
-
design: {
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System?node-id=513-514&t=CbHvOQfEMIr7M5mO-11',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof InfoBlock>
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof InfoBlock>
|
|
16
|
-
|
|
17
|
-
const TEMPLATE =
|
|
18
|
-
'<span class="heading-4 text-yale-blue-500 inline">Tip!</span> <span class="body-medium text-gray-700">Koopwoningen doen het goed als post of reel</span>'
|
|
19
|
-
|
|
20
|
-
export const Green: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
icon: 'bell',
|
|
23
|
-
color: 'green',
|
|
24
|
-
},
|
|
25
|
-
render: (args) => ({
|
|
26
|
-
components: { InfoBlock },
|
|
27
|
-
setup() {
|
|
28
|
-
return { args }
|
|
29
|
-
},
|
|
30
|
-
template: `
|
|
31
|
-
<InfoBlock v-bind="args">
|
|
32
|
-
${TEMPLATE}
|
|
33
|
-
</InfoBlock>
|
|
34
|
-
`,
|
|
35
|
-
}),
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const Purple: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
icon: 'circle-video',
|
|
41
|
-
color: 'purple',
|
|
42
|
-
},
|
|
43
|
-
render: (args) => ({
|
|
44
|
-
components: { InfoBlock },
|
|
45
|
-
setup() {
|
|
46
|
-
return { args }
|
|
47
|
-
},
|
|
48
|
-
template: `
|
|
49
|
-
<InfoBlock v-bind="args">
|
|
50
|
-
${TEMPLATE}
|
|
51
|
-
</InfoBlock>
|
|
52
|
-
`,
|
|
53
|
-
}),
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const Blue: Story = {
|
|
57
|
-
args: {
|
|
58
|
-
icon: 'info',
|
|
59
|
-
color: 'blue',
|
|
60
|
-
},
|
|
61
|
-
render: (args) => ({
|
|
62
|
-
components: { InfoBlock },
|
|
63
|
-
setup() {
|
|
64
|
-
return { args }
|
|
65
|
-
},
|
|
66
|
-
template: `
|
|
67
|
-
<InfoBlock v-bind="args">
|
|
68
|
-
${TEMPLATE}
|
|
69
|
-
</InfoBlock>
|
|
70
|
-
`,
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const Rose: Story = {
|
|
75
|
-
args: {
|
|
76
|
-
icon: 'info',
|
|
77
|
-
color: 'rose',
|
|
78
|
-
},
|
|
79
|
-
render: (args) => ({
|
|
80
|
-
components: { InfoBlock },
|
|
81
|
-
setup() {
|
|
82
|
-
return { args }
|
|
83
|
-
},
|
|
84
|
-
template: `
|
|
85
|
-
<InfoBlock v-bind="args">
|
|
86
|
-
${TEMPLATE}
|
|
87
|
-
</InfoBlock>
|
|
88
|
-
`,
|
|
89
|
-
}),
|
|
90
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
-
import InfoBlock from './InfoBlock.vue'
|
|
4
|
-
|
|
5
|
-
describe('InfoBlock', () => {
|
|
6
|
-
it('renders correctly with default slot content and green color', () => {
|
|
7
|
-
const customText = 'Koopwoningen doen het goed als post of reel'
|
|
8
|
-
const wrapper = mount(InfoBlock, {
|
|
9
|
-
props: {
|
|
10
|
-
icon: 'bell',
|
|
11
|
-
color: 'green',
|
|
12
|
-
},
|
|
13
|
-
slots: {
|
|
14
|
-
default: `<div class="heading-4">Tip!</div><div class="body-medium">${customText}</div>`,
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
expect(wrapper.text()).toContain('Tip!')
|
|
19
|
-
expect(wrapper.text()).toContain(customText)
|
|
20
|
-
expect(wrapper.find('.bg-green-50').exists()).toBe(true)
|
|
21
|
-
expect(wrapper.find('.bg-green-500').exists()).toBe(true)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('renders correctly with custom color purple', () => {
|
|
25
|
-
const wrapper = mount(InfoBlock, {
|
|
26
|
-
props: {
|
|
27
|
-
icon: 'star',
|
|
28
|
-
color: 'purple',
|
|
29
|
-
},
|
|
30
|
-
slots: {
|
|
31
|
-
default: 'Custom Purple Content',
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
expect(wrapper.text()).toContain('Custom Purple Content')
|
|
36
|
-
expect(wrapper.find('.bg-sapphire-50').exists()).toBe(true)
|
|
37
|
-
expect(wrapper.find('.bg-purple-500').exists()).toBe(true)
|
|
38
|
-
expect(wrapper.find('.border-purple-500').exists()).toBe(true)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('renders correctly with custom color blue', () => {
|
|
42
|
-
const wrapper = mount(InfoBlock, {
|
|
43
|
-
props: {
|
|
44
|
-
icon: 'info',
|
|
45
|
-
color: 'blue',
|
|
46
|
-
},
|
|
47
|
-
slots: {
|
|
48
|
-
default: 'Custom Blue Content',
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
expect(wrapper.text()).toContain('Custom Blue Content')
|
|
53
|
-
expect(wrapper.find('.bg-yale-blue-50').exists()).toBe(true)
|
|
54
|
-
expect(wrapper.find('.bg-cornflower-blue-500').exists()).toBe(true)
|
|
55
|
-
expect(wrapper.find('.border-cornflower-blue-500').exists()).toBe(true)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('renders correctly with custom color rose', () => {
|
|
59
|
-
const wrapper = mount(InfoBlock, {
|
|
60
|
-
props: {
|
|
61
|
-
icon: 'info',
|
|
62
|
-
color: 'rose',
|
|
63
|
-
},
|
|
64
|
-
slots: {
|
|
65
|
-
default: 'Custom Rose Content',
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
expect(wrapper.text()).toContain('Custom Rose Content')
|
|
70
|
-
expect(wrapper.find('.bg-rose-50').exists()).toBe(true)
|
|
71
|
-
expect(wrapper.find('.bg-rose-500').exists()).toBe(true)
|
|
72
|
-
expect(wrapper.find('.border-rose-500').exists()).toBe(true)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('has correct accessibility attributes', () => {
|
|
76
|
-
const wrapper = mount(InfoBlock, {
|
|
77
|
-
props: {
|
|
78
|
-
icon: 'bell',
|
|
79
|
-
},
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// Check for role="note"
|
|
83
|
-
expect(wrapper.attributes('role')).toBe('note')
|
|
84
|
-
|
|
85
|
-
// Check that the icon container is hidden from screen readers
|
|
86
|
-
const iconContainer = wrapper.find('[aria-hidden="true"]')
|
|
87
|
-
expect(iconContainer.exists()).toBe(true)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('renders the specific icon provided via props', () => {
|
|
91
|
-
const wrapper = mount(InfoBlock, {
|
|
92
|
-
props: {
|
|
93
|
-
icon: 'heart',
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const icon = wrapper.findComponent({ name: 'NexxtIcon' })
|
|
98
|
-
expect(icon.exists()).toBe(true)
|
|
99
|
-
expect(icon.props('name')).toBe('heart')
|
|
100
|
-
})
|
|
101
|
-
})
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
import ProgressBar from './ProgressBar.vue'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Atoms/Progress Bar',
|
|
6
|
-
component: ProgressBar,
|
|
7
|
-
parameters: {
|
|
8
|
-
design: {
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System?node-id=369-218&t=CbHvOQfEMIr7M5mO-11',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof ProgressBar>
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof ProgressBar>
|
|
16
|
-
|
|
17
|
-
export const Default: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
steps: 5,
|
|
20
|
-
currentStep: 0,
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const WithTitles: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
steps: 5,
|
|
27
|
-
currentStep: 0,
|
|
28
|
-
stepTitles: ['Step 1', 'Step 2', 'Step 3', 'Step 4', 'Step 5'],
|
|
29
|
-
},
|
|
30
|
-
}
|