Browse Source

tests for lazy loading

Hakim El Hattab 11 years ago
parent
commit
3ad0d6adc0
2 changed files with 17 additions and 0 deletions
  1. 5 0
      test/test.html
  2. 12 0
      test/test.js

+ 5 - 0
test/test.html

@@ -21,6 +21,11 @@
 
 				<section>
 					<h1>1</h1>
+					<img data-src="fake-url.png">
+					<video>
+						<source data-src="fake-url.mp4" />
+						<source data-src="fake-url.webm" />
+					</video>
 				</section>
 
 				<section>

+ 12 - 0
test/test.js

@@ -449,6 +449,18 @@ Reveal.addEventListener( 'ready', function() {
 	});
 
 
+	// ---------------------------------------------------------------
+	// LAZY-LOADING TESTS
+
+	QUnit.module( 'Lazy-Loading' );
+
+	test( 'img with data-src', function() {
+		strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' );
+
+		strictEqual( document.querySelectorAll( '.reveal section video source[src]' ).length, 2, 'Video sources have been set' );
+	});
+
+
 	// ---------------------------------------------------------------
 	// EVENT TESTS