docsify/test/integration/docs.test.js
Joe Pea 136e666e78 Merge branch 'develop' into fix-validating-remote-content-2
* develop: (104 commits)
  chore: bump ssri from 6.0.1 to 6.0.2 (#1563)
  chore: Update Edit Document using develop branch (#1541)
  fix: Add escapeHtml for search (#1551)
  docs: link with plugin Pagination (#1554)
  fix: Upgrade dompurify from 2.2.6 to 2.2.7 (#1553)
  fix: upgrade dompurify from 2.2.6 to 2.2.7 (#1552)
  chore: bump y18n from 4.0.0 to 4.0.1 (#1548)
  chore: Fix search for missing pathNamespaces (#1547)
  fix: Upgrade docsify from 4.12.0 to 4.12.1 (#1544)
  docs:Update deploy, change Zeit to Vercel (#1540)
  fix: Cannot read property 'classList' of null (#1527)
  chore: fix microsoft/playwright-github-action error (#1534)
  Update PULL_REQUEST_TEMPLATE.md
  chore: Update CHANGELOG and Update test snapshots
  chore: add changelog 4.12.1
  [build] 4.12.1
  feat: Support search when there is no title (#1519)
  test(unit): add test cases on isExternal. (#1515)
  docs: Update Vercel logo link (#1520)
  fix: Upgrade docsify from 4.11.6 to 4.12.0 (#1518)
  ...
2021-05-04 01:59:38 -07:00

67 lines
1.8 KiB
JavaScript

import docsifyInit from '../helpers/docsify-init';
// Suite
// -----------------------------------------------------------------------------
describe('Docs Site', function () {
// Tests
// ---------------------------------------------------------------------------
test('coverpage renders and is unchanged', async () => {
// Override Math.random implementation to prevent random gradient values
// used as background image from causing test to fail
const mathSpy = jest.spyOn(Math, 'random').mockReturnValue(0.5);
await docsifyInit({
config: {
coverpage: 'docs/_coverpage.md',
},
markdown: {
homepage: '# Hello World',
},
waitForSelector: '.cover-main > *',
});
const coverpageElm = document.querySelector('section.cover');
// Test snapshots
expect(mathSpy).toHaveBeenCalled();
expect(coverpageElm).not.toBeNull();
expect(coverpageElm.outerHTML).toMatchSnapshot();
});
test('sidebar renders and is unchanged', async () => {
await docsifyInit({
config: {
loadSidebar: 'docs/_sidebar.md',
},
markdown: {
homepage: '# Hello World',
},
waitForSelector: '.sidebar-nav > ul',
});
const sidebarElm = document.querySelector('.sidebar');
// Test snapshots
expect(sidebarElm).not.toBeNull();
expect(sidebarElm.outerHTML).toMatchSnapshot();
});
test('navbar renders and is unchanged', async () => {
await docsifyInit({
config: {
loadNavbar: 'docs/_navbar.md',
},
markdown: {
homepage: '# Hello World',
},
waitForSelector: '.app-nav > ul',
});
const navbarElm = document.querySelector('nav.app-nav');
// Test snapshots
expect(navbarElm).not.toBeNull();
expect(navbarElm.outerHTML).toMatchSnapshot();
});
});