aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2015-05-04 20:58:58 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2015-05-04 20:58:58 -0400
commit7dd33f188fe14fd3cfa358aad523410d646c98fb (patch)
treedf101ffa1af79ff77ea3faafc4167a53043c477c /test
parent152271efb26034c0fe8b898a5cad61939f542c99 (diff)
downloadfosdem-2018-presentation-7dd33f188fe14fd3cfa358aad523410d646c98fb.tar
fosdem-2018-presentation-7dd33f188fe14fd3cfa358aad523410d646c98fb.tar.gz
lazy-load iframes only for current slide, unload when hidden
Diffstat (limited to 'test')
-rw-r--r--test/test.html1
-rw-r--r--test/test.js9
2 files changed, 10 insertions, 0 deletions
diff --git a/test/test.html b/test/test.html
index 29d02a9..18f7504 100644
--- a/test/test.html
+++ b/test/test.html
@@ -44,6 +44,7 @@
<li class="fragment">4.2</li>
<li class="fragment">4.3</li>
</ul>
+ <iframe data-src="http://example.com"></iframe>
</section>
<section>
diff --git a/test/test.js b/test/test.js
index 3f93d3c..d59ddfa 100644
--- a/test/test.js
+++ b/test/test.js
@@ -495,6 +495,15 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' );
});
+ test( 'iframe with data-src', function() {
+ Reveal.slide( 0, 0 );
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
+ Reveal.slide( 2, 0 );
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 1, 'Iframe source is set' );
+ Reveal.slide( 2, 1 );
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
+ });
+
test( 'background images', function() {
var imageSource1 = Reveal.getSlide( 0 ).getAttribute( 'data-background-image' );
var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' );