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-grid-navigation.html 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>reveal.js - Test Grid</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="reveal" style="display: none;">
  14. <div class="slides">
  15. <section>0</section>
  16. <section>
  17. <section>1.1</section>
  18. <section>1.2</section>
  19. <section>1.3</section>
  20. <section>1.4</section>
  21. </section>
  22. <section>
  23. <section>2.1</section>
  24. <section>2.2</section>
  25. <section>2.3</section>
  26. <section>2.4</section>
  27. </section>
  28. </div>
  29. </div>
  30. <script src="../dist/reveal.js"></script>
  31. <script>
  32. QUnit.config.testTimeout = 30000;
  33. QUnit.config.autostart = false;
  34. QUnit.module( 'Grid Navigation' );
  35. Reveal.initialize().then( () => {
  36. QUnit.start();
  37. QUnit.test( 'Disabled', function( assert ) {
  38. Reveal.right();
  39. Reveal.down();
  40. Reveal.down();
  41. assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
  42. Reveal.right();
  43. assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: undefined }, 'Moves to top when going to adjacent stack' );
  44. });
  45. QUnit.test( 'Enabled', function( assert ) {
  46. Reveal.configure({ navigationMode: 'grid' });
  47. Reveal.slide( 0, 0 );
  48. Reveal.right();
  49. Reveal.down();
  50. Reveal.down();
  51. assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
  52. Reveal.right();
  53. assert.deepEqual( Reveal.getIndices(), { h: 2, v: 2, f: undefined }, 'Remains at same vertical index when going to adjacent stack' );
  54. });
  55. } );
  56. </script>
  57. </body>
  58. </html>