fix(v2): doc path special char (space or other) should lead to a valid slug (#3262)

* doc path special char (space or other) should lead to a valid slug

* doc path special char (space or other) should lead to a valid slug

* improve doc bad slug message
This commit is contained in:
Sébastien Lorber 2020-08-11 17:20:51 +02:00 committed by GitHub
parent b75a7150b2
commit dd3f3f1093
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 3 deletions

View file

@ -15,6 +15,13 @@ describe('getSlug', () => {
);
});
// See https://github.com/facebook/docusaurus/issues/3223
test('should handle special chars in doc path', () => {
expect(
getSlug({baseID: 'my dôc', dirName: '/dir with spâce/hey $hello'}),
).toEqual('/dir with spâce/hey $hello/my dôc');
});
test('should handle current dir', () => {
expect(getSlug({baseID: 'doc', dirName: '.'})).toEqual('/doc');
expect(getSlug({baseID: 'doc', dirName: '/'})).toEqual('/doc');