Skip to content

Commit 93ea8a0

Browse files
committed
add test
1 parent f494147 commit 93ea8a0

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

test/e2e/search.test.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('Search Plugin Tests', function() {
1414
This is the homepage.
1515
`,
1616
sidebar: `
17-
- [Home page](/)
1817
- [Test Page](test)
1918
`,
2019
},
@@ -73,4 +72,38 @@ describe('Search Plugin Tests', function() {
7372
await page.fill('input[type=search]', 'repository2');
7473
await expect(page).toEqualText('.results-panel h2', 'GitHub Pages ignore2');
7574
});
75+
76+
test('search only one homepage', async () => {
77+
const docsifyInitConfig = {
78+
markdown: {
79+
sidebar: `
80+
- [README](README)
81+
- [Test Page](test)
82+
`,
83+
},
84+
routes: {
85+
'/README.md': `
86+
# Hello World
87+
88+
This is the homepage.
89+
`,
90+
'/test.md': `
91+
# Test Page
92+
93+
This is a custom route.
94+
`,
95+
},
96+
scriptURLs: ['/lib/plugins/search.js'],
97+
};
98+
99+
await docsifyInit(docsifyInitConfig);
100+
await page.fill('input[type=search]', 'hello');
101+
await expect(page).toEqualText('.results-panel h2', 'Hello World');
102+
// error
103+
await expect(page).toEqualText('.results-panel', 'Hello World');
104+
105+
await page.click('.clear-button');
106+
await page.fill('input[type=search]', 'test');
107+
await expect(page).toEqualText('.results-panel h2', 'Test Page');
108+
});
76109
});

0 commit comments

Comments
 (0)