mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
add basic tests for sidebar_key front matter wiring
This commit is contained in:
parent
8e576021dc
commit
b76a6e62e1
|
|
@ -91,6 +91,7 @@ exports[`DefaultSidebarItemsGenerator generates simple flat sidebar 1`] = `
|
|||
"custom": "prop",
|
||||
},
|
||||
"id": "doc1",
|
||||
"key": "doc1-sidebar-key",
|
||||
"label": "doc1 sidebar label",
|
||||
"type": "doc",
|
||||
},
|
||||
|
|
@ -120,6 +121,7 @@ exports[`DefaultSidebarItemsGenerator generates subfolder sidebar 1`] = `
|
|||
"type": "doc",
|
||||
},
|
||||
],
|
||||
"key": "doc1-sidebar-key",
|
||||
"label": "Subsubsubfolder category label",
|
||||
"link": {
|
||||
"id": "doc1",
|
||||
|
|
@ -142,6 +144,7 @@ exports[`DefaultSidebarItemsGenerator generates subfolder sidebar 1`] = `
|
|||
},
|
||||
{
|
||||
"id": "doc1",
|
||||
"key": "doc1-sidebar-key",
|
||||
"type": "doc",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
sourceDirName: '.',
|
||||
sidebarPosition: 2,
|
||||
frontMatter: {
|
||||
sidebar_key: 'doc1-sidebar-key',
|
||||
sidebar_label: 'doc1 sidebar label',
|
||||
sidebar_custom_props: {custom: 'prop'},
|
||||
},
|
||||
|
|
@ -254,7 +255,9 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
sourceDirName: 'subfolder/subsubfolder',
|
||||
title: 'Subsubsubfolder category label',
|
||||
sidebarPosition: undefined,
|
||||
frontMatter: {},
|
||||
frontMatter: {
|
||||
sidebar_key: 'doc1-sidebar-key',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'doc2',
|
||||
|
|
|
|||
|
|
@ -147,12 +147,12 @@ Available doc IDs:
|
|||
} = getDoc(id);
|
||||
return {
|
||||
type: 'doc',
|
||||
key,
|
||||
id,
|
||||
position,
|
||||
source: fileName,
|
||||
// We don't want these fields to magically appear in the generated
|
||||
// sidebar
|
||||
...(key !== undefined && {key}),
|
||||
...(label !== undefined && {label}),
|
||||
...(className !== undefined && {className}),
|
||||
...(customProps !== undefined && {customProps}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue