Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 1 | <!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>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 src="../dist/reveal.js"></script> |
| 40 | <script src="../plugin/zoom/zoom.js"></script> |
| 41 | <script> |
| 42 | |
Marc Kupietz | 09b7575 | 2023-10-07 09:32:19 +0200 | [diff] [blame] | 43 | QUnit.config.testTimeout = 30000; |
Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 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: [RevealZoom()] |
| 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 | </script> |
| 84 | |
| 85 | </body> |
| 86 | </html> |