Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

test-multiple-instances-es5.html 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>reveal.js - Test Iframes</title>
  6. <link rel="stylesheet" href="../dist/reveal.css">
  7. <link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
  8. <script src="../node_modules/qunit/qunit/qunit.js"></script>
  9. </head>
  10. <body style="overflow: auto;">
  11. <div id="qunit"></div>
  12. <div id="qunit-fixture"></div>
  13. <div class="deck1">
  14. <div class="reveal" style="display: none;">
  15. <div class="slides">
  16. <section>1.1</section>
  17. <section>1.2</section>
  18. <section>1.3</section>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="deck2">
  23. <div class="reveal" style="display: none;">
  24. <div class="slides">
  25. <section>2.1</section>
  26. <section>2.2</section>
  27. <section>2.3</section>
  28. </div>
  29. </div>
  30. </div>
  31. <script src="../dist/reveal.js"></script>
  32. <script src="../plugin/zoom/zoom.js"></script>
  33. <script>
  34. QUnit.config.testTimeout = 30000;
  35. QUnit.module( 'Multiple reveal.js instances' );
  36. let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
  37. embedded: true,
  38. keyboard: true,
  39. plugins: [RevealZoom()]
  40. } );
  41. r1.initialize();
  42. let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), {
  43. embedded: true,
  44. keyboard: false
  45. } );
  46. r2.initialize();
  47. QUnit.test( 'Can make independent changes', function( assert ) {
  48. r1.slide(1);
  49. r2.slide(2);
  50. assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' );
  51. assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' );
  52. r2.toggleOverview( true );
  53. assert.strictEqual( r1.isOverview(), false );
  54. assert.strictEqual( r2.isOverview(), true );
  55. r2.toggleOverview( false );
  56. assert.strictEqual( r1.getConfig().keyboard, true );
  57. assert.strictEqual( r2.getConfig().keyboard, false );
  58. });
  59. QUnit.test( 'Can register plugins independently', function( assert ) {
  60. assert.ok( r1.hasPlugin( 'zoom' ) );
  61. assert.notOk( r2.hasPlugin( 'zoom' ) );
  62. });
  63. </script>
  64. </body>
  65. </html>