Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Mar 29, 2022
1 parent 9ce578e commit 3a77edc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ describe('themeConfig', () => {
expect(() =>
testValidateThemeConfig(config),
).toThrowErrorMatchingInlineSnapshot(
`"Navbar items with only HTML contents are not allowed"`,
`"Navbar items only HTML contents are not allowed"`,
);
});

Expand Down
8 changes: 3 additions & 5 deletions packages/docusaurus-theme-classic/src/validateThemeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,17 @@ const DefaultNavbarItemSchema = NavbarItemBaseSchema.append({
'any.unknown': 'Nested dropdowns are not allowed',
}),
html: Joi.forbidden().messages({
'any.unknown': 'Navbar items with only HTML contents are not allowed',
'any.unknown': 'Navbar items with HTML contents are not allowed',
}),
})
.xor('href', 'to')
.xor('href', 'to', 'html')
.messages({
'object.xor': 'One and only one between "to" and "href" should be provided',
});

const DefaultDropdownSubitemSchema = DefaultNavbarItemSchema.append({
html: Joi.string(),
})
.xor('href', 'to', 'html')
.nand('html', 'label');
}).nand('html', 'label');

const DocsVersionNavbarItemSchema = NavbarItemBaseSchema.append({
type: Joi.string().equal('docsVersion').required(),
Expand Down

0 comments on commit 3a77edc

Please sign in to comment.