From 418ffb8426788a0b394a3cf806b37a395d6921e8 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 20 Mar 2024 14:03:33 +0100 Subject: [PATCH] test: update --- test/components/Input.spec.ts | 16 +- test/components/Link.spec.ts | 2 +- test/components/NavigationMenu.spec.ts | 4 +- test/components/Tooltip.spec.ts | 6 +- .../__snapshots__/Form.spec.ts.snap | 420 +++--------------- .../__snapshots__/Input.spec.ts.snap | 233 +++------- .../__snapshots__/NavigationMenu.spec.ts.snap | 90 ++-- .../__snapshots__/Tabs.spec.ts.snap | 16 +- .../__snapshots__/Tooltip.spec.ts.snap | 9 +- 9 files changed, 217 insertions(+), 579 deletions(-) diff --git a/test/components/Input.spec.ts b/test/components/Input.spec.ts index f0386eb8..4317e2c9 100644 --- a/test/components/Input.spec.ts +++ b/test/components/Input.spec.ts @@ -10,14 +10,14 @@ describe('Input', () => { ['with placeholder', { props: { placeholder: 'Enter your username' } }], ['with disabled', { props: { disabled: true } }], ['with required', { props: { required: true } }], - // ['with icon', { props: { icon: 'i-heroicons-battery-50-solid' } }], - // ['with leading and icon', { props: { leading: true, icon: 'i-heroicons-battery-50-solid' } }], - // ['with leadingIcon', { props: { leadingIcon: 'i-heroicons-battery-50-solid' } }], - // ['with loading icon', { props: { loading: true } }], - // ['with leading slot', { slots: { leading: () => 'leading slot' } }], - // ['with trailing and icon', { props: { trailing: true, icon: 'i-heroicons-battery-50-solid' } }], - // ['with trailingIcon', { props: { trailingIcon: 'i-heroicons-battery-50-solid' } }], - // ['with trailing slot', { slots: { leading: () => 'trailing slot' } }], + ['with icon', { props: { icon: 'i-heroicons-magnifying-glass' } }], + ['with leading and icon', { props: { leading: true, icon: 'i-heroicons-magnifying-glass' } }], + ['with leadingIcon', { props: { leadingIcon: 'i-heroicons-magnifying-glass' } }], + ['with loading icon', { props: { loading: true } }], + ['with leading slot', { slots: { leading: () => 'leading slot' } }], + ['with trailing and icon', { props: { trailing: true, icon: 'i-heroicons-magnifying-glass' } }], + ['with trailingIcon', { props: { trailingIcon: 'i-heroicons-magnifying-glass' } }], + ['with trailing slot', { slots: { leading: () => 'trailing slot' } }], ['with size', { props: { size: 'xs' as const } }], ['with color', { props: { color: 'red' as const } }], ['with variant', { props: { variant: 'outline' as const } }] diff --git a/test/components/Link.spec.ts b/test/components/Link.spec.ts index 0d9fc088..d79eca95 100644 --- a/test/components/Link.spec.ts +++ b/test/components/Link.spec.ts @@ -6,7 +6,7 @@ describe('Link', () => { it.each([ ['with as', { props: { as: 'div' } }], ['with to', { props: { to: '/' } }], - ['with type', { props: { type: 'submit' } }], + ['with type', { props: { type: 'submit' as const } }], ['with disabled', { props: { disabled: true } }], ['with activeClass', { props: { active: true, to: '/', activeClass: 'text-sm' } }], ['with inactiveClass', { props: { active: false, to: '/', inactiveClass: 'text-gray-300' } }] diff --git a/test/components/NavigationMenu.spec.ts b/test/components/NavigationMenu.spec.ts index f54d6358..feeb6cc3 100644 --- a/test/components/NavigationMenu.spec.ts +++ b/test/components/NavigationMenu.spec.ts @@ -26,8 +26,8 @@ describe('NavigationMenu', () => { it.each([ ['basic case', { props: { links } }], ['with vertical orientation', { props: { links, orientation: 'vertical' as const } }], - ['with class', { props: { class: 'w-48' } }], - ['with ui', { props: { ui: { icon: 'w-4 h-4' } } }] + ['with class', { props: { links, class: 'w-48' } }], + ['with ui', { props: { links, ui: { icon: 'w-4 h-4' } } }] ])('renders %s correctly', async (nameOrHtml: string, options: { props?: NavigationMenuProps, slots?: any }) => { const html = await ComponentRender(nameOrHtml, options, NavigationMenu) expect(html).toMatchSnapshot() diff --git a/test/components/Tooltip.spec.ts b/test/components/Tooltip.spec.ts index 4c723f50..8b1988e1 100644 --- a/test/components/Tooltip.spec.ts +++ b/test/components/Tooltip.spec.ts @@ -15,9 +15,9 @@ const TooltipWrapper = defineComponent({ describe('Tooltip', () => { it.each([ - ['with text', { props: { text: 'Tooltip', open: true }, slots: { default: () => 'Hover me' } }], - ['with arrow', { props: { text: 'Tooltip', arrow: true, open: true }, slots: { default: () => 'Hover me' } }], - ['with shortcuts', { props: { text: 'Tooltip', shortcuts: ['⌘', 'K'], open: true }, slots: { default: () => 'Hover me' } }] + ['with text', { props: { text: 'Tooltip', open: true } }], + ['with arrow', { props: { text: 'Tooltip', arrow: true, open: true } }], + ['with shortcuts', { props: { text: 'Tooltip', shortcuts: ['⌘', 'K'], open: true } }] ])('renders %s correctly', async (nameOrHtml: string, options: { props?: TooltipProps, slots?: any }) => { const html = await ComponentRender(nameOrHtml, options, TooltipWrapper) expect(html).toMatchSnapshot() diff --git a/test/components/__snapshots__/Form.spec.ts.snap b/test/components/__snapshots__/Form.spec.ts.snap index 62a9e095..94c0c09d 100644 --- a/test/components/__snapshots__/Form.spec.ts.snap +++ b/test/components/__snapshots__/Form.spec.ts.snap @@ -8,24 +8,9 @@ exports[`Form > custom validation works > with error 1`] = `
-
- +
+ +
@@ -38,24 +23,9 @@ exports[`Form > custom validation works > with error 1`] = `
-
- +
+ +

Must be at least 8 characters

@@ -73,24 +43,9 @@ exports[`Form > custom validation works > without error 1`] = `
-
- +
+ +
@@ -103,24 +58,9 @@ exports[`Form > custom validation works > without error 1`] = `
-
- +
+ +
@@ -138,24 +78,9 @@ exports[`Form > joi validation works > with error 1`] = `
-
- +
+ +
@@ -168,24 +93,9 @@ exports[`Form > joi validation works > with error 1`] = `
-
- +
+ +

Must be at least 8 characters

@@ -203,24 +113,9 @@ exports[`Form > joi validation works > without error 1`] = `
-
- +
+ +
@@ -233,24 +128,9 @@ exports[`Form > joi validation works > without error 1`] = `
-
- +
+ +
@@ -272,24 +152,9 @@ exports[`Form > valibot validation works > with error 1`] = `
-
- +
+ +
@@ -302,24 +167,9 @@ exports[`Form > valibot validation works > with error 1`] = `
-
- +
+ +

Must be at least 8 characters

@@ -337,24 +187,9 @@ exports[`Form > valibot validation works > without error 1`] = `
-
- +
+ +
@@ -367,24 +202,9 @@ exports[`Form > valibot validation works > without error 1`] = `
-
- +
+ +
@@ -402,24 +222,9 @@ exports[`Form > yup validation works > with error 1`] = `
-
- +
+ +
@@ -432,24 +237,9 @@ exports[`Form > yup validation works > with error 1`] = `
-
- +
+ +

Must be at least 8 characters

@@ -467,24 +257,9 @@ exports[`Form > yup validation works > without error 1`] = `
-
- +
+ +
@@ -497,24 +272,9 @@ exports[`Form > yup validation works > without error 1`] = `
-
- +
+ +
@@ -532,24 +292,9 @@ exports[`Form > zod validation works > with error 1`] = `
-
- +
+ +
@@ -562,24 +307,9 @@ exports[`Form > zod validation works > with error 1`] = `
-
- +
+ +

Must be at least 8 characters

@@ -597,24 +327,9 @@ exports[`Form > zod validation works > without error 1`] = `
-
- +
+ +
@@ -627,24 +342,9 @@ exports[`Form > zod validation works > without error 1`] = `
-
- +
+ +
diff --git a/test/components/__snapshots__/Input.spec.ts.snap b/test/components/__snapshots__/Input.spec.ts.snap index 370df1ba..065c5c9f 100644 --- a/test/components/__snapshots__/Input.spec.ts.snap +++ b/test/components/__snapshots__/Input.spec.ts.snap @@ -1,199 +1,112 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Input > renders basic case correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with color correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with disabled correctly 1`] = ` -"
- + +
" +`; - - - - - +exports[`Input > renders with icon correctly 1`] = ` +"
+ +
" +`; + +exports[`Input > renders with leading and icon correctly 1`] = ` +"
+ +
" +`; + +exports[`Input > renders with leading slot correctly 1`] = ` +"
leading slot + +
" +`; + +exports[`Input > renders with leadingIcon correctly 1`] = ` +"
+ +
" +`; + +exports[`Input > renders with loading icon correctly 1`] = ` +"
+
" `; exports[`Input > renders with name correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with placeholder correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with required correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with size correctly 1`] = ` -"
- + +
" +`; - - - - - +exports[`Input > renders with trailing and icon correctly 1`] = ` +"
+ +
" +`; + +exports[`Input > renders with trailing slot correctly 1`] = ` +"
trailing slot + +
" +`; + +exports[`Input > renders with trailingIcon correctly 1`] = ` +"
+
" `; exports[`Input > renders with type correctly 1`] = ` -"
- +"
+ +
" `; exports[`Input > renders with variant correctly 1`] = ` -"
- +"
+ +
" `; diff --git a/test/components/__snapshots__/NavigationMenu.spec.ts.snap b/test/components/__snapshots__/NavigationMenu.spec.ts.snap index ef527997..05d6b9d1 100644 --- a/test/components/__snapshots__/NavigationMenu.spec.ts.snap +++ b/test/components/__snapshots__/NavigationMenu.spec.ts.snap @@ -4,22 +4,22 @@ exports[`NavigationMenu > renders basic case correctly 1`] = ` "" +`; + +exports[`NavigationMenu > renders with class correctly 1`] = ` +"" +`; + +exports[`NavigationMenu > renders with ui correctly 1`] = ` +"" `; exports[`NavigationMenu > renders with vertical orientation correctly 1`] = ` -"