unit tests for plugins in multi-instance reveal.js

This commit is contained in:
Hakim El Hattab 2020-04-17 11:03:35 +02:00
parent 4f6bdf1420
commit 7e72b10fa5
2 changed files with 20 additions and 2 deletions

View file

@ -37,13 +37,15 @@
</div>
<script src="../dist/reveal.es5.js"></script>
<script src="../dist/plugin/zoom.js"></script>
<script>
QUnit.module( 'Multiple reveal.js instances' );
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
embedded: true,
keyboard: true
keyboard: true,
plugins: [RevealZoom]
} );
r1.initialize();
@ -70,6 +72,13 @@
});
QUnit.test( 'Can register plugins independently', function( assert ) {
assert.ok( r1.hasPlugin( 'zoom' ) );
assert.notOk( r2.hasPlugin( 'zoom' ) );
});
</script>
</body>

View file

@ -39,12 +39,14 @@
<script type="module">
import Reveal from '../dist/reveal.js';
import Zoom from '../plugin/zoom/zoom.js';
QUnit.module( 'Multiple reveal.js instances' );
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
embedded: true,
keyboard: true
keyboard: true,
plugins: [Zoom]
} );
r1.initialize();
@ -71,6 +73,13 @@
});
QUnit.test( 'Can register plugins independently', function( assert ) {
assert.ok( r1.hasPlugin( 'zoom' ) );
assert.notOk( r2.hasPlugin( 'zoom' ) );
});
</script>
<script>
QUnit.test( 'Reveal does not leak to window', function( assert ) {