feat(ContextMenu): handle size prop (#130)

This commit is contained in:
Silver343
2024-07-02 09:26:23 +01:00
committed by GitHub
parent bad2e49de9
commit aa832f32a0
6 changed files with 156 additions and 15 deletions

View File

@@ -1,9 +1,12 @@
import { describe, it, expect } from 'vitest'
import ContextMenu, { type ContextMenuProps, type ContextMenuSlots } from '../../src/runtime/components/ContextMenu.vue'
import ComponentRender from '../component-render'
import theme from '#build/ui/context-menu'
// FIXME: Can't force open state
describe('ContextMenu', () => {
const sizes = Object.keys(theme.variants.size as any)
const items = [
[{
label: 'Appearance',
@@ -78,6 +81,7 @@ describe('ContextMenu', () => {
// Props
['with items', { props }],
['with disabled', { props: { ...props, disabled: true } }],
...sizes.map((size: string) => [`with size ${size}`, { props: { ...props, size } }]),
['with class', { props: { ...props, class: 'min-w-96' } }],
['with ui', { props: { ...props, ui: { itemLeadingIcon: 'size-4' } } }],
// Slots

View File

@@ -114,6 +114,71 @@ exports[`ContextMenu > renders with items correctly 1`] = `
<!--teleport end-->"
`;
exports[`ContextMenu > renders with size lg correctly 1`] = `
"<!--v-if-->
<!--teleport start-->
<!---->
<!--teleport end-->"
`;
exports[`ContextMenu > renders with size md correctly 1`] = `
"<!--v-if-->
<!--teleport start-->
<!---->
<!--teleport end-->"
`;
exports[`ContextMenu > renders with size sm correctly 1`] = `
"<!--v-if-->
<!--teleport start-->
<!---->
<!--teleport end-->"
`;
exports[`ContextMenu > renders with size xl correctly 1`] = `
"<!--v-if-->
<!--teleport start-->
<!---->
<!--teleport end-->"
`;
exports[`ContextMenu > renders with size xs correctly 1`] = `
"<!--v-if-->
<!--teleport start-->
<!---->
<!--teleport end-->"
`;