mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-25 23:17:06 +02:00
feat(v2): headerlinks (#1074)
* feat(v2): headerlinks * fix test * nits * remove tictactoe: * headerIcon * nits * remove lang dropdown * fix failing test * search box * algolia search * use babel-eslint to resolve dynamic import * nits * favicon and title * Update .eslintignore
This commit is contained in:
parent
d4458b394c
commit
85336649d3
66 changed files with 1205 additions and 2292 deletions
|
@ -7,16 +7,32 @@
|
|||
|
||||
import path from 'path';
|
||||
import loadConfig from '@lib/load/config';
|
||||
import loadSetup from '../loadSetup';
|
||||
|
||||
describe('loadConfig', () => {
|
||||
test('website with valid siteConfig', () => {
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'simple-site');
|
||||
test('website with valid siteConfig', async () => {
|
||||
const {siteDir} = await loadSetup('simple');
|
||||
const config = loadConfig(siteDir);
|
||||
expect(config).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"baseUrl": "/",
|
||||
"customDocsPath": "docs",
|
||||
"docsUrl": "docs",
|
||||
"favicon": "img/docusaurus.ico",
|
||||
"headerIcon": "img/docusaurus.svg",
|
||||
"headerLinks": Array [
|
||||
Object {
|
||||
"doc": "foo/bar",
|
||||
"label": "Docs",
|
||||
},
|
||||
Object {
|
||||
"label": "Hello",
|
||||
"page": "hello/world",
|
||||
},
|
||||
Object {
|
||||
"languages": true,
|
||||
},
|
||||
],
|
||||
"organizationName": "endiliey",
|
||||
"projectName": "hello",
|
||||
"tagline": "Hello World",
|
||||
|
@ -32,7 +48,7 @@ Object {
|
|||
expect(() => {
|
||||
loadConfig(siteDir);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"tagline, organizationName, projectName, url fields are missing in siteConfig.js"`,
|
||||
`"tagline, organizationName, projectName, url, headerLinks, headerIcon, favicon fields are missing in siteConfig.js"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -41,7 +57,7 @@ Object {
|
|||
expect(() => {
|
||||
loadConfig(siteDir);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"useLessField fields are useless in siteConfig.js"`,
|
||||
`"headerLinks, headerIcon, favicon fields are missing in siteConfig.js"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -50,7 +66,7 @@ Object {
|
|||
expect(() => {
|
||||
loadConfig(siteDir);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"title, tagline, organizationName, projectName, baseUrl, url fields are missing in siteConfig.js"`,
|
||||
`"title, tagline, organizationName, projectName, baseUrl, url, headerLinks, headerIcon, favicon fields are missing in siteConfig.js"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue