mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
* Fix: Cannot serve off `/.../index.html` Docsify must be hosted on a server that supports a default directory index (i.e. maps `/.../` -> `/.../index.html`). Some platforms do not support this, however. For example, HTML apps hosted on the popular game/software platform, Itch.io. This change supports hosting Docsify off an explicit path file, such as `/index.html`. It does this by: 1. Adding handling for paths like `index.html#/blah`, and 2. Normalising paths with fragments back to markdown paths For example, `http://example.org/index.html#/blah` would be mapped to `http://example.org/blah.md`. This fixes: https://github.com/docsifyjs/docsify/issues/427 * Add end-to-end test for index file hosting * Add code comments for explicit file changes * Add additional tests for index file hosting * Add additional tests for index file hosting * [wip] Attempt to switch tests to Jest * Add e2e test for new Jest test framework * Verify sidebar links use file hosting * Fix: endsWith() not supported for IE11 * Refactor: utility method moved to utility file * Fix IE11 error from use of String.includes() Co-authored-by: John Hildenbiddle <jhildenbiddle@users.noreply.github.com>
29 lines
809 B
JavaScript
29 lines
809 B
JavaScript
const docsifyInit = require('../helpers/docsify-init');
|
|
|
|
describe(`Index file hosting`, function() {
|
|
const sharedOptions = {
|
|
config: {
|
|
basePath: `${TEST_HOST}/docs/index.html#/`,
|
|
},
|
|
testURL: `${TEST_HOST}/docs/index.html#/`,
|
|
};
|
|
|
|
test('should serve from index file', async () => {
|
|
await docsifyInit(sharedOptions);
|
|
|
|
await expect(page).toHaveText(
|
|
'#main',
|
|
'A magical documentation site generator'
|
|
);
|
|
expect(page.url()).toMatch(/index\.html#\/$/);
|
|
});
|
|
|
|
test('should use index file links in sidebar from index file hosting', async () => {
|
|
await docsifyInit(sharedOptions);
|
|
|
|
await page.click('a[href="#/quickstart"]');
|
|
await expect(page).toHaveText('#main', 'Quick start');
|
|
expect(page.url()).toMatch(/index\.html#\/quickstart$/);
|
|
});
|
|
});
|