From c77e860582e4bed8f842f9ba90f4a5aa073411c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Vostr=CC=8Cel?= Date: Sun, 6 Nov 2011 00:35:10 +0100 Subject: [PATCH] As suggested by @cindreta added `width` and `height` attributes to the preload placeholder ``s to possibly facilitate the speed benefit of loading images with pre-defined dimensions. Using stage dimensions. #10 --- test/unit/rendering.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/unit/rendering.js b/test/unit/rendering.js index 1add0326..b819e49f 100644 --- a/test/unit/rendering.js +++ b/test/unit/rendering.js @@ -196,4 +196,20 @@ }); }); + asyncTest( 'Preload cache `img`s have defined stage dimensions #10', function(){ + expect(3); + var + $reel= $('#image').reel() + + $reel.bind('loaded', function(){ + var + $cached= $reel.siblings('img[width][height]') + + equal($cached.length, 1, 'Image has dimensions'); + equal($cached.attr('width'), $reel.data('dimensions').x, 'Width equals') + equal($cached.attr('height'), $reel.data('dimensions').y, 'Height equals') + start(); + }); + }); + })(jQuery);