mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
test(Collapsible): add
This commit is contained in:
12
test/components/Collapsible.spec.ts
Normal file
12
test/components/Collapsible.spec.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import Collapsible, { type CollapsibleProps } from '../../src/runtime/components/Collapsible.vue'
|
||||
import ComponentRender from '../component-render'
|
||||
|
||||
describe('Collapsible', () => {
|
||||
it.each([
|
||||
['basic case', { props: { open: true }, slots: { default: () => 'Click me', content: () => 'Collapsible content' } }]
|
||||
])('renders %s correctly', async (nameOrHtml: string, options: { props?: CollapsibleProps, slots?: any }) => {
|
||||
const html = await ComponentRender(nameOrHtml, options, Collapsible)
|
||||
expect(html).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
6
test/components/__snapshots__/Collapsible.spec.ts.snap
Normal file
6
test/components/__snapshots__/Collapsible.spec.ts.snap
Normal file
@@ -0,0 +1,6 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`Collapsible > renders basic case correctly 1`] = `
|
||||
"<div data-state="open">Click me<div class="data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden" id="radix-vue-collapsible-content-1" data-state="open" style="--radix-collapsible-content-height: 0px; --radix-collapsible-content-width: 0px; transition-duration: 0s; animation-name: none;">Collapsible content</div>
|
||||
</div>"
|
||||
`;
|
||||
Reference in New Issue
Block a user