diff options
Diffstat (limited to 'vendor/desandro/imagesloaded/test')
16 files changed, 429 insertions, 0 deletions
diff --git a/vendor/desandro/imagesloaded/test/css/tests.css b/vendor/desandro/imagesloaded/test/css/tests.css new file mode 100644 index 000000000..af8a7e885 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/css/tests.css @@ -0,0 +1,41 @@ +img { + display: inline-block; + max-width: 240px; +} + +/* ---- backgrounds ---- */ + +.bg-box { + width: 240px; + height: 240px; + margin: 0 20px 20px 0; + border: 1px solid; + display: inline-block; +} + +.bg-box.tulip { + background: url('http://i.imgur.com/9xYjgCk.jpg'); + background-size: cover; +} + +.bg-box.thunder-cloud { + background: url('../img/thunder-cloud.jpg'); + background-size: contain; +} + +.bg-box.multi { + background: + url("http://i.imgur.com/ZAVN3.png"), + url('http://i.imgur.com/6UdOxeB.png') bottom right, + url(https://picsum.photos/601/401/?random); + background-size: cover; +} + +.bg-box.blue { + background: #09F; +} + +.bg-box.gulls { + background-image: url('http://i.imgur.com/qKhkOKC.jpg'); + background-size: cover; +} diff --git a/vendor/desandro/imagesloaded/test/img/blue-shell.jpg b/vendor/desandro/imagesloaded/test/img/blue-shell.jpg Binary files differnew file mode 100644 index 000000000..b47f1e927 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/img/blue-shell.jpg diff --git a/vendor/desandro/imagesloaded/test/img/bowser-jr.jpg b/vendor/desandro/imagesloaded/test/img/bowser-jr.jpg Binary files differnew file mode 100644 index 000000000..b1de2a76f --- /dev/null +++ b/vendor/desandro/imagesloaded/test/img/bowser-jr.jpg diff --git a/vendor/desandro/imagesloaded/test/img/thunder-cloud.jpg b/vendor/desandro/imagesloaded/test/img/thunder-cloud.jpg Binary files differnew file mode 100644 index 000000000..54fc9a1b7 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/img/thunder-cloud.jpg diff --git a/vendor/desandro/imagesloaded/test/index.html b/vendor/desandro/imagesloaded/test/index.html new file mode 100644 index 000000000..02b04f4a6 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/index.html @@ -0,0 +1,104 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + + <title>imagesLoaded tests</title> + + <link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css" /> + <link rel="stylesheet" href="css/tests.css" /> + + <script src="../bower_components/ev-emitter/ev-emitter.js"></script> + <script src="../bower_components/qunit/qunit/qunit.js"></script> + <script src="../bower_components/jquery/dist/jquery.js"></script> + + <script src="../imagesloaded.js"></script> + + <script src="unit/basics.js"></script> + <script src="unit/selector-string.js"></script> + <script src="unit/single-element.js"></script> + <script src="unit/local-files.js"></script> + <script src="unit/data-uri.js"></script> + <script src="unit/append.js"></script> + <script src="unit/no-images.js"></script> + <script src="unit/jquery-success.js"></script> + <script src="unit/jquery-fail.js"></script> + <script src="unit/non-element.js"></script> + <script src="unit/background.js"></script> + +</head> +<body> + + <h1>imagesLoaded tests</h1> + + <div id="qunit"></div> + + <h2>Basics</h2> + + <div id="basics"> + <img src="http://i.imgur.com/xrQHn.jpg" /> + <img src="http://i.imgur.com/b3fBJ.jpg" /> + <img src="http://i.imgur.com/xmSh2.jpg" /> + <img src="http://i.imgur.com/iIpJm.jpg" /> + <img src="http://i.imgur.com/cvZZl10.gif" /> + </div> + + <img id="mario-with-shell" src="http://i.imgur.com/ZAVN3.png" > + + <h2>Locals</h2> + + <div id="locals"> + <img src="img/blue-shell.jpg" /> + <img src="img/bowser-jr.jpg" /> + <!-- thunder cloud has bad permissions, should 403 --> + <img src="img/not-there.jpg" /> + </div> + + <h2>Data URI</h2> + + <div id="data-uri"> + <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQ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XUoBl/9k=" /> + <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAAwCAMAAAC/knOqAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBQTFRFkF0QF27/Bgsp/fQF+fr6jqvpDEG2zp4CCx9Ys4IFo5JU8MqQXJH2Ulxj89QDC0bIsrKxIHn//fxztcv2iYqG5ebmCjCHzNjxAzTYRmih2drcCzijMof+OB8U/Pg59PHXE2D9xMK9eUMDAVf8kXNP/fvr2eP0p6WgOUtnAkX7Eljwa3WB5er2UXjVC0jZAh9/EFHa8PHyl5mZJVKt6NM34dzNz87NASGpsbzZDlDytq4tLWfs4bQFyLNp////+/v7DjziEwAAAEB0Uk5T////////////////////////////////////////////////////////////////////////////////////AMJ7sUQAAAPaSURBVHjadNWLdqo6EAZgQKGRA0YUYzRQY1ELqFykiojV93+rM0FQbLt/VlcvfpmVhGQq3V6TjgyjLOWyNIzR9sdn0stvE0MuQrmOZxmjf9pRybln+sJZspWZiSU7o7+twTmXtcU3BmhZ4f6/zLJk2ej+ttsyDIXVN4klsGzqmQP1ZXn9044TQbmcuS5Yx3Ic380cy2rj2qZJktzrui7MFqiDKlutcv1ip0mNseuGFbaedeVd235qGOMkAo4VJYB4AVcUbHG5erjxtN1ME8kwpgHybV0/63vbRF5QrUFk+7ADwpgGD82nva9+p4m+CQKYWFjwUH3YKYNkjPrnCr6/D4fz93f46WsKuIDqu8amPmGE5bnZr2u+fw2Hwwr3N4FYRZKsazshBLCggPv9S79K56saV+NRbU8McO6+ifSavL1dLtVQk2LYT7VtY/hcgnw8HgkGAL9Q2E78tDGJfWBV3CbiFwnqmzlsfmPXUDd2pTtUFAVVj6IIDtVNqmGtmW+aEYJQDZ9puM/gPTX7cNtBYeS7r+z+hVyfAp0+3gUsDsXKP5IXGLPne7uVUJf8TRFPEi1Ln1YVq/sbazzBbN8+v2LGjCguzNBtllVRwovoPtvnvcgYihlpLaueQeFRjY1f79vWhxfCGKpz54gVRYTZ7Nedn8JeiPNG7lhBGS2KIKdZ99edT6cKQjEiBGMf+UhhZRFQSnG02/60J9i0qmCMcsbimPGABkXIRYdQX+2EaaEcinOc57GWlWXpeR7cYqsUPWj0YksKN73QNEpLdZJer9d0rToeVC2LEG5+2rIqLjjXKKPJ6PrMxPJkK6DcsdSn3dIo5DnK8113de22tOHJWhyUDp88rBFFPEJxvruu0jYVOEE0tCyjsSMchQVBOZ3Px+MfeOehmHJLbs76LioKpuT5QND0hV4nnqZoGPrb3Z6iKNIUJc6Os5nA3ZfKTgCvGtq3Kuw2BIpMP5/O/8JGQEzC4N/BGuyuwAyZKYvtw/GOYc7A4RHf1ICNbUIi2blJqocJWt5Skm8OiyPo8aGufX/UQJvd9sSPZFUqKfGPcHRYPF0MBovT8VhXh3TT1cqgFM7kzESslEbqUezdyszJ4HvwKfhi8eCra0incwFm+1N9Hub9ztnffOqf+0/IY8BhpWbnTmfePjurs2iJZ922dXsPqQcMFouqWfbnLfst+ii05t7Stjd2lb0Y1Lt0hkA73y3bexNddzjs93S7yd5e9i4XaPFQ5tLqD5LohxfouG+S5G/u8T8+7l34Al25+7SHpVRlKS312fo4OA0Ws7Fe/1FaLg+V+l+AAQAurhhy+upm/wAAAABJRU5ErkJggg==" /> + </div> + + <h2>append</h2> + + <div id="append"></div> + + <h2>no images</h2> + + <div id="no-images"></div> + + <h2>jQuery success</h2> + + <div id="jquery-success"> + <img src="http://i.imgur.com/YbYCPFF.png" /> + <img src="http://i.imgur.com/6UdOxeB.png" /> + <img src="http://i.imgur.com/qd8G15D.png" /> + </div> + + <h2>jQuery fail</h2> + + <div id="jquery-fail"> + <img src="http://i.imgur.com/xmSh2.jpg" /> + <img src="img/bowser-jr.jpg" /> + <img src="http://i.imgur.com/ZAVN3.png"> + <img src="img/not-there.jpg" /> + <img src="foobar.jpg" /> + </div> + + <h2>background</h2> + + <div id="background"> + <div class="bg-box tulip"></div> + <div class="bg-box thunder-cloud"></div> + <div class="bg-box multi"></div> + <div class="bg-box blue"></div> + <div class="bg-box gulls"> + <img src="https://picsum.photos/400/300/?random" /> + <img src="https://picsum.photos/800/600/?random" /> + </div> + </div> + +</body> +</html> diff --git a/vendor/desandro/imagesloaded/test/unit/append.js b/vendor/desandro/imagesloaded/test/unit/append.js new file mode 100644 index 000000000..7a6b3c827 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/append.js @@ -0,0 +1,30 @@ +QUnit.test( 'append', function( assert ) { + 'use strict'; + + var imgUrls = [ + 'http://i.imgur.com/bwy74ok.jpg', + 'http://i.imgur.com/bAZWoqx.jpg', + 'http://i.imgur.com/PgmEBSB.jpg', + 'http://i.imgur.com/aboaFoB.jpg', + 'http://i.imgur.com/LkmcILl.jpg', + 'http://i.imgur.com/q9zO6tw.jpg' + ]; + + // create images + var fragment = document.createDocumentFragment(); + for ( var i=0, len = imgUrls.length; i < len; i++ ) { + var img = document.createElement('img'); + img.src = imgUrls[i]; + fragment.appendChild( img ); + } + + var elem = document.querySelector('#append'); + elem.appendChild( fragment ); + var done = assert.async(); + + imagesLoaded( elem, { debug: false } ).on( 'always', function() { + assert.ok( 'appended images loaded' ); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/background.js b/vendor/desandro/imagesloaded/test/unit/background.js new file mode 100644 index 000000000..ca76fad6f --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/background.js @@ -0,0 +1,70 @@ +QUnit.test( 'background', function( assert ) { + 'use strict'; + + // from Modernizr + var supportsMultiBGs = ( function() { + var style = document.createElement('a').style; + style.cssText = 'background:url(https://),url(https://),red url(https://)'; + return (/(url\s*\(.*?){3}/).test(style.background); + })(); + + var multiBGCount = supportsMultiBGs ? 3 : 0; + var done = assert.async( 14 + multiBGCount ); + + var imgLoad0 = imagesLoaded( '#background .tulip', { background: true }, function() { + assert.ok( true, 'callback triggered on .orange-tree'); + done(); + }); + assert.equal( imgLoad0.images.length, 1, '1 image on .images' ); + + imgLoad0.on( 'progress', function( instance, image, element ) { + assert.ok( element.nodeName == 'DIV', 'progress; element is div'); + assert.ok( image.isLoaded, 'progress; image.isLoaded'); + done(); + }); + + var imgLoad1 = imagesLoaded( '#background .thunder-cloud', { background: true }, function() { + assert.ok( true, 'callback triggered on .thunder-cloud'); + done(); + }); + assert.equal( imgLoad1.images.length, 1, '1 image on .images' ); + + // multiple backgrounds + var imgLoad2 = imagesLoaded( '#background .multi', { background: true }, function() { + assert.ok( true, 'callback triggered on .multi'); + done(); + }); + assert.equal( imgLoad2.images.length, multiBGCount, 'correct multiple BG count on .images' ); + + // multiple elements + var imgLoad3 = imagesLoaded( '#background .bg-box', { background: true }, function() { + assert.ok( true, 'callback triggered on .bg-box'); + var count = 5 + multiBGCount; + assert.equal( imgLoad3.images.length, count, count + ' images on .bg-box' ); + done(); + }); + + imgLoad3.on('progress', function( instance, image/*, element */) { + assert.ok( true, 'progress on .bg-box; ' + image.img.src ); + assert.equal( image.isLoaded, true, 'image.isLoaded == true' ); + done(); + }); + + // background and <img> children + var imgLoad4 = imagesLoaded( '#background .gulls', { background: true } ); + assert.equal( imgLoad4.images.length, 3, '3 images: 1 background and 2 <img>' ); + + imgLoad4.on( 'progress', function( instance, image ) { + assert.equal( image.isLoaded, true, 'image is loaded' ); + done(); + }); + + // child background selector + var imgLoad5 = imagesLoaded( '#background', { background: '.bg-box' }, function() { + var count = 5 + multiBGCount; + assert.equal( imgLoad5.images.length, count, + count + ' images on .bg-box, with {background: .bg-box}' ); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/basics.js b/vendor/desandro/imagesloaded/test/unit/basics.js new file mode 100644 index 000000000..6c502a793 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/basics.js @@ -0,0 +1,28 @@ +QUnit.test( 'basics', function( assert ) { + + 'use strict'; + + var elem = document.querySelector('#basics'); + var images = elem.querySelectorAll('img'); + var done = assert.async( 3 + images.length ); + + var imgLoader = new imagesLoaded( elem, function( obj ) { + assert.ok( true, 'callback function triggered' ); + assert.equal( imgLoader, obj, 'callback argument and instance match' ); + done(); + }); + imgLoader.on( 'done', function() { + assert.ok( true, 'done event triggered' ); + done(); + }); + imgLoader.on( 'always', function() { + assert.ok( true, 'always event triggered' ); + done(); + }); + + imgLoader.on( 'progress', function( loader, image ) { + assert.ok( image.isLoaded, 'image is loaded'); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/data-uri.js b/vendor/desandro/imagesloaded/test/unit/data-uri.js new file mode 100644 index 000000000..635f69859 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/data-uri.js @@ -0,0 +1,10 @@ +QUnit.test( 'data-uri', function( assert ) { + 'use strict'; + + var done = assert.async(); + imagesLoaded('#data-uri', { debug: false }).on( 'done', function( obj ) { + assert.ok( true, 'data-uri images loaded' ); + assert.equal( obj.images.length, 2, 'instance has 2 images' ); + done(); + }); +}); diff --git a/vendor/desandro/imagesloaded/test/unit/jquery-fail.js b/vendor/desandro/imagesloaded/test/unit/jquery-fail.js new file mode 100644 index 000000000..b2180f6f2 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/jquery-fail.js @@ -0,0 +1,29 @@ +QUnit.test( 'jquery fail', function( assert ) { + + 'use strict'; + + var $ = window.jQuery; + var $images = $('#jquery-fail img'); + var done = assert.async( 3 + $images.length ); + + $('#jquery-fail').imagesLoaded( function( instance ) { + assert.ok( true, 'callback triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .fail( function( instance ) { + assert.ok( true, 'fail triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .always( function( instance ) { + assert.ok( true, 'always triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .progress( function(/* instance, image */) { + assert.ok( true, 'progress trigged'); + done(); + }); + + }); diff --git a/vendor/desandro/imagesloaded/test/unit/jquery-success.js b/vendor/desandro/imagesloaded/test/unit/jquery-success.js new file mode 100644 index 000000000..f16621088 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/jquery-success.js @@ -0,0 +1,28 @@ +QUnit.test( 'jquery success', function( assert ) { + + 'use strict'; + + var $ = window.jQuery; + var done = assert.async( 6 ); + + $('#jquery-success').imagesLoaded( function( instance ) { + assert.ok( true, 'callback triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .done( function( instance ) { + assert.ok( true, 'done triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .always( function( instance ) { + assert.ok( true, 'always triggered' ); + assert.ok( instance instanceof imagesLoaded, 'instance instanceof imagesLoaded' ); + done(); + }) + .progress( function( instance, image ) { + assert.ok( image.isLoaded, 'progress trigged, image is loaded'); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/local-files.js b/vendor/desandro/imagesloaded/test/unit/local-files.js new file mode 100644 index 000000000..61da6ae92 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/local-files.js @@ -0,0 +1,31 @@ +QUnit.test( 'local files', function( assert ) { + 'use strict'; + + var elem = document.querySelector('#locals'); + var done = assert.async( 6 ); + + var imgLoader = new imagesLoaded( elem, function( obj ) { + assert.ok( true, 'callback function triggered' ); + assert.equal( imgLoader, obj, 'callback argument and instance match' ); + done(); + }); + imgLoader.on( 'fail', function() { + assert.ok( true, 'fail event triggered' ); + done(); + }); + imgLoader.on( 'always', function() { + assert.ok( true, 'always event triggered' ); + done(); + }); + + imgLoader.on( 'progress', function( loader, image ) { + assert.ok( true, 'image progressed'); + if ( image.img.src.indexOf('img/not-there.jpg') !== -1 ) { + assert.ok( !image.isLoaded, 'thunder cloud is not loaded' ); + } else { + assert.ok( image.isLoaded, 'image is loaded' ); + } + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/no-images.js b/vendor/desandro/imagesloaded/test/unit/no-images.js new file mode 100644 index 000000000..841216381 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/no-images.js @@ -0,0 +1,11 @@ +QUnit.test( 'no images', function( assert ) { + 'use strict'; + + var elem = document.querySelector('#no-images'); + var done = assert.async(); + imagesLoaded( elem, function() { + assert.ok( true, 'triggered with no images' ); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/non-element.js b/vendor/desandro/imagesloaded/test/unit/non-element.js new file mode 100644 index 000000000..4c9986fa6 --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/non-element.js @@ -0,0 +1,24 @@ +QUnit.test( 'dismiss non-element nodes', function( assert ) { + 'use strict'; + + var $ = window.jQuery; + var done = assert.async( 2 ); + + $(' <img src="https://picsum.photos/401/301/?random" /> <img src="https://picsum.photos/402/302/?random" /> ') + .imagesLoaded(function() { + assert.ok( true, 'elements from jQuery string ok' ); + done(); + }); + + // test fragment + var frag = document.createDocumentFragment(); + var img = new Image(); + img.src = 'https://picsum.photos/403/303/?random'; + frag.appendChild( img ); + var imgLoad = imagesLoaded( frag, function() { + assert.ok( true, 'document fragment ok' ); + assert.equal( imgLoad.images.length, 1, '1 image found' ); + done(); + }); + +}); diff --git a/vendor/desandro/imagesloaded/test/unit/selector-string.js b/vendor/desandro/imagesloaded/test/unit/selector-string.js new file mode 100644 index 000000000..8c43c4bef --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/selector-string.js @@ -0,0 +1,12 @@ +QUnit.test( 'selector string', function( assert ) { + 'use strict'; + var images = document.querySelectorAll('#basics img'); + var done = assert.async(); + var imgLoad = imagesLoaded('#basics', { debug: true }).on( 'done', function( obj ) { + assert.ok( true, 'selector string worked' ); + assert.ok( obj.images, 'argument has images' ); + assert.equal( obj.images.length, images.length, 'images.length matches' ); + done(); + }); + assert.ok( imgLoad.options.debug, 'debug option set' ); +}); diff --git a/vendor/desandro/imagesloaded/test/unit/single-element.js b/vendor/desandro/imagesloaded/test/unit/single-element.js new file mode 100644 index 000000000..42d7e48ee --- /dev/null +++ b/vendor/desandro/imagesloaded/test/unit/single-element.js @@ -0,0 +1,11 @@ +QUnit.test( 'single element', function( assert ) { + 'use strict'; + var elem = document.querySelector('#mario-with-shell'); + var done = assert.async(); + imagesLoaded( elem ).on( 'done', function( obj ) { + assert.ok( true, 'single element worked' ); + assert.ok( obj.images, 'argument has images' ); + assert.equal( obj.images.length, 1, 'images.length = 1' ); + done(); + }); +}); |