diff --git a/src/runtime/components/Container.vue b/src/runtime/components/Container.vue new file mode 100644 index 00000000..a0603b4c --- /dev/null +++ b/src/runtime/components/Container.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/src/runtime/theme/container.ts b/src/runtime/theme/container.ts new file mode 100644 index 00000000..6af6eae4 --- /dev/null +++ b/src/runtime/theme/container.ts @@ -0,0 +1,3 @@ +export default { + base: 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8' +} \ No newline at end of file diff --git a/test/components/Container.spec.ts b/test/components/Container.spec.ts new file mode 100644 index 00000000..89de4df4 --- /dev/null +++ b/test/components/Container.spec.ts @@ -0,0 +1,15 @@ +import { describe, it, expect } from 'vitest' +import Container, { type ContainerProps } from '../../src/runtime/components/Container.vue' +import ComponentRender from '../component-render' + +describe('Container', () => { + it.each([ + ['basic case', {}], + ['with as', { props: { as: 'article' } }], + ['with class', { props: { class: 'max-w-5xl' } }], + ['with default slot', { slots: { default: () => 'Default slot' } }] + ])('renders %s correctly', async (nameOrHtml: string, options: { props?: ContainerProps, slots?: any }) => { + const html = await ComponentRender(nameOrHtml, options, Container) + expect(html).toMatchSnapshot() + }) +}) \ No newline at end of file diff --git a/test/components/__snapshots__/Container.spec.ts.snap b/test/components/__snapshots__/Container.spec.ts.snap new file mode 100644 index 00000000..8034d5ee --- /dev/null +++ b/test/components/__snapshots__/Container.spec.ts.snap @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Container > renders basic case correctly 1`] = `"
"`; + +exports[`Container > renders with as correctly 1`] = `"
"`; + +exports[`Container > renders with class correctly 1`] = `"
"`; + +exports[`Container > renders with default slot correctly 1`] = `"
Default slot
"`;