Skip to content

Commit da36452

Browse files
committed
Fix basePath option
1 parent 4fec434 commit da36452

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

test/helpers/do-mock-ajax.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const stripIndent = require('common-tags/lib/stripIndent');
2222
function doMockAjax(markdownMap) {
2323
const mockAjax = jest.doMock(`${SRC_PATH}/core/fetch/ajax.js`, () => ({
2424
get: jest.fn(url => {
25+
url = new URL(url, TEST_URL).href;
26+
2527
const markdownMatch =
2628
markdownMap[
2729
Object.keys(markdownMap).find(key =>

test/helpers/docsify-init.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const axios = require('axios');
66
const prettier = require('prettier');
77
const stripIndent = require('common-tags/lib/stripIndent');
88

9-
const docsifyPATH = `${SRC_PATH}/core`; // JSDOM
9+
const docsifyPATH = `${SRC_PATH}/core/index.js`; // JSDOM
1010
const docsifyURL = `${LIB_URL}/docsify.js`; // Playwright
1111
const isJSDOM = 'window' in global;
1212
const isPlaywright = 'page' in global;
@@ -37,8 +37,7 @@ const isPlaywright = 'page' in global;
3737
async function docsifyInit(options = {}) {
3838
const defaults = {
3939
config: {
40-
// basePath: '/',
41-
basePath: TEST_URL,
40+
basePath: '/',
4241
el: '#app',
4342
},
4443
html: `

test/integration/__snapshots__/docs.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Docs Site coverpage renders and is unchanged 1`] = `
4-
"<section class=\\"cover show\\" style=\\"background: linear-gradient(to left bottom, hsl(127, 100%, 85%) 0%,hsl(127, 100%, 85%) 100%)\\"><div class=\\"mask\\"></div><div class=\\"cover-main\\"><p><img src=\\"http://127.0.0.1:3001/_media/icon.svg\\" data-origin=\\"_media/icon.svg\\" alt=\\"logo\\"></p><h1 id=\\"docsify-4114\\"><a href=\\"#/?id=docsify-4114\\" data-id=\\"docsify-4114\\" class=\\"anchor\\"><span>docsify <small>4.11.4</small></span></a></h1><blockquote>
4+
"<section class=\\"cover show\\" style=\\"background: linear-gradient(to left bottom, hsl(127, 100%, 85%) 0%,hsl(127, 100%, 85%) 100%)\\"><div class=\\"mask\\"></div><div class=\\"cover-main\\"><p><img src=\\"/_media/icon.svg\\" data-origin=\\"_media/icon.svg\\" alt=\\"logo\\"></p><h1 id=\\"docsify-4114\\"><a href=\\"#/?id=docsify-4114\\" data-id=\\"docsify-4114\\" class=\\"anchor\\"><span>docsify <small>4.11.4</small></span></a></h1><blockquote>
55
<p>A magical documentation site generator.</p></blockquote>
66
<ul><li>Simple and lightweight</li><li>No statically built html files</li><li>Multiple themes</li></ul><p><a href=\\"https://github.com/docsifyjs/docsify/\\" target=\\"_blank\\" rel=\\"noopener\\">GitHub</a>
77
<a href=\\"#/?id=docsify\\">Getting Started</a></p></div></section>"

test/integration/example.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ describe('Example Tests', function() {
1212
// // (See ./helpers/docsifyInit.js for details)
1313
// await docsifyInit({
1414
// config: {
15-
// basePath: `${TEST_URL}/docs/`,
15+
// basePath: `/docs`,
1616
// },
17-
// // _debug: true,
1817
// // _logHTML: true,
1918
// });
2019

@@ -84,7 +83,6 @@ describe('Example Tests', function() {
8483

8584
await docsifyInit({
8685
...docsifyInitConfig,
87-
// _debug: true,
8886
// _logHTML: true,
8987
});
9088

0 commit comments

Comments
 (0)