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 | |
| 43 | QUnit.module( 'Multiple reveal.js instances' ); |
| 44 | |
| 45 | let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), { |
| 46 | embedded: true, |
| 47 | keyboard: true, |
| 48 | plugins: [RevealZoom()] |
| 49 | } ); |
| 50 | r1.initialize(); |
| 51 | |
| 52 | let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), { |
| 53 | embedded: true, |
| 54 | keyboard: false |
| 55 | } ); |
| 56 | r2.initialize(); |
| 57 | |
| 58 | QUnit.test( 'Can make independent changes', function( assert ) { |
| 59 | |
| 60 | r1.slide(1); |
| 61 | r2.slide(2); |
| 62 | assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' ); |
| 63 | assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' ); |
| 64 | |
| 65 | r2.toggleOverview( true ); |
| 66 | assert.strictEqual( r1.isOverview(), false ); |
| 67 | assert.strictEqual( r2.isOverview(), true ); |
| 68 | r2.toggleOverview( false ); |
| 69 | |
| 70 | assert.strictEqual( r1.getConfig().keyboard, true ); |
| 71 | assert.strictEqual( r2.getConfig().keyboard, false ); |
| 72 | |
| 73 | }); |
| 74 | |
| 75 | QUnit.test( 'Can register plugins independently', function( assert ) { |
| 76 | |
| 77 | assert.ok( r1.hasPlugin( 'zoom' ) ); |
| 78 | assert.notOk( r2.hasPlugin( 'zoom' ) ); |
| 79 | |
| 80 | }); |
| 81 | |
| 82 | </script> |
| 83 | |
| 84 | </body> |
| 85 | </html> |