Skip to content

Commit 6c2f00d

Browse files
committed
test(Badge): update tests
1 parent f59f4ea commit 6c2f00d

File tree

4 files changed

+41
-35
lines changed

4 files changed

+41
-35
lines changed

src/theme/badge.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ export default (options: Required<ModuleOptions>) => ({
5353
leadingAvatarSize: 'xs',
5454
trailingIcon: 'size-6'
5555
}
56+
},
57+
square: {
58+
true: ''
5659
}
5760
},
58-
square: {
59-
true: ''
60-
},
6161
compoundVariants: [...(options.theme.colors || []).map((color: string) => ({
6262
color,
6363
variant: 'solid',

test/components/Badge.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Badge', () => {
2121
['with avatar', { props: { avatar: { src: 'https://github.com/benjamincanac.png' } } }],
2222
['with avatar and leadingIcon', { props: { avatar: { src: 'https://github.com/benjamincanac.png' }, leadingIcon: 'i-lucide-arrow-left' } }],
2323
['with avatar and trailingIcon', { props: { avatar: { src: 'https://github.com/benjamincanac.png' }, trailingIcon: 'i-lucide-arrow-right' } }],
24-
['with square', { props: { label: 'Badge', square: true } }],
24+
['with square', { props: { icon: 'i-lucide-rocket', square: true } }],
2525
['with as', { props: { label: 'Badge', as: 'div' } }],
2626
['with class', { props: { label: 'Badge', class: 'rounded-full font-bold' } }],
2727
['with ui', { props: { label: 'Badge', ui: { label: 'font-bold' } } }],
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,108 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`Badge > renders with as correctly 1`] = `
4-
"<div class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted">
4+
"<div class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted">
55
<!--v-if--><span class="truncate">Badge</span>
66
<!--v-if-->
77
</div>"
88
`;
99

1010
exports[`Badge > renders with avatar and leadingIcon correctly 1`] = `
11-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
11+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
1212
<!--v-if-->
1313
<!--v-if--></span>"
1414
`;
1515

1616
exports[`Badge > renders with avatar and trailingIcon correctly 1`] = `
17-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-elevated size-4 text-[8px] shrink-0"><img role="img" src="https://github.com/benjamincanac.png" width="16" height="16" class="h-full w-full rounded-[inherit] object-cover"></span>
17+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img role="img" src="https://github.com/benjamincanac.png" width="20" height="20" class="h-full w-full rounded-[inherit] object-cover"></span>
1818
<!--v-if--><span class="iconify i-lucide:arrow-right shrink-0 size-4" aria-hidden="true"></span></span>"
1919
`;
2020
2121
exports[`Badge > renders with avatar correctly 1`] = `
22-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-elevated size-4 text-[8px] shrink-0"><img role="img" src="https://github.com/benjamincanac.png" width="16" height="16" class="h-full w-full rounded-[inherit] object-cover"></span>
22+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img role="img" src="https://github.com/benjamincanac.png" width="20" height="20" class="h-full w-full rounded-[inherit] object-cover"></span>
2323
<!--v-if-->
2424
<!--v-if--></span>"
2525
`;
2626
2727
exports[`Badge > renders with class correctly 1`] = `
28-
"<span class="inline-flex items-center text-xs px-2 py-1 gap-1 bg-primary text-inverted rounded-full font-bold"><!--v-if--><span class="truncate">Badge</span>
28+
"<span class="inline-flex items-center text-xs px-2 py-1.5 gap-1 bg-primary text-inverted rounded-full font-bold"><!--v-if--><span class="truncate">Badge</span>
2929
<!--v-if--></span>"
3030
`;
3131
32-
exports[`Badge > renders with default slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if-->Default slot<!--v-if--></span>"`;
32+
exports[`Badge > renders with default slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted"><!--v-if-->Default slot<!--v-if--></span>"`;
3333
3434
exports[`Badge > renders with icon correctly 1`] = `
35-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="iconify i-lucide:rocket shrink-0 size-4" aria-hidden="true"></span>
35+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="iconify i-lucide:rocket shrink-0 size-4" aria-hidden="true"></span>
3636
<!--v-if-->
3737
<!--v-if--></span>"
3838
`;
3939
4040
exports[`Badge > renders with label correctly 1`] = `
41-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
41+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
4242
<!--v-if--></span>"
4343
`;
4444
4545
exports[`Badge > renders with leading and icon correctly 1`] = `
46-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
46+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
4747
<!--v-if-->
4848
<!--v-if--></span>"
4949
`;
5050
51-
exports[`Badge > renders with leading slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted">Leading slot<!--v-if--><!--v-if--></span>"`;
51+
exports[`Badge > renders with leading slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5">Leading slot<!--v-if--><!--v-if--></span>"`;
5252
5353
exports[`Badge > renders with leadingIcon correctly 1`] = `
54-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
54+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="iconify i-lucide:arrow-left shrink-0 size-4" aria-hidden="true"></span>
5555
<!--v-if-->
5656
<!--v-if--></span>"
5757
`;
5858
5959
exports[`Badge > renders with neutral variant outline correctly 1`] = `
60-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md ring ring-inset ring-accented text-default bg-default"><!--v-if--><span class="truncate">Badge</span>
60+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md ring ring-inset ring-accented text-default bg-default"><!--v-if--><span class="truncate">Badge</span>
6161
<!--v-if--></span>"
6262
`;
6363
6464
exports[`Badge > renders with neutral variant soft correctly 1`] = `
65-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md text-default bg-elevated"><!--v-if--><span class="truncate">Badge</span>
65+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md text-default bg-elevated"><!--v-if--><span class="truncate">Badge</span>
6666
<!--v-if--></span>"
6767
`;
6868
6969
exports[`Badge > renders with neutral variant solid correctly 1`] = `
70-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md text-inverted bg-inverted"><!--v-if--><span class="truncate">Badge</span>
70+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md text-inverted bg-inverted"><!--v-if--><span class="truncate">Badge</span>
7171
<!--v-if--></span>"
7272
`;
7373
7474
exports[`Badge > renders with neutral variant subtle correctly 1`] = `
75-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md ring ring-inset ring-accented text-default bg-elevated"><!--v-if--><span class="truncate">Badge</span>
75+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md ring ring-inset ring-accented text-default bg-elevated"><!--v-if--><span class="truncate">Badge</span>
7676
<!--v-if--></span>"
7777
`;
7878
7979
exports[`Badge > renders with primary variant outline correctly 1`] = `
80-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md text-primary ring ring-inset ring-primary/50"><!--v-if--><span class="truncate">Badge</span>
80+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md text-primary ring ring-inset ring-primary/50"><!--v-if--><span class="truncate">Badge</span>
8181
<!--v-if--></span>"
8282
`;
8383
8484
exports[`Badge > renders with primary variant soft correctly 1`] = `
85-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary"><!--v-if--><span class="truncate">Badge</span>
85+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary"><!--v-if--><span class="truncate">Badge</span>
8686
<!--v-if--></span>"
8787
`;
8888
8989
exports[`Badge > renders with primary variant solid correctly 1`] = `
90-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
90+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
9191
<!--v-if--></span>"
9292
`;
9393
9494
exports[`Badge > renders with primary variant subtle correctly 1`] = `
95-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25"><!--v-if--><span class="truncate">Badge</span>
95+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25"><!--v-if--><span class="truncate">Badge</span>
9696
<!--v-if--></span>"
9797
`;
9898
9999
exports[`Badge > renders with size lg correctly 1`] = `
100-
"<span class="font-medium inline-flex items-center text-sm px-2 py-1 gap-1.5 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
100+
"<span class="font-medium inline-flex items-center text-sm px-2.5 py-2 gap-1.5 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
101101
<!--v-if--></span>"
102102
`;
103103
104104
exports[`Badge > renders with size md correctly 1`] = `
105-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
105+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
106106
<!--v-if--></span>"
107107
`;
108108
@@ -112,7 +112,7 @@ exports[`Badge > renders with size sm correctly 1`] = `
112112
`;
113113
114114
exports[`Badge > renders with size xl correctly 1`] = `
115-
"<span class="font-medium inline-flex items-center text-base px-2.5 py-1 gap-1.5 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
115+
"<span class="font-medium inline-flex items-center text-base px-3 py-2.5 gap-1.5 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate">Badge</span>
116116
<!--v-if--></span>"
117117
`;
118118
@@ -121,13 +121,19 @@ exports[`Badge > renders with size xs correctly 1`] = `
121121
<!--v-if--></span>"
122122
`;
123123
124-
exports[`Badge > renders with trailing and icon correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><!--v-if--><span class="iconify i-lucide:arrow-right shrink-0 size-4" aria-hidden="true"></span></span>"`;
124+
exports[`Badge > renders with square correctly 1`] = `
125+
"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><span class="iconify i-lucide:rocket shrink-0 size-4" aria-hidden="true"></span>
126+
<!--v-if-->
127+
<!--v-if--></span>"
128+
`;
129+
130+
exports[`Badge > renders with trailing and icon correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><!--v-if--><!--v-if--><span class="iconify i-lucide:arrow-right shrink-0 size-4" aria-hidden="true"></span></span>"`;
125131
126-
exports[`Badge > renders with trailing slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><!--v-if-->Trailing slot</span>"`;
132+
exports[`Badge > renders with trailing slot correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><!--v-if--><!--v-if-->Trailing slot</span>"`;
127133
128-
exports[`Badge > renders with trailingIcon correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><!--v-if--><span class="iconify i-lucide:arrow-right shrink-0 size-4" aria-hidden="true"></span></span>"`;
134+
exports[`Badge > renders with trailingIcon correctly 1`] = `"<span class="font-medium inline-flex items-center text-xs gap-1 rounded-md bg-primary text-inverted p-1.5"><!--v-if--><!--v-if--><span class="iconify i-lucide:arrow-right shrink-0 size-4" aria-hidden="true"></span></span>"`;
129135
130136
exports[`Badge > renders with ui correctly 1`] = `
131-
"<span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate font-bold">Badge</span>
137+
"<span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary text-inverted"><!--v-if--><span class="truncate font-bold">Badge</span>
132138
<!--v-if--></span>"
133139
`;

test/components/__snapshots__/Table.spec.ts.snap

+5-5
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ exports[`Table > renders with columns correctly 1`] = `
303303
</label></td>
304304
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">#m5gr84i9</td>
305305
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">Invalid Date</td>
306-
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
306+
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
307307
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">
308308
<div class="lowercase">[email protected]</div>
309309
</td>
@@ -332,7 +332,7 @@ exports[`Table > renders with columns correctly 1`] = `
332332
</label></td>
333333
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">#3u1reuv4</td>
334334
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">Invalid Date</td>
335-
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
335+
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
336336
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">
337337
<div class="lowercase">[email protected]</div>
338338
</td>
@@ -361,7 +361,7 @@ exports[`Table > renders with columns correctly 1`] = `
361361
</label></td>
362362
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">#derv1ws0</td>
363363
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">Invalid Date</td>
364-
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->processing<!--v-if--></span></td>
364+
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->processing<!--v-if--></span></td>
365365
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">
366366
<div class="lowercase">[email protected]</div>
367367
</td>
@@ -390,7 +390,7 @@ exports[`Table > renders with columns correctly 1`] = `
390390
</label></td>
391391
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">#5kma53ae</td>
392392
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">Invalid Date</td>
393-
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
393+
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-primary/10 text-primary ring ring-inset ring-primary/25 capitalize"><!--v-if-->success<!--v-if--></span></td>
394394
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">
395395
<div class="lowercase">[email protected]</div>
396396
</td>
@@ -419,7 +419,7 @@ exports[`Table > renders with columns correctly 1`] = `
419419
</label></td>
420420
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">#bhqecj4p</td>
421421
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">Invalid Date</td>
422-
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1 gap-1 rounded-md bg-error/10 text-error ring ring-inset ring-error/25 capitalize"><!--v-if-->failed<!--v-if--></span></td>
422+
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0"><span class="font-medium inline-flex items-center text-xs px-2 py-1.5 gap-1 rounded-md bg-error/10 text-error ring ring-inset ring-error/25 capitalize"><!--v-if-->failed<!--v-if--></span></td>
423423
<td data-pinned="false" class="p-4 text-sm text-muted whitespace-nowrap [&amp;:has([role=checkbox])]:pe-0">
424424
<div class="lowercase">[email protected]</div>
425425
</td>

0 commit comments

Comments
 (0)