返回 reveal.js
test-grid-navigation.html
根目录 / test / test-grid-navigation.html
1 <!doctype html>
2 <html lang="en">
3
4 <head>
5 <meta charset="utf-8">
6
7 <title>reveal.js - Test Grid</title>
8 </head>
9
10 <body style="overflow: auto;">
11
12 <div id="qunit"></div>
13 <div id="qunit-fixture"></div>
14
15 <div class="reveal" style="display: none;">
16
17 <div class="slides">
18
19 <section>0</section>
20 <section>
21 <section>1.1</section>
22 <section>1.2</section>
23 <section>1.3</section>
24 <section>1.4</section>
25 </section>
26 <section>
27 <section>2.1</section>
28 <section>2.2</section>
29 <section>2.3</section>
30 <section>2.4</section>
31 </section>
32
33 </div>
34
35 </div>
36
37 <script type="module">
38 import 'reveal.css';
39 import 'qunit/qunit/qunit.css';
40 import QUnit from 'qunit';
41 import Reveal from 'reveal.js';
42
43 QUnit.config.testTimeout = 30000;
44 QUnit.config.autostart = false;
45 QUnit.module( 'Grid Navigation' );
46
47 Reveal.initialize().then( () => {
48
49 QUnit.start();
50
51 QUnit.test( 'Disabled', function( assert ) {
52 Reveal.right();
53 Reveal.down();
54 Reveal.down();
55 assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
56 Reveal.right();
57 assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: undefined }, 'Moves to top when going to adjacent stack' );
58 });
59
60 QUnit.test( 'Enabled', function( assert ) {
61 Reveal.configure({ navigationMode: 'grid' });
62 Reveal.slide( 0, 0 );
63 Reveal.right();
64 Reveal.down();
65 Reveal.down();
66 assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
67 Reveal.right();
68 assert.deepEqual( Reveal.getIndices(), { h: 2, v: 2, f: undefined }, 'Remains at same vertical index when going to adjacent stack' );
69 });
70
71 } );
72 </script>
73
74 </body>
75 </html>
76
76 lines HTML