@nexxtmove/ui 2.6.0 → 2.7.0

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.
Files changed (223) hide show
  1. package/dist/index.js +49 -126
  2. package/dist/nuxt.js +0 -1
  3. package/package.json +38 -36
  4. package/src/attribute-contract.test.ts +151 -0
  5. package/src/components/atoms/AnimatedNumber/AnimatedNumber.stories.ts +36 -0
  6. package/src/components/atoms/AnimatedNumber/AnimatedNumber.test.ts +21 -0
  7. package/src/components/atoms/Avatar/Avatar.stories.ts +122 -0
  8. package/src/components/atoms/Avatar/Avatar.test.ts +134 -0
  9. package/src/components/atoms/Button/Button.stories.ts +290 -0
  10. package/src/components/atoms/Button/Button.test.ts +406 -0
  11. package/src/components/atoms/Card/Card.stories.ts +45 -0
  12. package/src/components/atoms/Card/Card.test.ts +46 -0
  13. package/src/components/atoms/Checkbox/Checkbox.stories.ts +35 -0
  14. package/src/components/atoms/Checkbox/Checkbox.test.ts +55 -0
  15. package/src/components/atoms/Chip/Chip.stories.ts +274 -0
  16. package/src/components/atoms/Chip/Chip.test.ts +230 -0
  17. package/src/components/atoms/EnergyLabel/EnergyLabel.stories.ts +189 -0
  18. package/src/components/atoms/EnergyLabel/EnergyLabel.test.ts +100 -0
  19. package/src/components/atoms/FloatingPanel/FloatingPanel.stories.ts +677 -0
  20. package/src/components/atoms/FloatingPanel/FloatingPanel.test.ts +864 -0
  21. package/src/components/atoms/Icon/Icon.stories.ts +63 -0
  22. package/src/components/atoms/Icon/Icon.test.ts +89 -0
  23. package/src/components/atoms/Loader/Loader.stories.ts +36 -0
  24. package/src/components/atoms/Loader/Loader.test.ts +40 -0
  25. package/src/components/atoms/PickerItem/PickerItem.stories.ts +172 -0
  26. package/src/components/atoms/PickerItem/PickerItem.test.ts +142 -0
  27. package/src/components/atoms/PickerPreview/PickerPreview.stories.ts +183 -0
  28. package/src/components/atoms/PickerPreview/PickerPreview.test.ts +137 -0
  29. package/src/components/atoms/PresenceIndicator/PresenceIndicator.stories.ts +21 -0
  30. package/src/components/atoms/PropertyListing/PropertyListing.stories.ts +38 -0
  31. package/src/components/atoms/PropertyListing/PropertyListing.test.ts +46 -0
  32. package/src/components/atoms/SelectableOption/SelectableOption.stories.ts +131 -0
  33. package/src/components/atoms/SelectableOption/SelectableOption.test.ts +96 -0
  34. package/src/components/atoms/Skeleton/Skeleton.stories.ts +27 -0
  35. package/src/components/atoms/Skeleton/Skeleton.test.ts +28 -0
  36. package/src/components/atoms/Slider/Slider.stories.ts +151 -0
  37. package/src/components/atoms/Slider/Slider.test.ts +191 -0
  38. package/src/components/atoms/Squircle/Squircle.stories.ts +114 -0
  39. package/src/components/atoms/Squircle/Squircle.test.ts +70 -0
  40. package/src/components/atoms/Switch/Switch.stories.ts +91 -0
  41. package/src/components/atoms/Switch/Switch.test.ts +183 -0
  42. package/src/components/atoms/Tooltip/Tooltip.stories.ts +158 -0
  43. package/src/components/atoms/Tooltip/Tooltip.test.ts +134 -0
  44. package/src/components/editor/atoms/EditorDimensionField/EditorDimensionField.stories.ts +124 -0
  45. package/src/components/editor/atoms/EditorDimensionField/EditorDimensionField.test.ts +464 -0
  46. package/src/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.stories.ts +266 -0
  47. package/src/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.test.ts +421 -0
  48. package/src/components/editor/atoms/EditorSettingsGroup/EditorSettingsGroup.stories.ts +365 -0
  49. package/src/components/editor/atoms/EditorSettingsGroup/EditorSettingsGroup.test.ts +484 -0
  50. package/src/components/editor/composables/useRadioGrid.test.ts +261 -0
  51. package/src/components/editor/molecules/EditorAlignItems/EditorAlignItems.stories.ts +73 -0
  52. package/src/components/editor/molecules/EditorAlignItems/EditorAlignItems.test.ts +189 -0
  53. package/src/components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.stories.ts +309 -0
  54. package/src/components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.test.ts +359 -0
  55. package/src/components/editor/molecules/EditorAnchor/EditorAnchor.stories.ts +138 -0
  56. package/src/components/editor/molecules/EditorAnchor/EditorAnchor.test.ts +344 -0
  57. package/src/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.stories.ts +87 -0
  58. package/src/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.test.ts +262 -0
  59. package/src/components/editor/molecules/EditorBlur/EditorBlur.stories.ts +115 -0
  60. package/src/components/editor/molecules/EditorBlur/EditorBlur.test.ts +243 -0
  61. package/src/components/editor/molecules/EditorBorder/EditorBorder.stories.ts +187 -0
  62. package/src/components/editor/molecules/EditorBorder/EditorBorder.test.ts +456 -0
  63. package/src/components/editor/molecules/EditorColor/EditorColor.stories.ts +563 -0
  64. package/src/components/editor/molecules/EditorColor/EditorColor.test.ts +689 -0
  65. package/src/components/editor/molecules/EditorColor/EditorColorGradient.test.ts +793 -0
  66. package/src/components/editor/molecules/EditorColor/gradientClass.test.ts +303 -0
  67. package/src/components/editor/molecules/EditorDashPattern/EditorDashPattern.stories.ts +72 -0
  68. package/src/components/editor/molecules/EditorDashPattern/EditorDashPattern.test.ts +124 -0
  69. package/src/components/editor/molecules/EditorFlexDirection/EditorFlexDirection.stories.ts +46 -0
  70. package/src/components/editor/molecules/EditorFlexDirection/EditorFlexDirection.test.ts +97 -0
  71. package/src/components/editor/molecules/EditorFontSize/EditorFontSize.stories.ts +248 -0
  72. package/src/components/editor/molecules/EditorFontSize/EditorFontSize.test.ts +288 -0
  73. package/src/components/editor/molecules/EditorGap/EditorGap.stories.ts +129 -0
  74. package/src/components/editor/molecules/EditorGap/EditorGap.test.ts +253 -0
  75. package/src/components/editor/molecules/EditorHeadingType/EditorHeadingType.stories.ts +68 -0
  76. package/src/components/editor/molecules/EditorHeadingType/EditorHeadingType.test.ts +150 -0
  77. package/src/components/editor/molecules/EditorJustifyContent/EditorJustifyContent.stories.ts +71 -0
  78. package/src/components/editor/molecules/EditorJustifyContent/EditorJustifyContent.test.ts +161 -0
  79. package/src/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.stories.ts +204 -0
  80. package/src/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.test.ts +238 -0
  81. package/src/components/editor/molecules/EditorLineHeight/EditorLineHeight.stories.ts +257 -0
  82. package/src/components/editor/molecules/EditorLineHeight/EditorLineHeight.test.ts +286 -0
  83. package/src/components/editor/molecules/EditorLineStyle/EditorLineStyle.stories.ts +135 -0
  84. package/src/components/editor/molecules/EditorLineStyle/EditorLineStyle.test.ts +230 -0
  85. package/src/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.stories.ts +154 -0
  86. package/src/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.test.ts +112 -0
  87. package/src/components/editor/molecules/EditorOverrideStatus/EditorOverrideStatus.stories.ts +206 -0
  88. package/src/components/editor/molecules/EditorOverrideStatus/EditorOverrideStatus.test.ts +332 -0
  89. package/src/components/editor/molecules/EditorPadding/EditorPadding.stories.ts +374 -0
  90. package/src/components/editor/molecules/EditorPadding/EditorPadding.test.ts +712 -0
  91. package/src/components/editor/molecules/EditorRadius/EditorRadius.stories.ts +64 -0
  92. package/src/components/editor/molecules/EditorRadius/EditorRadius.test.ts +137 -0
  93. package/src/components/editor/molecules/EditorShadow/EditorShadow.stories.ts +103 -0
  94. package/src/components/editor/molecules/EditorShadow/EditorShadow.test.ts +168 -0
  95. package/src/components/editor/molecules/EditorSize/EditorSize.stories.ts +84 -0
  96. package/src/components/editor/molecules/EditorSize/EditorSize.test.ts +253 -0
  97. package/src/components/editor/molecules/EditorSizeLimit/EditorSizeLimit.stories.ts +49 -0
  98. package/src/components/editor/molecules/EditorSizeLimit/EditorSizeLimit.test.ts +43 -0
  99. package/src/components/editor/molecules/EditorTextAlign/EditorTextAlign.stories.ts +69 -0
  100. package/src/components/editor/molecules/EditorTextAlign/EditorTextAlign.test.ts +155 -0
  101. package/src/components/molecules/Announcement/Announcement.stories.ts +224 -0
  102. package/src/components/molecules/Announcement/Announcement.test.ts +161 -0
  103. package/src/components/molecules/ContactInfoCard/ContactInfoCard.stories.ts +99 -0
  104. package/src/components/molecules/ContactInfoCard/ContactInfoCard.test.ts +70 -0
  105. package/src/components/molecules/CustomerJourneyTile/CustomerJourneyTile.stories.ts +148 -0
  106. package/src/components/molecules/CustomerJourneyTile/CustomerJourneyTile.test.ts +271 -0
  107. package/src/components/molecules/DoughnutChart/DoughnutChart.stories.ts +45 -0
  108. package/src/components/molecules/DoughnutChart/DoughnutChart.test.ts +205 -0
  109. package/src/components/molecules/InfoBlock/InfoBlock.stories.ts +84 -0
  110. package/src/components/molecules/InfoBlock/InfoBlock.test.ts +101 -0
  111. package/src/components/molecules/InputField/InputField.stories.ts +117 -0
  112. package/src/components/molecules/InputField/InputField.test.ts +138 -0
  113. package/src/components/molecules/InputSelect/InputSelect.stories.ts +116 -0
  114. package/src/components/molecules/InputSelect/InputSelect.test.ts +127 -0
  115. package/src/components/molecules/ModalFooter/ModalFooter.stories.ts +204 -0
  116. package/src/components/molecules/ModalFooter/ModalFooter.test.ts +276 -0
  117. package/src/components/molecules/PageCard/PageCard.stories.ts +100 -0
  118. package/src/components/molecules/PageCard/PageCard.test.ts +91 -0
  119. package/src/components/molecules/PageContainer/PageContainer.stories.ts +90 -0
  120. package/src/components/molecules/PageContainer/PageContainer.test.ts +50 -0
  121. package/src/components/molecules/PageMockup/PageMockup.stories.ts +38 -0
  122. package/src/components/molecules/PageMockup/PageMockup.test.ts +20 -0
  123. package/src/components/molecules/PageTypeTile/PageTypeTile.stories.ts +63 -0
  124. package/src/components/molecules/PageTypeTile/PageTypeTile.test.ts +41 -0
  125. package/src/components/molecules/Pagination/Pagination.stories.ts +72 -0
  126. package/src/components/molecules/Pagination/Pagination.test.ts +130 -0
  127. package/src/components/molecules/PickerGroup/PickerGroup.stories.ts +90 -0
  128. package/src/components/molecules/PickerGroup/PickerGroup.test.ts +145 -0
  129. package/src/components/molecules/PickerList/PickerList.stories.ts +436 -0
  130. package/src/components/molecules/PickerList/PickerList.test.ts +870 -0
  131. package/src/components/molecules/PlaceholderInput/PlaceholderInput.stories.ts +48 -0
  132. package/src/components/molecules/PlaceholderInput/PlaceholderInput.test.ts +107 -0
  133. package/src/components/molecules/PropertyCard/PropertyCard.stories.ts +46 -0
  134. package/src/components/molecules/PropertyCard/PropertyCard.test.ts +59 -0
  135. package/src/components/molecules/Select/Select.stories.ts +264 -0
  136. package/src/components/molecules/Select/Select.test.ts +315 -0
  137. package/src/components/molecules/SidebarMenuItem/SidebarMenuItem.stories.ts +84 -0
  138. package/src/components/molecules/SidebarMenuItem/SidebarMenuItem.test.ts +103 -0
  139. package/src/components/molecules/SkeletonPropertyCard/SkeletonPropertyCard.stories.ts +11 -0
  140. package/src/components/molecules/SkeletonPropertyCard/SkeletonPropertyCard.test.ts +38 -0
  141. package/src/components/molecules/SocialIcons/SocialIcons.stories.ts +28 -0
  142. package/src/components/molecules/SocialIcons/SocialIcons.test.ts +58 -0
  143. package/src/components/molecules/SocialMediaCustomTemplate/SocialMediaCustomTemplate.stories.ts +11 -0
  144. package/src/components/molecules/SocialMediaCustomTemplate/SocialMediaCustomTemplate.test.ts +116 -0
  145. package/src/components/molecules/SocialMediaType/SocialMediaType.stories.ts +37 -0
  146. package/src/components/molecules/SocialMediaType/SocialMediaType.test.ts +126 -0
  147. package/src/components/molecules/Source/Source.stories.ts +35 -0
  148. package/src/components/molecules/Source/Source.test.ts +45 -0
  149. package/src/components/molecules/TabbedContent/TabbedContent.stories.ts +96 -0
  150. package/src/components/molecules/TabbedContent/TabbedContent.test.ts +109 -0
  151. package/src/components/molecules/Tabs/Tabs.stories.ts +230 -0
  152. package/src/components/molecules/Tabs/Tabs.test.ts +280 -0
  153. package/src/components/molecules/TemplateCard/TemplateCard.stories.ts +327 -0
  154. package/src/components/molecules/TemplateCard/TemplateCard.test.ts +339 -0
  155. package/src/components/molecules/Textarea/Textarea.stories.ts +216 -0
  156. package/src/components/molecules/Textarea/Textarea.test.ts +191 -0
  157. package/src/components/molecules/TimelineEvent/TimelineEvent.stories.ts +319 -0
  158. package/src/components/molecules/TimelineEvent/TimelineEvent.test.ts +224 -0
  159. package/src/components/molecules/TimelineLanes/TimelineLanes.stories.ts +29 -0
  160. package/src/components/molecules/TimelineLanes/TimelineLanes.test.ts +30 -0
  161. package/src/components/molecules/Toast/Toast.stories.ts +110 -0
  162. package/src/components/molecules/Toast/Toast.test.ts +103 -0
  163. package/src/components/molecules/ToggleGroup/ToggleGroup.stories.ts +297 -0
  164. package/src/components/molecules/ToggleGroup/ToggleGroup.test.ts +578 -0
  165. package/src/components/molecules/Tree/Tree.stories.ts +884 -0
  166. package/src/components/molecules/Tree/Tree.test.ts +1247 -0
  167. package/src/components/molecules/Tree/tree-drop.test.ts +223 -0
  168. package/src/components/organisms/Calendar/Calendar.stories.ts +108 -0
  169. package/src/components/organisms/Calendar/Calendar.test.ts +279 -0
  170. package/src/components/organisms/Calendar/_CalendarDayView.test.ts +104 -0
  171. package/src/components/organisms/Calendar/_CalendarHeader.test.ts +86 -0
  172. package/src/components/organisms/Calendar/_CalendarMonthView.test.ts +52 -0
  173. package/src/components/organisms/Calendar/_CalendarTimePicker.test.ts +89 -0
  174. package/src/components/organisms/Calendar/_CalendarYearView.test.ts +56 -0
  175. package/src/components/organisms/ColorPicker/ColorPicker.stories.ts +229 -0
  176. package/src/components/organisms/ColorPicker/ColorPicker.test.ts +638 -0
  177. package/src/components/organisms/ColorPicker/gradient.test.ts +67 -0
  178. package/src/components/organisms/ColorPicker/gradientGeometry.test.ts +206 -0
  179. package/src/components/organisms/Combobox/Combobox.stories.ts +234 -0
  180. package/src/components/organisms/Combobox/Combobox.test.ts +512 -0
  181. package/src/components/organisms/Combobox/Combobox.vue +1 -1
  182. package/src/components/organisms/ComboboxPanel/ComboboxPanel.stories.ts +158 -0
  183. package/src/components/organisms/ComboboxPanel/ComboboxPanel.test.ts +524 -0
  184. package/src/components/organisms/ComboboxPanel/ComboboxPanel.vue +1 -1
  185. package/src/components/organisms/CountrySelect/CountrySelect.stories.ts +139 -0
  186. package/src/components/organisms/CountrySelect/CountrySelect.test.ts +149 -0
  187. package/src/components/organisms/DatePicker/DatePicker.stories.ts +163 -0
  188. package/src/components/organisms/DatePicker/DatePicker.test.ts +214 -0
  189. package/src/components/organisms/DropdownButton/DropdownButton.stories.ts +123 -0
  190. package/src/components/organisms/DropdownButton/DropdownButton.test.ts +379 -0
  191. package/src/components/organisms/FontPicker/FontPicker.stories.ts +476 -0
  192. package/src/components/organisms/FontPicker/FontPicker.test.ts +873 -0
  193. package/src/components/organisms/Header/Header.stories.ts +75 -0
  194. package/src/components/organisms/Header/Header.test.ts +233 -0
  195. package/src/components/organisms/IconPicker/IconPicker.stories.ts +734 -0
  196. package/src/components/organisms/IconPicker/IconPicker.test.ts +669 -0
  197. package/src/components/organisms/IconPicker/_IconPickerGrid.test.ts +184 -0
  198. package/src/components/organisms/IconPicker/_IconPickerRail.test.ts +102 -0
  199. package/src/components/organisms/IconPicker/useIconPickerNavigation.test.ts +215 -0
  200. package/src/components/organisms/Modal/Modal.stories.ts +350 -0
  201. package/src/components/organisms/Modal/Modal.test.ts +275 -0
  202. package/src/components/organisms/PickerPanel/PickerPanel.stories.ts +452 -0
  203. package/src/components/organisms/PickerPanel/PickerPanel.test.ts +358 -0
  204. package/src/components/organisms/ProgressBar/ProgressBar.stories.ts +100 -0
  205. package/src/components/organisms/ProgressBar/ProgressBar.test.ts +417 -0
  206. package/src/components/organisms/ReferenceCard/ReferenceCard.stories.ts +191 -0
  207. package/src/components/organisms/ReferenceCard/ReferenceCard.test.ts +165 -0
  208. package/src/components/organisms/SocialMediaTemplate/SocialMediaTemplate.stories.ts +65 -0
  209. package/src/components/organisms/SocialMediaTemplate/SocialMediaTemplate.test.ts +466 -0
  210. package/src/components/organisms/StepperHeader/StepperHeader.stories.ts +91 -0
  211. package/src/components/organisms/StepperHeader/StepperHeader.test.ts +279 -0
  212. package/src/components/organisms/Table/Table.stories.ts +332 -0
  213. package/src/components/organisms/Table/Table.test.ts +320 -0
  214. package/src/components/organisms/TimelinePhaseblock/TimelinePhaseblock.stories.ts +198 -0
  215. package/src/components/organisms/TimelinePhaseblock/TimelinePhaseblock.test.ts +283 -0
  216. package/src/components/organisms/TimelineTrack/TimelineTrack.stories.ts +120 -0
  217. package/src/components/organisms/TimelineTrack/TimelineTrack.test.ts +91 -0
  218. package/src/components/organisms/Toaster/Toaster.stories.ts +51 -0
  219. package/src/components/organisms/Toaster/Toaster.test.ts +75 -0
  220. package/src/components/organisms/VideoControls/VideoControls.stories.ts +792 -0
  221. package/src/components/organisms/VideoControls/VideoControls.test.ts +1056 -0
  222. package/src/components/organisms/VideoPlayer/VideoPlayer.stories.ts +327 -0
  223. package/src/components/organisms/VideoPlayer/VideoPlayer.test.ts +439 -0
@@ -0,0 +1,75 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite'
2
+ import Header from './Header.vue'
3
+ import Button from '../../atoms/Button/Button.vue'
4
+
5
+ export default {
6
+ title: 'Components/Organisms/Header',
7
+ component: Header,
8
+ } satisfies Meta<typeof Header>
9
+
10
+ type Story = StoryObj<typeof Header>
11
+
12
+ export const Default: Story = {
13
+ args: {
14
+ title: 'Header Title',
15
+ backButtonText: 'Back',
16
+ backButtonAction: () => console.log('Back button clicked'),
17
+ },
18
+ }
19
+
20
+ export const WithoutBackButton: Story = {
21
+ args: {
22
+ title: 'Header Title',
23
+ },
24
+ }
25
+
26
+ export const WithSlots: Story = {
27
+ args: {
28
+ title: 'Header Title',
29
+ backButtonText: 'Go Back',
30
+ backButtonAction: () => console.log('Back clicked'),
31
+ },
32
+ render: (args) => ({
33
+ components: { Header, Button },
34
+ setup() {
35
+ return { args }
36
+ },
37
+ template: `
38
+ <Header v-bind="args">
39
+ <template #center>
40
+ <span class="font-bold">Centered Content</span>
41
+ </template>
42
+ <template #right>
43
+ <Button variant="primary" icon="arrow-right" :icon-right="true">Next</Button>
44
+ </template>
45
+ </Header>
46
+ `,
47
+ }),
48
+ }
49
+
50
+ export const WithBackButtonAndActions: Story = {
51
+ args: {
52
+ title:
53
+ 'Nieuw, Koopwoning(en) (Van Harinxmaloane 31, Barent Fockesstraat 58, Flaaksikkers 27), 18-09-2025',
54
+ headingType: 'heading-1',
55
+ },
56
+ render: (args) => ({
57
+ components: { Header, Button },
58
+ setup() {
59
+ return { args }
60
+ },
61
+ template: `
62
+ <Header v-bind="args" class="shrink-0">
63
+ <template #back-button>
64
+ <Button variant="secondary" icon="chevron-left" class="shrink-0">All posts</Button>
65
+ </template>
66
+ <template #right>
67
+ <div class="flex items-center gap-3">
68
+ <Button variant="secondary" icon="pencil">Edit</Button>
69
+ <Button variant="secondary" icon="trash" class="text-red-600 hover:text-red-700">Delete</Button>
70
+ </div>
71
+ </template>
72
+ </Header>
73
+ `,
74
+ }),
75
+ }
@@ -0,0 +1,233 @@
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 '../../atoms/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
+
184
+ it('renders the static title span when no title slot is given', () => {
185
+ const wrapper = mount(Header, { props: { title: 'Static' } })
186
+
187
+ expect(wrapper.find('span.heading-4').exists()).toBe(true)
188
+ expect(wrapper.find('span.heading-4').text()).toBe('Static')
189
+ })
190
+
191
+ it('replaces the static title with the title slot', () => {
192
+ const wrapper = mount(Header, {
193
+ props: { title: 'Static' },
194
+ slots: {
195
+ title: '<input class="title-field" value="Editable" />',
196
+ },
197
+ })
198
+
199
+ expect(wrapper.find('.title-field').exists()).toBe(true)
200
+ expect(wrapper.find('span.heading-4').exists()).toBe(false)
201
+ expect(wrapper.text()).not.toContain('Static')
202
+ })
203
+
204
+ it('keeps the title area sizing when the title slot is used', () => {
205
+ const wrapper = mount(Header, {
206
+ slots: {
207
+ title: '<input class="title-field" />',
208
+ },
209
+ })
210
+
211
+ const titleArea = wrapper.find('.title-field').element.parentElement
212
+ expect(titleArea?.className).toContain('flex-1')
213
+ expect(titleArea?.className).toContain('min-w-0')
214
+ })
215
+
216
+ it('renders without a title prop when the title slot is used', () => {
217
+ const wrapper = mount(Header, {
218
+ slots: { title: '<span class="own-title">Eigen titel</span>' },
219
+ })
220
+
221
+ expect(wrapper.find('.own-title').text()).toBe('Eigen titel')
222
+ })
223
+
224
+ it('renders the back-button slot instead of the default button', () => {
225
+ const wrapper = mount(Header, {
226
+ props: { title: 'Test', backButtonText: 'Previous' },
227
+ slots: { 'back-button': '<a class="own-back">Terug</a>' },
228
+ })
229
+
230
+ expect(wrapper.find('.own-back').exists()).toBe(true)
231
+ expect(wrapper.findComponent(Button).exists()).toBe(false)
232
+ })
233
+ })