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:
Endilie Yacop Sucipto 2018-10-28 16:32:19 +08:00 committed by GitHub
parent d4458b394c
commit 85336649d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 1205 additions and 2292 deletions

View file

@ -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"`,
);
});
});