@nexxtmove/ui 2.6.0 → 2.8.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.
- package/dist/components/editor/molecules/EditorColor/EditorColor.vue.d.ts +7 -5
- package/dist/components/editor/molecules/EditorColor/_ColorField.vue.d.ts +4 -1
- package/dist/components/organisms/ColorPicker/ColorPicker.vue.d.ts +3 -1
- package/dist/index.js +95 -172
- package/dist/nuxt.js +0 -1
- package/package.json +38 -36
- package/src/attribute-contract.test.ts +151 -0
- package/src/components/atoms/AnimatedNumber/AnimatedNumber.stories.ts +36 -0
- package/src/components/atoms/AnimatedNumber/AnimatedNumber.test.ts +21 -0
- package/src/components/atoms/Avatar/Avatar.stories.ts +122 -0
- package/src/components/atoms/Avatar/Avatar.test.ts +134 -0
- package/src/components/atoms/Button/Button.stories.ts +290 -0
- package/src/components/atoms/Button/Button.test.ts +406 -0
- package/src/components/atoms/Card/Card.stories.ts +45 -0
- package/src/components/atoms/Card/Card.test.ts +46 -0
- package/src/components/atoms/Checkbox/Checkbox.stories.ts +35 -0
- package/src/components/atoms/Checkbox/Checkbox.test.ts +55 -0
- package/src/components/atoms/Chip/Chip.stories.ts +274 -0
- package/src/components/atoms/Chip/Chip.test.ts +230 -0
- package/src/components/atoms/EnergyLabel/EnergyLabel.stories.ts +189 -0
- package/src/components/atoms/EnergyLabel/EnergyLabel.test.ts +100 -0
- package/src/components/atoms/FloatingPanel/FloatingPanel.stories.ts +677 -0
- package/src/components/atoms/FloatingPanel/FloatingPanel.test.ts +864 -0
- package/src/components/atoms/Icon/Icon.stories.ts +63 -0
- package/src/components/atoms/Icon/Icon.test.ts +89 -0
- package/src/components/atoms/Loader/Loader.stories.ts +36 -0
- package/src/components/atoms/Loader/Loader.test.ts +40 -0
- package/src/components/atoms/PickerItem/PickerItem.stories.ts +172 -0
- package/src/components/atoms/PickerItem/PickerItem.test.ts +142 -0
- package/src/components/atoms/PickerPreview/PickerPreview.stories.ts +183 -0
- package/src/components/atoms/PickerPreview/PickerPreview.test.ts +137 -0
- package/src/components/atoms/PresenceIndicator/PresenceIndicator.stories.ts +21 -0
- package/src/components/atoms/PropertyListing/PropertyListing.stories.ts +38 -0
- package/src/components/atoms/PropertyListing/PropertyListing.test.ts +46 -0
- package/src/components/atoms/SelectableOption/SelectableOption.stories.ts +131 -0
- package/src/components/atoms/SelectableOption/SelectableOption.test.ts +96 -0
- package/src/components/atoms/Skeleton/Skeleton.stories.ts +27 -0
- package/src/components/atoms/Skeleton/Skeleton.test.ts +28 -0
- package/src/components/atoms/Slider/Slider.stories.ts +151 -0
- package/src/components/atoms/Slider/Slider.test.ts +191 -0
- package/src/components/atoms/Squircle/Squircle.stories.ts +114 -0
- package/src/components/atoms/Squircle/Squircle.test.ts +70 -0
- package/src/components/atoms/Switch/Switch.stories.ts +91 -0
- package/src/components/atoms/Switch/Switch.test.ts +183 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.ts +158 -0
- package/src/components/atoms/Tooltip/Tooltip.test.ts +134 -0
- package/src/components/editor/atoms/EditorDimensionField/EditorDimensionField.stories.ts +124 -0
- package/src/components/editor/atoms/EditorDimensionField/EditorDimensionField.test.ts +464 -0
- package/src/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.stories.ts +266 -0
- package/src/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.test.ts +421 -0
- package/src/components/editor/atoms/EditorSettingsGroup/EditorSettingsGroup.stories.ts +365 -0
- package/src/components/editor/atoms/EditorSettingsGroup/EditorSettingsGroup.test.ts +484 -0
- package/src/components/editor/composables/useRadioGrid.test.ts +261 -0
- package/src/components/editor/molecules/EditorAlignItems/EditorAlignItems.stories.ts +73 -0
- package/src/components/editor/molecules/EditorAlignItems/EditorAlignItems.test.ts +189 -0
- package/src/components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.stories.ts +309 -0
- package/src/components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.test.ts +359 -0
- package/src/components/editor/molecules/EditorAnchor/EditorAnchor.stories.ts +138 -0
- package/src/components/editor/molecules/EditorAnchor/EditorAnchor.test.ts +344 -0
- package/src/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.stories.ts +87 -0
- package/src/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.test.ts +262 -0
- package/src/components/editor/molecules/EditorBlur/EditorBlur.stories.ts +115 -0
- package/src/components/editor/molecules/EditorBlur/EditorBlur.test.ts +243 -0
- package/src/components/editor/molecules/EditorBorder/EditorBorder.stories.ts +187 -0
- package/src/components/editor/molecules/EditorBorder/EditorBorder.test.ts +456 -0
- package/src/components/editor/molecules/EditorColor/EditorColor.stories.ts +633 -0
- package/src/components/editor/molecules/EditorColor/EditorColor.test.ts +776 -0
- package/src/components/editor/molecules/EditorColor/EditorColor.vue +7 -5
- package/src/components/editor/molecules/EditorColor/EditorColorGradient.test.ts +832 -0
- package/src/components/editor/molecules/EditorColor/_ColorField.vue +20 -15
- package/src/components/editor/molecules/EditorColor/gradientClass.test.ts +303 -0
- package/src/components/editor/molecules/EditorDashPattern/EditorDashPattern.stories.ts +72 -0
- package/src/components/editor/molecules/EditorDashPattern/EditorDashPattern.test.ts +124 -0
- package/src/components/editor/molecules/EditorFlexDirection/EditorFlexDirection.stories.ts +46 -0
- package/src/components/editor/molecules/EditorFlexDirection/EditorFlexDirection.test.ts +97 -0
- package/src/components/editor/molecules/EditorFontSize/EditorFontSize.stories.ts +248 -0
- package/src/components/editor/molecules/EditorFontSize/EditorFontSize.test.ts +288 -0
- package/src/components/editor/molecules/EditorGap/EditorGap.stories.ts +129 -0
- package/src/components/editor/molecules/EditorGap/EditorGap.test.ts +253 -0
- package/src/components/editor/molecules/EditorHeadingType/EditorHeadingType.stories.ts +68 -0
- package/src/components/editor/molecules/EditorHeadingType/EditorHeadingType.test.ts +150 -0
- package/src/components/editor/molecules/EditorJustifyContent/EditorJustifyContent.stories.ts +71 -0
- package/src/components/editor/molecules/EditorJustifyContent/EditorJustifyContent.test.ts +161 -0
- package/src/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.stories.ts +204 -0
- package/src/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.test.ts +238 -0
- package/src/components/editor/molecules/EditorLineHeight/EditorLineHeight.stories.ts +257 -0
- package/src/components/editor/molecules/EditorLineHeight/EditorLineHeight.test.ts +286 -0
- package/src/components/editor/molecules/EditorLineStyle/EditorLineStyle.stories.ts +135 -0
- package/src/components/editor/molecules/EditorLineStyle/EditorLineStyle.test.ts +230 -0
- package/src/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.stories.ts +154 -0
- package/src/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.test.ts +112 -0
- package/src/components/editor/molecules/EditorOverrideStatus/EditorOverrideStatus.stories.ts +206 -0
- package/src/components/editor/molecules/EditorOverrideStatus/EditorOverrideStatus.test.ts +332 -0
- package/src/components/editor/molecules/EditorPadding/EditorPadding.stories.ts +374 -0
- package/src/components/editor/molecules/EditorPadding/EditorPadding.test.ts +712 -0
- package/src/components/editor/molecules/EditorRadius/EditorRadius.stories.ts +64 -0
- package/src/components/editor/molecules/EditorRadius/EditorRadius.test.ts +137 -0
- package/src/components/editor/molecules/EditorShadow/EditorShadow.stories.ts +103 -0
- package/src/components/editor/molecules/EditorShadow/EditorShadow.test.ts +168 -0
- package/src/components/editor/molecules/EditorSize/EditorSize.stories.ts +84 -0
- package/src/components/editor/molecules/EditorSize/EditorSize.test.ts +253 -0
- package/src/components/editor/molecules/EditorSizeLimit/EditorSizeLimit.stories.ts +49 -0
- package/src/components/editor/molecules/EditorSizeLimit/EditorSizeLimit.test.ts +43 -0
- package/src/components/editor/molecules/EditorTextAlign/EditorTextAlign.stories.ts +69 -0
- package/src/components/editor/molecules/EditorTextAlign/EditorTextAlign.test.ts +155 -0
- package/src/components/molecules/Announcement/Announcement.stories.ts +224 -0
- package/src/components/molecules/Announcement/Announcement.test.ts +161 -0
- package/src/components/molecules/ContactInfoCard/ContactInfoCard.stories.ts +99 -0
- package/src/components/molecules/ContactInfoCard/ContactInfoCard.test.ts +70 -0
- package/src/components/molecules/CustomerJourneyTile/CustomerJourneyTile.stories.ts +148 -0
- package/src/components/molecules/CustomerJourneyTile/CustomerJourneyTile.test.ts +271 -0
- package/src/components/molecules/DoughnutChart/DoughnutChart.stories.ts +45 -0
- package/src/components/molecules/DoughnutChart/DoughnutChart.test.ts +205 -0
- package/src/components/molecules/InfoBlock/InfoBlock.stories.ts +84 -0
- package/src/components/molecules/InfoBlock/InfoBlock.test.ts +101 -0
- package/src/components/molecules/InputField/InputField.stories.ts +117 -0
- package/src/components/molecules/InputField/InputField.test.ts +138 -0
- package/src/components/molecules/InputSelect/InputSelect.stories.ts +116 -0
- package/src/components/molecules/InputSelect/InputSelect.test.ts +127 -0
- package/src/components/molecules/ModalFooter/ModalFooter.stories.ts +204 -0
- package/src/components/molecules/ModalFooter/ModalFooter.test.ts +276 -0
- package/src/components/molecules/PageCard/PageCard.stories.ts +100 -0
- package/src/components/molecules/PageCard/PageCard.test.ts +91 -0
- package/src/components/molecules/PageContainer/PageContainer.stories.ts +90 -0
- package/src/components/molecules/PageContainer/PageContainer.test.ts +50 -0
- package/src/components/molecules/PageMockup/PageMockup.stories.ts +38 -0
- package/src/components/molecules/PageMockup/PageMockup.test.ts +20 -0
- package/src/components/molecules/PageTypeTile/PageTypeTile.stories.ts +63 -0
- package/src/components/molecules/PageTypeTile/PageTypeTile.test.ts +41 -0
- package/src/components/molecules/Pagination/Pagination.stories.ts +72 -0
- package/src/components/molecules/Pagination/Pagination.test.ts +130 -0
- package/src/components/molecules/PickerGroup/PickerGroup.stories.ts +90 -0
- package/src/components/molecules/PickerGroup/PickerGroup.test.ts +145 -0
- package/src/components/molecules/PickerList/PickerList.stories.ts +436 -0
- package/src/components/molecules/PickerList/PickerList.test.ts +870 -0
- package/src/components/molecules/PlaceholderInput/PlaceholderInput.stories.ts +48 -0
- package/src/components/molecules/PlaceholderInput/PlaceholderInput.test.ts +107 -0
- package/src/components/molecules/PropertyCard/PropertyCard.stories.ts +46 -0
- package/src/components/molecules/PropertyCard/PropertyCard.test.ts +59 -0
- package/src/components/molecules/Select/Select.stories.ts +264 -0
- package/src/components/molecules/Select/Select.test.ts +315 -0
- package/src/components/molecules/SidebarMenuItem/SidebarMenuItem.stories.ts +84 -0
- package/src/components/molecules/SidebarMenuItem/SidebarMenuItem.test.ts +103 -0
- package/src/components/molecules/SkeletonPropertyCard/SkeletonPropertyCard.stories.ts +11 -0
- package/src/components/molecules/SkeletonPropertyCard/SkeletonPropertyCard.test.ts +38 -0
- package/src/components/molecules/SocialIcons/SocialIcons.stories.ts +28 -0
- package/src/components/molecules/SocialIcons/SocialIcons.test.ts +58 -0
- package/src/components/molecules/SocialMediaCustomTemplate/SocialMediaCustomTemplate.stories.ts +11 -0
- package/src/components/molecules/SocialMediaCustomTemplate/SocialMediaCustomTemplate.test.ts +116 -0
- package/src/components/molecules/SocialMediaType/SocialMediaType.stories.ts +37 -0
- package/src/components/molecules/SocialMediaType/SocialMediaType.test.ts +126 -0
- package/src/components/molecules/Source/Source.stories.ts +35 -0
- package/src/components/molecules/Source/Source.test.ts +45 -0
- package/src/components/molecules/TabbedContent/TabbedContent.stories.ts +96 -0
- package/src/components/molecules/TabbedContent/TabbedContent.test.ts +109 -0
- package/src/components/molecules/Tabs/Tabs.stories.ts +230 -0
- package/src/components/molecules/Tabs/Tabs.test.ts +280 -0
- package/src/components/molecules/TemplateCard/TemplateCard.stories.ts +327 -0
- package/src/components/molecules/TemplateCard/TemplateCard.test.ts +339 -0
- package/src/components/molecules/Textarea/Textarea.stories.ts +216 -0
- package/src/components/molecules/Textarea/Textarea.test.ts +191 -0
- package/src/components/molecules/TimelineEvent/TimelineEvent.stories.ts +319 -0
- package/src/components/molecules/TimelineEvent/TimelineEvent.test.ts +224 -0
- package/src/components/molecules/TimelineLanes/TimelineLanes.stories.ts +29 -0
- package/src/components/molecules/TimelineLanes/TimelineLanes.test.ts +30 -0
- package/src/components/molecules/Toast/Toast.stories.ts +110 -0
- package/src/components/molecules/Toast/Toast.test.ts +103 -0
- package/src/components/molecules/ToggleGroup/ToggleGroup.stories.ts +297 -0
- package/src/components/molecules/ToggleGroup/ToggleGroup.test.ts +578 -0
- package/src/components/molecules/Tree/Tree.stories.ts +884 -0
- package/src/components/molecules/Tree/Tree.test.ts +1247 -0
- package/src/components/molecules/Tree/tree-drop.test.ts +223 -0
- package/src/components/organisms/Calendar/Calendar.stories.ts +108 -0
- package/src/components/organisms/Calendar/Calendar.test.ts +279 -0
- package/src/components/organisms/Calendar/_CalendarDayView.test.ts +104 -0
- package/src/components/organisms/Calendar/_CalendarHeader.test.ts +86 -0
- package/src/components/organisms/Calendar/_CalendarMonthView.test.ts +52 -0
- package/src/components/organisms/Calendar/_CalendarTimePicker.test.ts +89 -0
- package/src/components/organisms/Calendar/_CalendarYearView.test.ts +56 -0
- package/src/components/organisms/ColorPicker/ColorPicker.stories.ts +229 -0
- package/src/components/organisms/ColorPicker/ColorPicker.test.ts +696 -0
- package/src/components/organisms/ColorPicker/ColorPicker.vue +12 -3
- package/src/components/organisms/ColorPicker/gradient.test.ts +67 -0
- package/src/components/organisms/ColorPicker/gradientGeometry.test.ts +206 -0
- package/src/components/organisms/Combobox/Combobox.stories.ts +234 -0
- package/src/components/organisms/Combobox/Combobox.test.ts +512 -0
- package/src/components/organisms/Combobox/Combobox.vue +1 -1
- package/src/components/organisms/ComboboxPanel/ComboboxPanel.stories.ts +158 -0
- package/src/components/organisms/ComboboxPanel/ComboboxPanel.test.ts +524 -0
- package/src/components/organisms/ComboboxPanel/ComboboxPanel.vue +1 -1
- package/src/components/organisms/CountrySelect/CountrySelect.stories.ts +139 -0
- package/src/components/organisms/CountrySelect/CountrySelect.test.ts +149 -0
- package/src/components/organisms/DatePicker/DatePicker.stories.ts +163 -0
- package/src/components/organisms/DatePicker/DatePicker.test.ts +214 -0
- package/src/components/organisms/DropdownButton/DropdownButton.stories.ts +123 -0
- package/src/components/organisms/DropdownButton/DropdownButton.test.ts +379 -0
- package/src/components/organisms/FontPicker/FontPicker.stories.ts +476 -0
- package/src/components/organisms/FontPicker/FontPicker.test.ts +873 -0
- package/src/components/organisms/Header/Header.stories.ts +75 -0
- package/src/components/organisms/Header/Header.test.ts +233 -0
- package/src/components/organisms/IconPicker/IconPicker.stories.ts +734 -0
- package/src/components/organisms/IconPicker/IconPicker.test.ts +669 -0
- package/src/components/organisms/IconPicker/_IconPickerGrid.test.ts +184 -0
- package/src/components/organisms/IconPicker/_IconPickerRail.test.ts +102 -0
- package/src/components/organisms/IconPicker/useIconPickerNavigation.test.ts +215 -0
- package/src/components/organisms/Modal/Modal.stories.ts +350 -0
- package/src/components/organisms/Modal/Modal.test.ts +275 -0
- package/src/components/organisms/PickerPanel/PickerPanel.stories.ts +452 -0
- package/src/components/organisms/PickerPanel/PickerPanel.test.ts +358 -0
- package/src/components/organisms/ProgressBar/ProgressBar.stories.ts +100 -0
- package/src/components/organisms/ProgressBar/ProgressBar.test.ts +417 -0
- package/src/components/organisms/ReferenceCard/ReferenceCard.stories.ts +191 -0
- package/src/components/organisms/ReferenceCard/ReferenceCard.test.ts +165 -0
- package/src/components/organisms/SocialMediaTemplate/SocialMediaTemplate.stories.ts +65 -0
- package/src/components/organisms/SocialMediaTemplate/SocialMediaTemplate.test.ts +466 -0
- package/src/components/organisms/StepperHeader/StepperHeader.stories.ts +91 -0
- package/src/components/organisms/StepperHeader/StepperHeader.test.ts +279 -0
- package/src/components/organisms/Table/Table.stories.ts +332 -0
- package/src/components/organisms/Table/Table.test.ts +320 -0
- package/src/components/organisms/TimelinePhaseblock/TimelinePhaseblock.stories.ts +198 -0
- package/src/components/organisms/TimelinePhaseblock/TimelinePhaseblock.test.ts +283 -0
- package/src/components/organisms/TimelineTrack/TimelineTrack.stories.ts +120 -0
- package/src/components/organisms/TimelineTrack/TimelineTrack.test.ts +91 -0
- package/src/components/organisms/Toaster/Toaster.stories.ts +51 -0
- package/src/components/organisms/Toaster/Toaster.test.ts +75 -0
- package/src/components/organisms/VideoControls/VideoControls.stories.ts +792 -0
- package/src/components/organisms/VideoControls/VideoControls.test.ts +1056 -0
- package/src/components/organisms/VideoPlayer/VideoPlayer.stories.ts +327 -0
- 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
|
+
})
|