From 3f48fdae8d31e188d60b864edd452163ae726109 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 24 Oct 2024 16:27:39 +0200 Subject: [PATCH] test(Table): import from `#components` to resolve components --- test/components/Table.spec.ts | 10 +- .../__snapshots__/Table.spec.ts.snap | 125 +++++++++++++----- 2 files changed, 94 insertions(+), 41 deletions(-) diff --git a/test/components/Table.spec.ts b/test/components/Table.spec.ts index 0e1951c7..8d1fe534 100644 --- a/test/components/Table.spec.ts +++ b/test/components/Table.spec.ts @@ -1,5 +1,6 @@ -import { h, resolveComponent } from 'vue' +import { h } from 'vue' import { describe, it, expect } from 'vitest' +import { UCheckbox, UButton, UBadge, UDropdownMenu } from '#components' import Table, { type TableProps, type TableSlots, type TableColumn } from '../../src/runtime/components/Table.vue' import ComponentRender from '../component-render' import theme from '#build/ui/table' @@ -8,11 +9,6 @@ describe('Table', () => { const loadingColors = Object.keys(theme.variants.loadingColor) as any const loadingAnimations = Object.keys(theme.variants.loadingAnimation) as any - const UButton = resolveComponent('UButton') - const UCheckbox = resolveComponent('UCheckbox') - const UBadge = resolveComponent('UBadge') - const UDropdownMenu = resolveComponent('UDropdownMenu') - const data = [{ id: 'm5gr84i9', amount: 316, @@ -130,7 +126,7 @@ describe('Table', () => { label: 'View payment details' }] - return h('div', { class: 'text-right' }, h(UDropdownMenu, { + return h('div', { class: 'text-right' }, h(UDropdownMenu, { content: { align: 'end' }, diff --git a/test/components/__snapshots__/Table.spec.ts.snap b/test/components/__snapshots__/Table.spec.ts.snap index 53a20fe7..9220d4c0 100644 --- a/test/components/__snapshots__/Table.spec.ts.snap +++ b/test/components/__snapshots__/Table.spec.ts.snap @@ -58,14 +58,21 @@ exports[`Table > renders with columns correctly 1`] = ` - +
+
+ +
+ +
# Date Status - - - +
Amount
@@ -77,13 +84,18 @@ exports[`Table > renders with columns correctly 1`] = ` - +
+
+ +
+ +
#m5gr84i9 Invalid Date - - - + success
ken99@yahoo.com
@@ -91,21 +103,31 @@ exports[`Table > renders with columns correctly 1`] = `
€316.00
-
- +
+ + +
- +
+
+ +
+ +
#3u1reuv4 Invalid Date - - - + success
Abe45@gmail.com
@@ -113,21 +135,31 @@ exports[`Table > renders with columns correctly 1`] = `
€242.00
-
- +
+ + +
- +
+
+ +
+ +
#derv1ws0 Invalid Date - - - + processing
Monserrat44@gmail.com
@@ -135,21 +167,31 @@ exports[`Table > renders with columns correctly 1`] = `
€837.00
-
- +
+ + +
- +
+
+ +
+ +
#5kma53ae Invalid Date - - - + success
Silas22@gmail.com
@@ -157,21 +199,31 @@ exports[`Table > renders with columns correctly 1`] = `
€874.00
-
- +
+ + +
- +
+
+ +
+ +
#bhqecj4p Invalid Date - - - + failed
carmella@hotmail.com
@@ -179,8 +231,13 @@ exports[`Table > renders with columns correctly 1`] = `
€721.00
-
- +
+ + +