test-grid-navigation.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. Reveal.initialize().then( () => {
  33. QUnit.module( 'Grid Navigation' );
  34. QUnit.test( 'Disabled', function( assert ) {
  35. Reveal.right();
  36. Reveal.down();
  37. Reveal.down();
  38. assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
  39. Reveal.right();
  40. assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: undefined }, 'Moves to top when going to adjacent stack' );
  41. });
  42. QUnit.test( 'Enabled', function( assert ) {
  43. Reveal.configure({ navigationMode: 'grid' });
  44. Reveal.slide( 0, 0 );
  45. Reveal.right();
  46. Reveal.down();
  47. Reveal.down();
  48. assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
  49. Reveal.right();
  50. assert.deepEqual( Reveal.getIndices(), { h: 2, v: 2, f: undefined }, 'Remains at same vertical index when going to adjacent stack' );
  51. });
  52. } );
  53. </script>
  54. </body>
  55. </html>