update packages and add valign

This commit is contained in:
2026-04-05 20:00:27 +02:00
parent b062fb98e3
commit 03fb00e374
640 changed files with 109768 additions and 39311 deletions

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Auto-Animate</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -62,11 +58,15 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
QUnit.config.reorder = false;
QUnit.config.autostart = false;
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
return {
@@ -77,9 +77,11 @@
};
} );
Reveal.initialize().then( async () => {
QUnit.module( 'Auto-Animate' );
QUnit.module( 'Auto-Animate' );
Reveal.initialize().then( () => {
QUnit.start();
QUnit.test( 'Adds data-auto-animate-target', assert => {
Reveal.slide(1);
@@ -111,7 +113,7 @@
});
QUnit.test( 'Slide specific data-auto-animate-duration', assert => {
assert.timeout( 400 );
assert.timeout( 2000 );
assert.expect( 1 );
return new Promise( resolve => {

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Async Dependencies</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,13 +22,19 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
var externalScriptSequence = '';
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
window.externalScriptSequence = '';
var scriptCount = 0;
QUnit.config.testTimeout = 30000;
QUnit.config.autostart = false;
QUnit.module( 'Async Dependencies' );
QUnit.test( 'Async scripts are loaded', function( assert ) {

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Dependencies</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,8 +22,12 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
window.externalScriptSequence = '';
QUnit.config.testTimeout = 30000;

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Dependencies</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -29,8 +25,11 @@
</div>
<script type="module">
import Reveal from '../dist/reveal.esm.js'
import Markdown from '../plugin/markdown/markdown.esm.js'
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
import Markdown from 'reveal.js/plugin/markdown';
QUnit.module( 'Destroy' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Grid</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -38,8 +34,12 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
QUnit.config.autostart = false;
QUnit.module( 'Grid Navigation' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Iframe Backgrounds</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -31,8 +27,11 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -31,8 +27,11 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Markdown</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -315,9 +311,12 @@
</div>
<script type="module">
import Reveal from '../dist/reveal.esm.js'
import Markdown from '../plugin/markdown/markdown.esm.js'
import Highlight from '../plugin/highlight/highlight.esm.js'
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
import Markdown from 'reveal.js/plugin/markdown'
import Highlight from 'reveal.js/plugin/highlight'
QUnit.config.testTimeout = 30000;
@@ -402,7 +401,7 @@
QUnit.module( 'Options' );
QUnit.test( 'Options are set', function( assert ) {
assert.strictEqual( deck4.getPlugin( 'markdown' ).marked.defaults.smartypants, true );
assert.strictEqual( deck4.getPlugin( 'markdown' ).markdownOptions.smartypants, true );
});
QUnit.test( 'Smart quotes are activated', function( assert ) {

View File

@@ -0,0 +1,198 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - MathJax4 Plugin Test</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>
<h2>MathJax4 Test</h2>
<p>Testing MathJax4 plugin functionality</p>
</section>
<section>
<h3>Simple Math</h3>
<p>Inline math: \(E = mc^2\)</p>
<p>Display math:</p>
\[
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
\]
</section>
<section>
<h3>Macros Test</h3>
<p>Using custom macros: \(\R\) and \(\set{x}{x &gt; 0}\)</p>
\[
L^2(\R) = \set{u : \R \to \R}{\int_\R |u|^2 &lt; +\infty}
\]
</section>
<section>
<h3>Complex Math</h3>
\[
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{aligned}
\]
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/math.js"></script>
<script>
QUnit.config.testTimeout = 30000;
QUnit.module('MathJax4 Plugin');
QUnit.test('MathJax4 plugin is available', function(assert) {
assert.ok(typeof RevealMath !== 'undefined', 'RevealMath is defined');
assert.ok(typeof RevealMath.MathJax4 !== 'undefined', 'MathJax4 plugin is available');
assert.strictEqual(typeof RevealMath.MathJax4, 'function', 'MathJax4 is a function');
});
QUnit.test('MathJax4 plugin has correct structure', function(assert) {
var mathJax4Plugin = RevealMath.MathJax4();
assert.strictEqual(mathJax4Plugin.id, 'mathjax4', 'Plugin has correct ID');
assert.strictEqual(typeof mathJax4Plugin.init, 'function', 'Plugin has init method');
});
QUnit.test('MathJax4 plugin can be initialized', function(assert) {
assert.expect(1);
var done = assert.async();
// Create proper reveal.js DOM structure
var testContainer = document.createElement('div');
testContainer.className = 'reveal';
var slidesContainer = document.createElement('div');
slidesContainer.className = 'slides';
var slide = document.createElement('section');
slide.textContent = 'Test slide';
slidesContainer.appendChild(slide);
testContainer.appendChild(slidesContainer);
document.body.appendChild(testContainer);
var testReveal = new Reveal(testContainer, {
plugins: [RevealMath.MathJax4()]
});
testReveal.initialize().then(function() {
assert.ok(testReveal.hasPlugin('mathjax4'), 'MathJax4 plugin is registered');
document.body.removeChild(testContainer);
done();
}).catch(function(error) {
assert.ok(false, 'MathJax4 plugin initialization failed: ' + error.message);
document.body.removeChild(testContainer);
done();
});
});
QUnit.test('MathJax4 loads MathJax 4.0.0 and processes math', function(assert) {
assert.expect(3);
var done = assert.async();
// Create proper reveal.js DOM structure
var testContainer = document.createElement('div');
testContainer.className = 'reveal';
var slidesContainer = document.createElement('div');
slidesContainer.className = 'slides';
var slide = document.createElement('section');
slide.innerHTML = '<p>Inline: \\(E = mc^2\\)</p><p>Display: \\[ \\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi} \\]</p>';
slidesContainer.appendChild(slide);
testContainer.appendChild(slidesContainer);
document.body.appendChild(testContainer);
var testReveal = new Reveal(testContainer, {
plugins: [RevealMath.MathJax4()],
mathjax4: {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']]
}
}
});
testReveal.initialize().then(function() {
setTimeout(function() {
assert.ok(typeof window.MathJax !== 'undefined', 'MathJax is loaded');
var mathElements = testContainer.querySelectorAll('.MathJax');
assert.ok(mathElements.length > 0, 'Math elements are processed by MathJax');
// Check that inline and display math are both processed
var inlineMath = testContainer.querySelectorAll('.MathJax');
assert.ok(inlineMath.length >= 2, 'Both inline and display math are processed');
document.body.removeChild(testContainer);
done();
}, 3000); // Give MathJax more time to load and process
}).catch(function(error) {
assert.ok(false, 'MathJax4 test failed: ' + error.message);
document.body.removeChild(testContainer);
done();
});
});
QUnit.test('MathJax4 supports custom macros', function(assert) {
assert.expect(2);
var done = assert.async();
// Create proper reveal.js DOM structure
var testContainer = document.createElement('div');
testContainer.className = 'reveal';
var slidesContainer = document.createElement('div');
slidesContainer.className = 'slides';
var slide = document.createElement('section');
slide.innerHTML = '<p>Macro test: \\(\\R\\) and \\(\\set{x}{x > 0}\\)</p>';
slidesContainer.appendChild(slide);
testContainer.appendChild(slidesContainer);
document.body.appendChild(testContainer);
var testReveal = new Reveal(testContainer, {
plugins: [RevealMath.MathJax4()],
mathjax4: {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
macros: {
R: '\\mathbb{R}',
set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2]
}
}
}
});
testReveal.initialize().then(function() {
setTimeout(function() {
var mathElements = testContainer.querySelectorAll('.MathJax');
assert.ok(mathElements.length > 0, 'Math with macros is processed');
// Check that macros are working (should render as math elements)
var macroElements = testContainer.querySelectorAll('.MathJax');
assert.ok(macroElements.length >= 2, 'Both macro expressions are processed');
document.body.removeChild(testContainer);
done();
}, 3000);
}).catch(function(error) {
assert.ok(false, 'MathJax4 macros test failed: ' + error.message);
document.body.removeChild(testContainer);
done();
});
});
</script>
</body>
</html>

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -36,9 +32,12 @@
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/zoom/zoom.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
import RevealZoom from 'reveal.js/plugin/zoom';
QUnit.config.testTimeout = 30000;
QUnit.module( 'Multiple reveal.js instances' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -37,9 +33,11 @@
</div>
<script type="module">
import Reveal from '../dist/reveal.esm.js';
import Zoom from '../plugin/zoom/zoom.esm.js';
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
import Zoom from 'reveal.js/plugin/zoom';
QUnit.config.testTimeout = 30000;
QUnit.module( 'Multiple reveal.js instances' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test PDF exports</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -73,8 +69,12 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
QUnit.config.autostart = false;

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Plugins</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,8 +22,11 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
QUnit.module( 'Plugins' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test Scroll View</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -43,11 +39,15 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
QUnit.config.reorder = false;
QUnit.config.autostart = false;
function getScrollHeight() {
return Reveal.getViewportElement().scrollHeight;
@@ -57,9 +57,11 @@
return Reveal.getViewportElement().offsetHeight;
}
QUnit.module( 'Scroll View' );
Reveal.initialize({ view: 'scroll' }).then( async () => {
QUnit.module( 'Scroll View' );
QUnit.start();
QUnit.test( 'Activates', assert => {
assert.ok( getScrollHeight() > getViewportHeight(), 'Is overflowing' );

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Test State</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -36,8 +32,11 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
Reveal.initialize();

View File

@@ -5,10 +5,6 @@
<meta charset="utf-8">
<title>reveal.js - Tests</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
@@ -81,8 +77,12 @@
</div>
<script src="../dist/reveal.js"></script>
<script>
<script type="module">
import 'reveal.css';
import 'qunit/qunit/qunit.css';
import QUnit from 'qunit';
import Reveal from 'reveal.js';
QUnit.config.testTimeout = 30000;
window.location.hash = '';
@@ -284,6 +284,137 @@
assert.strictEqual( Reveal.getConfig().customTestValue, 1, 'supports custom values' );
});
QUnit.test( 'Reveal.getState/Reveal.setState', function( assert ) {
Reveal.hidePreview();
Reveal.toggleOverview( false );
Reveal.togglePause( false );
Reveal.slide( 2, 1, -1 );
Reveal.togglePause( true );
Reveal.toggleOverview( true );
var state = Reveal.getState();
assert.strictEqual( state.indexh, 2, 'state has horizontal index' );
assert.strictEqual( state.indexv, 1, 'state has vertical index' );
assert.strictEqual( state.indexf, -1, 'state has fragment index' );
assert.strictEqual( state.paused, true, 'state has paused=true' );
assert.strictEqual( state.overview, true, 'state has overview=true' );
Reveal.toggleOverview( false );
Reveal.togglePause( false );
Reveal.slide( 0, 0 );
Reveal.setState( state );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 1, f: -1 }, 'setState restores indices' );
assert.strictEqual( Reveal.isPaused(), true, 'setState restores paused' );
assert.strictEqual( Reveal.isOverview(), true, 'setState restores overview' );
Reveal.toggleOverview( false );
Reveal.togglePause( false );
Reveal.slide( 2, 0 );
Reveal.slide( 0, 0 );
});
QUnit.test( 'Reveal.getState includes overlay state', function( assert ) {
var previewURL = 'about:blank';
Reveal.hidePreview();
Reveal.previewIframe( previewURL );
var state = Reveal.getState();
assert.strictEqual( state.previewIframe, previewURL, 'state includes preview iframe URL' );
assert.strictEqual( Reveal.isOverlayOpen(), true, 'overlay is open' );
Reveal.hidePreview();
assert.strictEqual( Reveal.isOverlayOpen(), false, 'overlay closed' );
Reveal.setState( state );
assert.strictEqual( Reveal.isOverlayOpen(), true, 'setState restores overlay' );
assert.strictEqual( Reveal.getState().previewIframe, previewURL, 'restored overlay state has same URL' );
Reveal.hidePreview();
});
QUnit.test( 'Reveal.removeHiddenSlides', function( assert ) {
var slidesElement = Reveal.getSlidesElement();
var hiddenSlide = document.createElement( 'section' );
hiddenSlide.setAttribute( 'data-visibility', 'hidden' );
slidesElement.appendChild( hiddenSlide );
assert.ok( slidesElement.contains( hiddenSlide ), 'hidden slide was added' );
Reveal.removeHiddenSlides();
assert.notOk( slidesElement.contains( hiddenSlide ), 'hidden slide removed' );
});
QUnit.test( 'Reveal.sync', function( assert ) {
assert.expect( 4 );
var done = assert.async();
var syncSlide = document.createElement( 'section' );
syncSlide.setAttribute( 'data-background-image', 'examples/assets/image1.png' );
syncSlide.innerHTML = '<h2>Sync Test Slide</h2>';
var onSync = function() {
assert.ok( true, 'sync event fired' );
Reveal.off( 'sync', onSync );
done();
}
Reveal.on( 'sync', onSync );
Reveal.getSlidesElement().appendChild( syncSlide );
assert.strictEqual( Reveal.getSlideBackground( syncSlide ), undefined, 'no background before sync' );
Reveal.sync();
assert.ok( Reveal.getSlideBackground( syncSlide ), 'background is created after sync' );
assert.ok( Reveal.getSlides().includes( syncSlide ), 'new slide is included after sync' );
syncSlide.remove();
Reveal.sync();
});
QUnit.test( 'Reveal.syncSlide', function( assert ) {
var slide = Reveal.getSlide( 3 );
var imageURL = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
slide.setAttribute( 'data-background-image', imageURL );
Reveal.syncSlide( slide );
var backgroundImage = Reveal.getSlideBackground( slide )
.querySelector( '.slide-background-content' )
.style.backgroundImage;
assert.ok( backgroundImage.indexOf( 'data:image/gif' ) !== -1, 'syncSlide updates slide background' );
slide.removeAttribute( 'data-background-image' );
Reveal.syncSlide( slide );
});
QUnit.test( 'Reveal.syncFragments', function( assert ) {
var slide = Reveal.getSlide( 0 );
var fragmentA = document.createElement( 'span' );
var fragmentB = document.createElement( 'span' );
fragmentA.className = 'fragment';
fragmentB.className = 'fragment';
fragmentA.textContent = 'Temporary fragment A';
fragmentB.textContent = 'Temporary fragment B';
slide.appendChild( fragmentA );
slide.appendChild( fragmentB );
var fragments = Reveal.syncFragments( slide );
assert.strictEqual( fragments.length, 2, 'returns synced fragments' );
assert.strictEqual( fragmentA.getAttribute( 'data-fragment-index' ), '0', 'first fragment got index 0' );
assert.strictEqual( fragmentB.getAttribute( 'data-fragment-index' ), '1', 'second fragment got index 1' );
fragmentA.remove();
fragmentB.remove();
Reveal.syncFragments( slide );
});
QUnit.test( 'Reveal.availableRoutes', function( assert ) {
Reveal.slide( 0, 0 );
assert.deepEqual( Reveal.availableRoutes(), { left: false, up: false, down: false, right: true }, 'correct for first slide' );
@@ -451,6 +582,45 @@
assert.strictEqual( Reveal.getIndices().h, 3, 'right arrow skips fragments when alt key is pressed' );
});
// ---------------------------------------------------------------
// JUMP-TO-SLIDE TESTS
QUnit.module( 'Jump To Slide' );
QUnit.test( 'Can jump by API query', function( assert ) {
var jumpInput;
Reveal.slide( 0, 0 );
Reveal.toggleJumpToSlide( true );
jumpInput = document.querySelector( '.jump-to-slide-input' );
assert.ok( jumpInput, 'jump input is visible' );
jumpInput.value = '2.2';
jumpInput.dispatchEvent( new KeyboardEvent( 'keydown', { keyCode: 13, bubbles: true } ) );
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 1, f: undefined }, 'jumps to 2.2 (one-based index)' );
Reveal.toggleJumpToSlide( true );
jumpInput = document.querySelector( '.jump-to-slide-input' );
jumpInput.value = 'fragments3';
jumpInput.dispatchEvent( new KeyboardEvent( 'keydown', { keyCode: 13, bubbles: true } ) );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 2, f: -1 }, 'jumps to named slide id' );
});
QUnit.test( 'Keyboard toggle and cancel', function( assert ) {
Reveal.configure({ jumpToSlide: true });
Reveal.slide( 1, 0 );
triggerKeyboardEvent({ keyCode: 71 });
var jumpInput = document.querySelector( '.jump-to-slide-input' );
assert.ok( jumpInput, 'G opens jump-to-slide' );
jumpInput.value = '4';
jumpInput.dispatchEvent( new KeyboardEvent( 'keydown', { keyCode: 27, bubbles: true } ) );
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 0, f: undefined }, 'Escape cancels and restores original slide' );
assert.strictEqual( document.querySelector( '.jump-to-slide' ), null, 'jump-to-slide is hidden after cancel' );
});
// ---------------------------------------------------------------
// FRAGMENT TESTS

View File

@@ -0,0 +1,105 @@
import Reveal, {
type MarkdownConfig,
type Mathjax4Config,
type RevealApi,
type RevealConfig,
type RevealPlugin,
type RevealPluginFactory,
} from 'reveal.js';
import RevealHighlight from 'reveal.js/plugin/highlight';
import RevealMarkdown from 'reveal.js/plugin/markdown';
import RevealMath from 'reveal.js/plugin/math';
import RevealNotes from 'reveal.js/plugin/notes';
import RevealSearch from 'reveal.js/plugin/search';
import RevealZoom from 'reveal.js/plugin/zoom';
type RevealModule = typeof Reveal;
const revealModule: RevealModule = Reveal;
const api: RevealApi | null = null;
const pluginFactory: RevealPluginFactory = RevealZoom;
const plugins: Array<RevealPlugin | RevealPluginFactory> = [RevealHighlight(), RevealMarkdown(), RevealMath, RevealNotes, RevealSearch, RevealZoom];
const markdownConfig: MarkdownConfig = {
separator: '\\n---\\n',
};
const mathjax4Config: Mathjax4Config = {
tex: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$']],
macros: {
R: '\\mathbb{R}',
set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2],
},
},
options: {
skipHtmlTags: ['script', 'style'],
},
output: {
font: 'mathjax-stix2',
displayOverflow: 'linebreak',
linebreaks: {
inline: true,
width: '100%',
lineleading: 0.2,
},
},
};
const revealConfig: RevealConfig = {
markdown: markdownConfig,
mathjax4: mathjax4Config,
};
const highlight = RevealHighlight();
const highlightId: string = highlight.id;
const highlightSteps = highlight.deserializeHighlightSteps('1,3-5|8');
const highlightSerialized: string = highlight.serializeHighlightSteps(highlightSteps);
const highlightBounds = highlight.getHighlightedLineBounds(document.createElement('code'));
highlight.highlightLines(document.createElement('code'), '1-2');
const markdown = RevealMarkdown();
const markdownId: string = markdown.id;
const markdownHtml: string = markdown.slidify('# Slide');
const markdownPromise: Promise<void[]> = markdown.processSlides(document);
const convertPromise: Promise<void> = markdown.convertSlides();
const markdownOptions = markdown.markdownOptions;
const math = RevealMath;
const mathId: 'mathjax2' = math.id;
const mathJax4Id: 'mathjax4' = math.MathJax4().id;
const katexId: 'katex' = math.KaTeX().id;
const notes = RevealNotes();
const notesId: 'notes' = notes.id;
notes.open();
const search = RevealSearch();
const searchId: 'search' = search.id;
search.open();
search.close();
search.toggle();
const zoom = RevealZoom();
const zoomId: 'zoom' = zoom.id;
void highlightId;
void highlightSteps;
void highlightSerialized;
void highlightBounds;
void markdownId;
void markdownHtml;
void markdownPromise;
void convertPromise;
void markdownOptions;
void mathId;
void mathJax4Id;
void katexId;
void notesId;
void searchId;
void zoomId;
void api;
void pluginFactory;
void plugins;
void markdownConfig;
void mathjax4Config;
void revealConfig;
void revealModule;