test-grid-navigation.html 1.7 KB

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="../css/reveal.css">
  7. <link rel="stylesheet" href="qunit-2.5.0.css">
  8. </head>
  9. <body style="overflow: auto;">
  10. <div id="qunit"></div>
  11. <div id="qunit-fixture"></div>
  12. <div class="reveal" style="display: none;">
  13. <div class="slides">
  14. <section>0</section>
  15. <section>
  16. <section>1.1</section>
  17. <section>1.2</section>
  18. <section>1.3</section>
  19. <section>1.4</section>
  20. </section>
  21. <section>
  22. <section>2.1</section>
  23. <section>2.2</section>
  24. <section>2.3</section>
  25. <section>2.4</section>
  26. </section>
  27. </div>
  28. </div>
  29. <script src="../js/reveal.js"></script>
  30. <script src="qunit-2.5.0.js"></script>
  31. <script>
  32. Reveal.addEventListener( 'ready', function() {
  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({ gridNavigation: true });
  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. Reveal.initialize();
  54. </script>
  55. </body>
  56. </html>