File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,34 @@ const docsifyInit = require('../helpers/docsify-init');
55describe ( 'Docsify' , function ( ) {
66 // Tests
77 // ---------------------------------------------------------------------------
8+ it ( 'global APIs are available' , async ( ) => {
9+ await docsifyInit ( ) ;
10+
11+ // If the script was built successfully for production, then it should load
12+ // and the following APIs should be available:
13+ expect ( await page . evaluate ( ( ) => typeof window . Docsify ) ) . toEqual ( 'object' ) ;
14+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . util ) ) . toEqual (
15+ 'object'
16+ ) ;
17+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . dom ) ) . toEqual (
18+ 'object'
19+ ) ;
20+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . get ) ) . toEqual (
21+ 'function'
22+ ) ;
23+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . slugify ) ) . toEqual (
24+ 'function'
25+ ) ;
26+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . version ) ) . toEqual (
27+ 'string'
28+ ) ;
29+ expect ( await page . evaluate ( ( ) => typeof window . DocsifyCompiler ) ) . toEqual (
30+ 'function'
31+ ) ;
32+ expect ( await page . evaluate ( ( ) => typeof window . marked ) ) . toEqual ( 'function' ) ;
33+ expect ( await page . evaluate ( ( ) => typeof window . Prism ) ) . toEqual ( 'object' ) ;
34+ } ) ;
35+
836 test ( 'allows $docsify configuration to be a function' , async ( ) => {
937 const testConfig = jest . fn ( vm => {
1038 expect ( vm ) . toBeInstanceOf ( Object ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ import initGlobalAPI from '../../src/core/global-api.js';
22
33// Suite
44// -----------------------------------------------------------------------------
5- describe ( 'Global APIs ' , function ( ) {
5+ describe ( 'initGlobalAPI ' , function ( ) {
66 // Tests
77 // ---------------------------------------------------------------------------
8- test ( 'APIs are available' , ( ) => {
8+ test ( 'it makes Docsify APIs available globally ' , ( ) => {
99 initGlobalAPI ( ) ;
1010
1111 expect ( typeof window . Docsify ) . toEqual ( 'object' ) ;
You can’t perform that action at this time.
0 commit comments