blob: c831b625b848e00559c377ca89851b47f9eef926 [file] [log] [blame]
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +02001<!doctype html>
2<html lang="en">
3
4 <head>
5 <meta charset="utf-8">
6
7 <title>reveal.js - Test Iframes</title>
8
9 <link rel="stylesheet" href="../dist/reveal.css">
10 <link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
11 <script src="../node_modules/qunit/qunit/qunit.js"></script>
12 </head>
13
14 <body style="overflow: auto;">
15
16 <div id="qunit"></div>
17 <div id="qunit-fixture"></div>
18
19 <div class="deck1">
20 <div class="reveal" style="display: none;">
21 <div class="slides">
22 <section>1.1</section>
23 <section data-state="deck1slide2">1.2</section>
24 <section>1.3</section>
25 </div>
26 </div>
27 </div>
28
29 <div class="deck2">
30 <div class="reveal" style="display: none;">
31 <div class="slides">
32 <section>2.1</section>
33 <section>2.2</section>
34 <section>2.3</section>
35 </div>
36 </div>
37 </div>
38
39 <script type="module">
40
41 import Reveal from '../dist/reveal.esm.js';
42 import Zoom from '../plugin/zoom/zoom.esm.js';
43
44 QUnit.module( 'Multiple reveal.js instances' );
45
46 let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
47 embedded: true,
48 keyboard: true,
49 plugins: [ Zoom ]
50 } );
51 r1.initialize();
52
53 let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), {
54 embedded: true,
55 keyboard: false
56 } );
57 r2.initialize();
58
59 QUnit.test( 'Can make independent changes', function( assert ) {
60
61 r1.slide(1);
62 r2.slide(2);
63 assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' );
64 assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' );
65
66 r2.toggleOverview( true );
67 assert.strictEqual( r1.isOverview(), false );
68 assert.strictEqual( r2.isOverview(), true );
69 r2.toggleOverview( false );
70
71 assert.strictEqual( r1.getConfig().keyboard, true );
72 assert.strictEqual( r2.getConfig().keyboard, false );
73
74 });
75
76 QUnit.test( 'Can register plugins independently', function( assert ) {
77
78 assert.ok( r1.hasPlugin( 'zoom' ) );
79 assert.notOk( r2.hasPlugin( 'zoom' ) );
80
81 });
82
83 QUnit.test( 'Slide state is set at the viewport level', function( assert ) {
84
85 r1.slide(1);
86
87 assert.ok( r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ) );
88
89 r1.slide(2);
90
91 assert.ok( !r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ), 'unset' );
92
93 });
94
95 </script>
96 <script>
97 QUnit.test( 'Reveal does not leak to window', function( assert ) {
98 assert.strictEqual( window.Reveal, undefined );
99 });
100 </script>
101
102 </body>
103</html>