Skip to content

Commit

Permalink
feat(test): add content components tests files
Browse files Browse the repository at this point in the history
  • Loading branch information
aburii committed Dec 19, 2024
1 parent 2062378 commit e9c8ad1
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import ContentFloatingTocLinks from '../../src/runtime/components/content/ContentFloatingToc/ContentFloatingTocLinks.vue'

describe('ContentFloatingTocLinks', () => {
it('can mount component', async () => {
const html = await renderSuspended(ContentFloatingTocLinks)
expect(html.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import Index from '../../src/runtime/components/content/ContentFloatingToc/Index.vue'

describe('Index', () => {
it('can mount component', async () => {
const html = await renderSuspended(Index)
expect(html.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ContentFloatingTocLinks > can mount component 1`] = `
"<div id="test-wrapper">
<div>
<transition-stub enteractiveclass="transition-all duration-100 ease-in-out" enterfromclass="opacity-0" entertoclass="opacity-100" leaveactiveclass="transition-all duration-100 ease-in-out" leavefromclass="opacity-100" leavetoclass="opacity-0" mode="out-in" appear="false" persisted="false" css="true">
<!--v-if-->
</transition-stub>
</div>
</div>"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Index > can mount component 1`] = `
"<div id="test-wrapper">
<div class="fixed z-50 scale-[0.9] sm:scale-[0.6] transition-all duration-300 ease-in-out right-2 sm:right-6 top-1/2 -translate-y-1/2 origin-right hover:scale-110">
<div class="rounded-md mx-auto transition-all duration-300 ease-in-out p-0 border-transparent">
<nav class="overflow-y-auto cursor-pointer">
<div>
<div>
<transition-stub enteractiveclass="transition-all duration-100 ease-in-out" enterfromclass="opacity-0" entertoclass="opacity-100" leaveactiveclass="transition-all duration-100 ease-in-out" leavefromclass="opacity-100" leavetoclass="opacity-0" mode="out-in" appear="false" persisted="false" css="true">
<!--v-if-->
</transition-stub>
</div>
</div>
</nav>
</div>
</div>
</div>"
`;
10 changes: 10 additions & 0 deletions packages/nuxt/test/components/content/ContentNavigationTree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import ContentNavigationTree from '../../src/runtime/components/content/ContentNavigationTree.vue'

describe('ContentNavigationTree', () => {
it('can mount component', async () => {
const html = await renderSuspended(ContentNavigationTree)
expect(html.html()).toMatchSnapshot()
})
})
10 changes: 10 additions & 0 deletions packages/nuxt/test/components/content/ContentSurround.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import ContentSurround from '../../src/runtime/components/content/ContentSurround.vue'

describe('ContentSurround', () => {
it('can mount component', async () => {
const html = await renderSuspended(ContentSurround)
expect(html.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import ContentTocLinks from '../../src/runtime/components/content/ContentToc/ContentTocLinks.vue'

describe('ContentTocLinks', () => {
it('can mount component', async () => {
const html = await renderSuspended(ContentTocLinks)
expect(html.html()).toMatchSnapshot()
})
})
10 changes: 10 additions & 0 deletions packages/nuxt/test/components/content/ContentToc/Index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest'
import { renderSuspended } from '@nuxt/test-utils/runtime'
import Index from '../../src/runtime/components/content/ContentToc/Index.vue'

describe('Index', () => {
it('can mount component', async () => {
const html = await renderSuspended(Index)
expect(html.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ContentTocLinks > can mount component 1`] = `
"<div id="test-wrapper">
<ul class="space-y-2"></ul>
</div>"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Index > can mount component 1`] = `
"<div id="test-wrapper">
<div>
<h2 class="text-xs/4 font-bold">On This Page</h2>
<nav>
<ul class="space-y-2"></ul>
</nav>
</div>
</div>"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ContentSurround > can mount component 1`] = `
"<div id="test-wrapper">
<div class="p-4">
<div class="flex justify-between">
<!--v-if-->
<!--v-if-->
</div>
</div>
</div>"
`;

0 comments on commit e9c8ad1

Please sign in to comment.