-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
/
Copy pathnav.test.js
38 lines (35 loc) · 1004 Bytes
/
nav.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const docsifyInit = require('../helpers/docsify-init');
describe(`Navbar tests`, function() {
test('specify custom navbar element in config with nav_el', async () => {
const docsifyInitConfig = {
html: `
<html>
<body>
<nav id="mynav"></nav>
<div id="app"></nav>
</body>
</html>
`,
markdown: {
navbar: `
- [Foo](foo)
- [Bar](bar)
`,
homepage: `
# hello world
foo
`,
},
config: {
nav_el: '#mynav',
},
};
await docsifyInit(docsifyInitConfig);
// Check that our custom <nav> element contains nav links
let navHTML;
navHTML = await page.$eval('#mynav', el => el.innerHTML);
expect(navHTML).toMatch('<li><a href="#/foo" title="Foo">Foo</a></li>');
navHTML = await page.$eval('#mynav', el => el.innerHTML);
expect(navHTML).toMatch('<li><a href="#/bar" title="Bar">Bar</a></li>');
});
});