mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-24 12:07:58 +02:00
add unit tests for disabling pages translations
This commit is contained in:
parent
650f51662a
commit
2e9ae7f28c
2 changed files with 89 additions and 0 deletions
|
@ -70,6 +70,76 @@ exports[`docusaurus-plugin-content-pages loads simple pages 1`] = `
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`docusaurus-plugin-content-pages loads simple pages with french translations (translate: false) 1`] = `
|
||||
[
|
||||
{
|
||||
"permalink": "/fr/",
|
||||
"source": "@site/src/pages/index.js",
|
||||
"type": "jsx",
|
||||
},
|
||||
{
|
||||
"permalink": "/fr/typescript",
|
||||
"source": "@site/src/pages/typescript.tsx",
|
||||
"type": "jsx",
|
||||
},
|
||||
{
|
||||
"description": "Markdown index page",
|
||||
"editUrl": undefined,
|
||||
"frontMatter": {
|
||||
"custom_frontMatter": "added by parseFrontMatter",
|
||||
},
|
||||
"lastUpdatedAt": undefined,
|
||||
"lastUpdatedBy": undefined,
|
||||
"permalink": "/fr/hello/",
|
||||
"source": "@site/src/pages/hello/index.md",
|
||||
"title": "Index",
|
||||
"type": "mdx",
|
||||
"unlisted": false,
|
||||
},
|
||||
{
|
||||
"description": "my MDX page",
|
||||
"editUrl": undefined,
|
||||
"frontMatter": {
|
||||
"custom_frontMatter": "added by parseFrontMatter",
|
||||
"description": "my MDX page",
|
||||
"slug": "/custom-mdx/slug",
|
||||
"title": "MDX page",
|
||||
},
|
||||
"lastUpdatedAt": undefined,
|
||||
"lastUpdatedBy": undefined,
|
||||
"permalink": "/fr/custom-mdx/slug",
|
||||
"source": "@site/src/pages/hello/mdxPage.mdx",
|
||||
"title": "MDX page",
|
||||
"type": "mdx",
|
||||
"unlisted": false,
|
||||
},
|
||||
{
|
||||
"permalink": "/fr/hello/translatedJs",
|
||||
"source": "@site/src/pages/hello/translatedJs.js",
|
||||
"type": "jsx",
|
||||
},
|
||||
{
|
||||
"description": "translated Markdown page",
|
||||
"editUrl": undefined,
|
||||
"frontMatter": {
|
||||
"custom_frontMatter": "added by parseFrontMatter",
|
||||
},
|
||||
"lastUpdatedAt": undefined,
|
||||
"lastUpdatedBy": undefined,
|
||||
"permalink": "/fr/hello/translatedMd",
|
||||
"source": "@site/src/pages/hello/translatedMd.md",
|
||||
"title": undefined,
|
||||
"type": "mdx",
|
||||
"unlisted": false,
|
||||
},
|
||||
{
|
||||
"permalink": "/fr/hello/world",
|
||||
"source": "@site/src/pages/hello/world.js",
|
||||
"type": "jsx",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`docusaurus-plugin-content-pages loads simple pages with french translations 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
@ -47,6 +47,25 @@ describe('docusaurus-plugin-content-pages', () => {
|
|||
expect(pagesMetadata).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('loads simple pages with french translations (translate: false)', async () => {
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||
const context = await loadContext({siteDir, locale: 'fr'});
|
||||
context.i18n.localeConfigs.fr.translate = false;
|
||||
|
||||
const plugin = await pluginContentPages(
|
||||
context,
|
||||
validateOptions({
|
||||
validate: normalizePluginOptions,
|
||||
options: {
|
||||
path: 'src/pages',
|
||||
},
|
||||
}),
|
||||
);
|
||||
const pagesMetadata = await plugin.loadContent!();
|
||||
|
||||
expect(pagesMetadata).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('loads simple pages with last update', async () => {
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||
const context = await loadContext({siteDir});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue