spec updates
This commit is contained in:
parent
2eb6d1e71c
commit
a815c7d269
File diff suppressed because it is too large
Load Diff
|
@ -51,8 +51,8 @@
|
|||
"gulp-zip": "^4.2.0",
|
||||
"highlight.js": "^10.0.3",
|
||||
"marked": "^4.0.12",
|
||||
"node-qunit-puppeteer": "^2.1.0",
|
||||
"qunit": "^2.17.2",
|
||||
"node-qunit-puppeteer": "^2.1.2",
|
||||
"qunit": "^2.19.3",
|
||||
"rollup": "^2.48.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sass": "^1.39.2",
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.config.reorder = false;
|
||||
|
||||
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
var externalScriptSequence = '';
|
||||
var scriptCount = 0;
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.module( 'Async Dependencies' );
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
<script>
|
||||
window.externalScriptSequence = '';
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.module( 'Dependencies' );
|
||||
|
||||
Reveal.initialize({
|
||||
dependencies: [
|
||||
{ src: 'assets/external-script-a.js' },
|
||||
|
@ -38,7 +42,7 @@
|
|||
]
|
||||
}).then( () => {
|
||||
|
||||
QUnit.module( 'Dependencies' );
|
||||
QUnit.start();
|
||||
|
||||
QUnit.test( 'Load synchronous scripts', function( assert ) {
|
||||
assert.strictEqual( window.externalScriptSequence, 'ABC', 'Loaded and executed in order' );
|
||||
|
|
|
@ -40,9 +40,13 @@
|
|||
|
||||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.module( 'Grid Navigation' );
|
||||
|
||||
Reveal.initialize().then( () => {
|
||||
|
||||
QUnit.module( 'Grid Navigation' );
|
||||
QUnit.start();
|
||||
|
||||
QUnit.test( 'Disabled', function( assert ) {
|
||||
Reveal.right();
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
|
||||
Reveal.initialize({ viewDistance: 3 }).then( () => {
|
||||
|
||||
function getIframe( index ) {
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
|
||||
Reveal.initialize({ viewDistance: 2 }).then( () => {
|
||||
|
||||
var defaultIframe = document.querySelector( '.default-iframe' ),
|
||||
|
|
|
@ -298,6 +298,8 @@
|
|||
import Markdown from '../plugin/markdown/markdown.esm.js'
|
||||
import Highlight from '../plugin/highlight/highlight.esm.js'
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
|
||||
let deck1 = new Reveal( document.querySelector( '.deck1' ), { plugins: [ Markdown ] })
|
||||
deck1.addEventListener( 'ready', function() {
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<script src="../plugin/zoom/zoom.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.module( 'Multiple reveal.js instances' );
|
||||
|
||||
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import Reveal from '../dist/reveal.esm.js';
|
||||
import Zoom from '../plugin/zoom/zoom.esm.js';
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.module( 'Multiple reveal.js instances' );
|
||||
|
||||
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
|
||||
|
|
|
@ -75,8 +75,13 @@
|
|||
|
||||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
Reveal.initialize({ pdf: true }).then( function() {
|
||||
|
||||
QUnit.start();
|
||||
|
||||
// Only one test for now, we're mainly ensuring that there
|
||||
// are no execution errors when running PDF mode
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.testTimeout = 30000;
|
||||
QUnit.module( 'Plugins' );
|
||||
|
||||
var initCounter = { PluginB: 0, PluginC: 0, PluginD: 0 };
|
||||
|
|
|
@ -39,97 +39,95 @@
|
|||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
|
||||
Reveal.initialize().then( function() {
|
||||
console.log(Reveal);
|
||||
Reveal.initialize();
|
||||
|
||||
QUnit.module( 'State' );
|
||||
QUnit.module( 'State' );
|
||||
|
||||
QUnit.test( 'Fire events when changing slide', function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var state1 = assert.async();
|
||||
var state2 = assert.async();
|
||||
QUnit.test( 'Fire events when changing slide', function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var state1 = assert.async();
|
||||
var state2 = assert.async();
|
||||
|
||||
var _onState1 = function( event ) {
|
||||
assert.ok( true, 'state1 fired' );
|
||||
state1();
|
||||
}
|
||||
var _onState1 = function( event ) {
|
||||
assert.ok( true, 'state1 fired' );
|
||||
state1();
|
||||
}
|
||||
|
||||
var _onState2 = function( event ) {
|
||||
assert.ok( true, 'state2 fired' );
|
||||
state2();
|
||||
}
|
||||
var _onState2 = function( event ) {
|
||||
assert.ok( true, 'state2 fired' );
|
||||
state2();
|
||||
}
|
||||
|
||||
Reveal.on( 'state1', _onState1 );
|
||||
Reveal.on( 'state2', _onState2 );
|
||||
Reveal.on( 'state1', _onState1 );
|
||||
Reveal.on( 'state2', _onState2 );
|
||||
|
||||
Reveal.slide( 1 );
|
||||
Reveal.slide( 3 );
|
||||
Reveal.slide( 1 );
|
||||
Reveal.slide( 3 );
|
||||
|
||||
Reveal.off( 'state1', _onState1 );
|
||||
Reveal.off( 'state2', _onState2 );
|
||||
});
|
||||
Reveal.off( 'state1', _onState1 );
|
||||
Reveal.off( 'state2', _onState2 );
|
||||
});
|
||||
|
||||
QUnit.test( 'Fire state events for vertical slides', function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var done = assert.async( 2 );
|
||||
QUnit.test( 'Fire state events for vertical slides', function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var done = assert.async( 2 );
|
||||
|
||||
var _onState1 = function( event ) {
|
||||
assert.ok( true, 'state1 fired' );
|
||||
done();
|
||||
}
|
||||
var _onState1 = function( event ) {
|
||||
assert.ok( true, 'state1 fired' );
|
||||
done();
|
||||
}
|
||||
|
||||
var _onState3 = function( event ) {
|
||||
assert.ok( true, 'state3 fired' );
|
||||
done();
|
||||
}
|
||||
var _onState3 = function( event ) {
|
||||
assert.ok( true, 'state3 fired' );
|
||||
done();
|
||||
}
|
||||
|
||||
Reveal.on( 'state1', _onState1 );
|
||||
Reveal.on( 'state3', _onState3 );
|
||||
Reveal.on( 'state1', _onState1 );
|
||||
Reveal.on( 'state3', _onState3 );
|
||||
|
||||
Reveal.slide( 0 );
|
||||
Reveal.slide( 4, 1 );
|
||||
Reveal.slide( 4, 2 );
|
||||
Reveal.slide( 0 );
|
||||
Reveal.slide( 4, 1 );
|
||||
Reveal.slide( 4, 2 );
|
||||
|
||||
Reveal.off( 'state1', _onState1 );
|
||||
Reveal.off( 'state3', _onState3 );
|
||||
});
|
||||
Reveal.off( 'state1', _onState1 );
|
||||
Reveal.off( 'state3', _onState3 );
|
||||
});
|
||||
|
||||
QUnit.test( 'No events if state remains unchanged', function( assert ) {
|
||||
var stateChanges = 0;
|
||||
QUnit.test( 'No events if state remains unchanged', function( assert ) {
|
||||
var stateChanges = 0;
|
||||
|
||||
var _onEvent = function( event ) {
|
||||
stateChanges += 1;
|
||||
}
|
||||
var _onEvent = function( event ) {
|
||||
stateChanges += 1;
|
||||
}
|
||||
|
||||
Reveal.on( 'state1', _onEvent );
|
||||
Reveal.on( 'state1', _onEvent );
|
||||
|
||||
Reveal.slide( 0 ); // no state
|
||||
Reveal.slide( 1 ); // state1
|
||||
Reveal.slide( 2 ); // state1
|
||||
Reveal.prev(); // state1
|
||||
Reveal.next(); // state1
|
||||
Reveal.slide( 4, 1 ); // state1
|
||||
Reveal.slide( 0 ); // no state
|
||||
Reveal.slide( 0 ); // no state
|
||||
Reveal.slide( 1 ); // state1
|
||||
Reveal.slide( 2 ); // state1
|
||||
Reveal.prev(); // state1
|
||||
Reveal.next(); // state1
|
||||
Reveal.slide( 4, 1 ); // state1
|
||||
Reveal.slide( 0 ); // no state
|
||||
|
||||
Reveal.off( 'state1', _onEvent );
|
||||
Reveal.off( 'state1', _onEvent );
|
||||
|
||||
assert.strictEqual( stateChanges, 1, 'no event was fired when going to slide with same state' );
|
||||
});
|
||||
assert.strictEqual( stateChanges, 1, 'no event was fired when going to slide with same state' );
|
||||
});
|
||||
|
||||
QUnit.test( 'Event order', function( assert ) {
|
||||
var _onEvent = function( event ) {
|
||||
assert.ok( Reveal.getCurrentSlide() == document.querySelector( '#slide2' ), 'correct current slide immediately after state event' );
|
||||
}
|
||||
QUnit.test( 'Event order', function( assert ) {
|
||||
var _onEvent = function( event ) {
|
||||
assert.ok( Reveal.getCurrentSlide() == document.querySelector( '#slide2' ), 'correct current slide immediately after state event' );
|
||||
}
|
||||
|
||||
Reveal.on( 'state1', _onEvent );
|
||||
Reveal.on( 'state1', _onEvent );
|
||||
|
||||
Reveal.slide( 0 );
|
||||
Reveal.slide( 1 );
|
||||
Reveal.slide( 0 );
|
||||
Reveal.slide( 1 );
|
||||
|
||||
Reveal.off( 'state1', _onEvent );
|
||||
});
|
||||
Reveal.off( 'state1', _onEvent );
|
||||
});
|
||||
|
||||
} );
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -83,6 +83,8 @@
|
|||
|
||||
<script src="../dist/reveal.js"></script>
|
||||
<script>
|
||||
QUnit.config.testTimeout = 30000;
|
||||
|
||||
window.location.hash = '';
|
||||
|
||||
Reveal.configure({maxScale: 1.11});
|
||||
|
|
Loading…
Reference in New Issue