2020-04-06 11:22:54 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
|
|
<title>reveal.js - Test Iframes</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../dist/reveal.css">
|
2020-04-22 11:37:04 +02:00
|
|
|
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
|
|
|
|
<script src="../node_modules/qunit/qunit/qunit.js"></script>
|
2020-04-06 11:22:54 +02:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body style="overflow: auto;">
|
|
|
|
|
|
|
|
<div id="qunit"></div>
|
|
|
|
<div id="qunit-fixture"></div>
|
|
|
|
|
|
|
|
<div class="deck1">
|
|
|
|
<div class="reveal" style="display: none;">
|
|
|
|
<div class="slides">
|
|
|
|
<section>1.1</section>
|
2020-05-04 14:33:21 +02:00
|
|
|
<section data-state="deck1slide2">1.2</section>
|
2020-04-06 11:22:54 +02:00
|
|
|
<section>1.3</section>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="deck2">
|
|
|
|
<div class="reveal" style="display: none;">
|
|
|
|
<div class="slides">
|
|
|
|
<section>2.1</section>
|
|
|
|
<section>2.2</section>
|
|
|
|
<section>2.3</section>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-04-17 10:59:55 +02:00
|
|
|
<script type="module">
|
|
|
|
|
2020-05-04 10:39:37 +02:00
|
|
|
import Reveal from '../dist/reveal.esm.js';
|
2020-05-18 14:41:56 +02:00
|
|
|
import Zoom from '../plugin/zoom/zoom.esm.js';
|
2020-04-06 11:22:54 +02:00
|
|
|
|
|
|
|
QUnit.module( 'Multiple reveal.js instances' );
|
|
|
|
|
|
|
|
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
|
2020-04-07 09:47:44 +02:00
|
|
|
embedded: true,
|
2020-04-17 11:03:35 +02:00
|
|
|
keyboard: true,
|
2020-05-04 10:39:37 +02:00
|
|
|
plugins: [ Zoom ]
|
2020-04-06 11:22:54 +02:00
|
|
|
} );
|
|
|
|
r1.initialize();
|
|
|
|
|
|
|
|
let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), {
|
2020-04-07 09:40:11 +02:00
|
|
|
embedded: true,
|
|
|
|
keyboard: false
|
2020-04-06 11:22:54 +02:00
|
|
|
} );
|
|
|
|
r2.initialize();
|
|
|
|
|
|
|
|
QUnit.test( 'Can make independent changes', function( assert ) {
|
|
|
|
|
|
|
|
r1.slide(1);
|
|
|
|
r2.slide(2);
|
|
|
|
assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' );
|
|
|
|
assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' );
|
|
|
|
|
|
|
|
r2.toggleOverview( true );
|
|
|
|
assert.strictEqual( r1.isOverview(), false );
|
|
|
|
assert.strictEqual( r2.isOverview(), true );
|
|
|
|
r2.toggleOverview( false );
|
|
|
|
|
2020-04-07 09:40:11 +02:00
|
|
|
assert.strictEqual( r1.getConfig().keyboard, true );
|
|
|
|
assert.strictEqual( r2.getConfig().keyboard, false );
|
|
|
|
|
2020-04-06 11:22:54 +02:00
|
|
|
});
|
|
|
|
|
2020-04-17 11:03:35 +02:00
|
|
|
QUnit.test( 'Can register plugins independently', function( assert ) {
|
|
|
|
|
|
|
|
assert.ok( r1.hasPlugin( 'zoom' ) );
|
|
|
|
assert.notOk( r2.hasPlugin( 'zoom' ) );
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2020-05-04 14:33:21 +02:00
|
|
|
QUnit.test( 'Slide state is set at the viewport level', function( assert ) {
|
|
|
|
|
|
|
|
r1.slide(1);
|
|
|
|
|
|
|
|
assert.ok( r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ) );
|
|
|
|
|
|
|
|
r1.slide(2);
|
|
|
|
|
|
|
|
assert.ok( !r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ), 'unset' );
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2020-04-06 11:22:54 +02:00
|
|
|
</script>
|
2020-04-17 10:59:55 +02:00
|
|
|
<script>
|
|
|
|
QUnit.test( 'Reveal does not leak to window', function( assert ) {
|
|
|
|
assert.strictEqual( window.Reveal, undefined );
|
|
|
|
});
|
|
|
|
</script>
|
2020-04-06 11:22:54 +02:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|