|
| 1 | +Reveal.initialize().then(() => { |
| 2 | + QUnit.module('Configuration'); |
| 3 | + |
| 4 | + QUnit.test('Width and height config', function(assert) { |
| 5 | + Reveal.configure({ width: 1200, height: 800 }); |
| 6 | + const config = Reveal.getConfig(); |
| 7 | + assert.strictEqual(config.width, 1200, 'width updated'); |
| 8 | + assert.strictEqual(config.height, 800, 'height updated'); |
| 9 | + }); |
| 10 | + |
| 11 | + QUnit.test('Margin config', function(assert) { |
| 12 | + Reveal.configure({ margin: 0.1 }); |
| 13 | + assert.strictEqual(Reveal.getConfig().margin, 0.1, 'margin updated'); |
| 14 | + }); |
| 15 | + |
| 16 | + QUnit.test('Min/Max scale config', function(assert) { |
| 17 | + Reveal.configure({ minScale: 0.5, maxScale: 3.0 }); |
| 18 | + const config = Reveal.getConfig(); |
| 19 | + assert.strictEqual(config.minScale, 0.5, 'minScale updated'); |
| 20 | + assert.strictEqual(config.maxScale, 3.0, 'maxScale updated'); |
| 21 | + }); |
| 22 | + |
| 23 | + QUnit.test('Loop config', function(assert) { |
| 24 | + Reveal.configure({ loop: true }); |
| 25 | + assert.strictEqual(Reveal.getConfig().loop, true, 'loop enabled'); |
| 26 | + |
| 27 | + Reveal.slide(2); // Last slide |
| 28 | + Reveal.next(); |
| 29 | + assert.strictEqual(Reveal.getIndices().h, 0, 'loops to first slide'); |
| 30 | + |
| 31 | + Reveal.configure({ loop: false }); |
| 32 | + }); |
| 33 | + |
| 34 | + QUnit.test('RTL config', function(assert) { |
| 35 | + Reveal.configure({ rtl: true }); |
| 36 | + assert.strictEqual(Reveal.getConfig().rtl, true, 'RTL enabled'); |
| 37 | + |
| 38 | + Reveal.configure({ rtl: false }); |
| 39 | + }); |
| 40 | + |
| 41 | + QUnit.test('Center config', function(assert) { |
| 42 | + Reveal.configure({ center: false }); |
| 43 | + assert.strictEqual(Reveal.getConfig().center, false, 'center disabled'); |
| 44 | + |
| 45 | + Reveal.configure({ center: true }); |
| 46 | + }); |
| 47 | + |
| 48 | + QUnit.test('Touch config', function(assert) { |
| 49 | + Reveal.configure({ touch: false }); |
| 50 | + assert.strictEqual(Reveal.getConfig().touch, false, 'touch disabled'); |
| 51 | + |
| 52 | + Reveal.configure({ touch: true }); |
| 53 | + }); |
| 54 | + |
| 55 | + QUnit.test('Shuffle config', function(assert) { |
| 56 | + Reveal.configure({ shuffle: true }); |
| 57 | + assert.strictEqual(Reveal.getConfig().shuffle, true, 'shuffle enabled'); |
| 58 | + |
| 59 | + Reveal.configure({ shuffle: false }); |
| 60 | + }); |
| 61 | + |
| 62 | + QUnit.test('Transition config', function(assert) { |
| 63 | + const transitions = ['none', 'fade', 'slide', 'convex', 'concave', 'zoom']; |
| 64 | + transitions.forEach(transition => { |
| 65 | + Reveal.configure({ transition }); |
| 66 | + assert.strictEqual(Reveal.getConfig().transition, transition, `${transition} transition set`); |
| 67 | + }); |
| 68 | + }); |
| 69 | + |
| 70 | + QUnit.test('Transition speed config', function(assert) { |
| 71 | + const speeds = ['default', 'fast', 'slow']; |
| 72 | + speeds.forEach(speed => { |
| 73 | + Reveal.configure({ transitionSpeed: speed }); |
| 74 | + assert.strictEqual(Reveal.getConfig().transitionSpeed, speed, `${speed} speed set`); |
| 75 | + }); |
| 76 | + }); |
| 77 | + |
| 78 | + QUnit.test('Background transition config', function(assert) { |
| 79 | + Reveal.configure({ backgroundTransition: 'zoom' }); |
| 80 | + assert.strictEqual(Reveal.getConfig().backgroundTransition, 'zoom', 'background transition set'); |
| 81 | + }); |
| 82 | + |
| 83 | + QUnit.test('View distance config', function(assert) { |
| 84 | + Reveal.configure({ viewDistance: 5 }); |
| 85 | + assert.strictEqual(Reveal.getConfig().viewDistance, 5, 'viewDistance updated'); |
| 86 | + }); |
| 87 | + |
| 88 | + QUnit.test('Mobile view distance config', function(assert) { |
| 89 | + Reveal.configure({ mobileViewDistance: 1 }); |
| 90 | + assert.strictEqual(Reveal.getConfig().mobileViewDistance, 1, 'mobileViewDistance updated'); |
| 91 | + }); |
| 92 | + |
| 93 | + QUnit.test('Display config', function(assert) { |
| 94 | + Reveal.configure({ display: 'flex' }); |
| 95 | + assert.strictEqual(Reveal.getConfig().display, 'flex', 'display mode updated'); |
| 96 | + |
| 97 | + Reveal.configure({ display: 'block' }); |
| 98 | + }); |
| 99 | + |
| 100 | + QUnit.test('Hash config', function(assert) { |
| 101 | + Reveal.configure({ hash: true }); |
| 102 | + assert.strictEqual(Reveal.getConfig().hash, true, 'hash enabled'); |
| 103 | + |
| 104 | + Reveal.configure({ hash: false }); |
| 105 | + }); |
| 106 | + |
| 107 | + QUnit.test('History config', function(assert) { |
| 108 | + Reveal.configure({ history: true }); |
| 109 | + assert.strictEqual(Reveal.getConfig().history, true, 'history enabled'); |
| 110 | + |
| 111 | + Reveal.configure({ history: false }); |
| 112 | + }); |
| 113 | + |
| 114 | + QUnit.test('Slide number config', function(assert) { |
| 115 | + Reveal.configure({ slideNumber: 'c/t' }); |
| 116 | + assert.strictEqual(Reveal.getConfig().slideNumber, 'c/t', 'slideNumber format set'); |
| 117 | + |
| 118 | + Reveal.configure({ slideNumber: false }); |
| 119 | + }); |
| 120 | + |
| 121 | + QUnit.test('Show notes config', function(assert) { |
| 122 | + Reveal.configure({ showNotes: true }); |
| 123 | + assert.strictEqual(Reveal.getConfig().showNotes, true, 'showNotes enabled'); |
| 124 | + |
| 125 | + Reveal.configure({ showNotes: false }); |
| 126 | + }); |
| 127 | + |
| 128 | + QUnit.test('Auto-animate config', function(assert) { |
| 129 | + Reveal.configure({ autoAnimate: false }); |
| 130 | + assert.strictEqual(Reveal.getConfig().autoAnimate, false, 'autoAnimate disabled'); |
| 131 | + |
| 132 | + Reveal.configure({ autoAnimate: true }); |
| 133 | + }); |
| 134 | + |
| 135 | + QUnit.test('Help config', function(assert) { |
| 136 | + Reveal.configure({ help: false }); |
| 137 | + assert.strictEqual(Reveal.getConfig().help, false, 'help disabled'); |
| 138 | + |
| 139 | + Reveal.configure({ help: true }); |
| 140 | + }); |
| 141 | + |
| 142 | + QUnit.test('Pause config', function(assert) { |
| 143 | + Reveal.configure({ pause: false }); |
| 144 | + assert.strictEqual(Reveal.getConfig().pause, false, 'pause disabled'); |
| 145 | + |
| 146 | + Reveal.configure({ pause: true }); |
| 147 | + }); |
| 148 | +}); |
0 commit comments