From 1766e37a6358d2abe03ec5695279f1b6c860e522 Mon Sep 17 00:00:00 2001
From: Hakim El Hattab
Date: Mon, 13 May 2019 10:55:29 +0200
Subject: iframe background preload behavior now matches inline iframes +
adheres to the new 'preloadIframes' config option
---
test/test-iframe-backgrounds.html | 104 ++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
create mode 100644 test/test-iframe-backgrounds.html
(limited to 'test')
diff --git a/test/test-iframe-backgrounds.html b/test/test-iframe-backgrounds.html
new file mode 100644
index 0000000..15888bc
--- /dev/null
+++ b/test/test-iframe-backgrounds.html
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ reveal.js - Test Iframe Backgrounds
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.2.3
From ac5075352163e4d5806db95f936372658f12d04f Mon Sep 17 00:00:00 2001
From: Hakim El Hattab
Date: Wed, 15 Jan 2020 11:37:37 +0100
Subject: add data-fragment= attribute to slide
---
js/reveal.js | 11 +++++++++++
test/test.js | 16 ++++++++++++++++
2 files changed, 27 insertions(+)
(limited to 'test')
diff --git a/js/reveal.js b/js/reveal.js
index fce3dbc..da806fc 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -4751,6 +4751,8 @@
if( fragments.length ) {
+ var maxIndex = 0;
+
if( typeof index !== 'number' ) {
var currentFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
if( currentFragment ) {
@@ -4764,6 +4766,8 @@
i = parseInt( el.getAttribute( 'data-fragment-index' ), 10 );
}
+ maxIndex = Math.max( maxIndex, i );
+
// Visible fragments
if( i <= index ) {
if( !el.classList.contains( 'visible' ) ) changedFragments.shown.push( el );
@@ -4787,6 +4791,13 @@
} );
+ // Write the current fragment index to the slide .
+ // This can be used by end users to apply styles based on
+ // the current fragment index.
+ index = typeof index === 'number' ? index : -1;
+ index = Math.max( Math.min( index, maxIndex ), -1 );
+ currentSlide.setAttribute( 'data-fragment', index );
+
}
}
diff --git a/test/test.js b/test/test.js
index 2738403..14bb690 100644
--- a/test/test.js
+++ b/test/test.js
@@ -250,6 +250,22 @@ Reveal.addEventListener( 'ready', function() {
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' );
});
+ QUnit.test( 'data-fragment is set on slide ', function( assert ) {
+ Reveal.slide( 2, 0, -1 );
+ assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '-1' );
+
+ Reveal.slide( 2, 0, 2 );
+ assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '2' );
+
+ Reveal.slide( 2, 0, 0 );
+ assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '0' );
+
+ var fragmentSlide = Reveal.getCurrentSlide();
+
+ Reveal.slide( 3, 0 );
+ assert.deepEqual( fragmentSlide.getAttribute( 'data-fragment' ), '0', 'data-fragment persists when jumping to another slide' );
+ });
+
QUnit.test( 'Hiding all fragments', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
--
cgit v1.2.3