-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:harlan-zw/nuxt-seo into feat/docs-v…
…2-stable
- Loading branch information
Showing
24 changed files
with
2,379 additions
and
1,269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// @vitest-environment nuxt | ||
import { useBreadcrumbItems } from '#imports' | ||
import { mockNuxtImport } from '@nuxt/test-utils/runtime' | ||
import { afterEach, describe, expect, it, vi } from 'vitest' | ||
|
||
const { useRouterMock } = vi.hoisted(() => { | ||
return { | ||
useRouterMock: vi.fn().mockImplementation(() => { | ||
return { | ||
resolve: vi.fn().mockImplementation((s: string) => { | ||
if (s === '/') { | ||
return { matched: [{ name: 'index', title: 'Home' }] } | ||
} | ||
return { matched: [{ name: 'unknown' }] } | ||
}), | ||
currentRoute: { | ||
value: { | ||
path: '/', | ||
}, | ||
}, | ||
} | ||
}), | ||
} | ||
}) | ||
|
||
mockNuxtImport('useRouter', () => { | ||
return useRouterMock | ||
}) | ||
|
||
afterEach(() => { | ||
vi.resetAllMocks() | ||
}) | ||
|
||
describe('useBreadcrumbItems', () => { | ||
it('home', async () => { | ||
const breadcrumbs = useBreadcrumbItems() | ||
expect(breadcrumbs.value).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"ariaLabel": "Home", | ||
"current": true, | ||
"label": "Home", | ||
"to": "/", | ||
}, | ||
] | ||
`) | ||
}) | ||
it('subpath', async () => { | ||
// change the path | ||
useRouterMock.mockImplementation(() => { | ||
return { | ||
currentRoute: { | ||
value: { | ||
path: '/subpath', | ||
}, | ||
}, | ||
resolve(s: string) { | ||
if (s === '/subpath') { | ||
return { matched: [{ name: 'subpath', title: 'My subpath' }] } | ||
} | ||
return { matched: [{ name: 'index' }] } | ||
}, | ||
} | ||
}) | ||
const breadcrumbs = useBreadcrumbItems() | ||
expect(breadcrumbs.value).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"ariaLabel": "Home", | ||
"current": false, | ||
"label": "Home", | ||
"to": "/", | ||
}, | ||
{ | ||
"ariaLabel": "Subpath", | ||
"current": true, | ||
"label": "Subpath", | ||
"to": "/subpath", | ||
}, | ||
] | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script lang="ts" setup> | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<NuxtPage /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import NuxtSeo from '../../../src/module' | ||
|
||
export default defineNuxtConfig({ | ||
modules: [ | ||
NuxtSeo, | ||
'@nuxt/test-utils/module', | ||
], | ||
|
||
nitro: { | ||
prerender: { | ||
failOnError: false, | ||
}, | ||
}, | ||
|
||
compatibilityDate: '2024-08-07', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<h1>about</h1> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<h1>home</h1> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../../../.nuxt/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineVitestConfig } from '@nuxt/test-utils/config' | ||
|
||
export default defineVitestConfig({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../../.nuxt/tsconfig.json" | ||
} |