@@ -24,7 +24,7 @@ suite('CSSImageValue', function() {
24
24
assert . instanceOf ( new typedOM . internal . CSSImageValue ( new Image ( ) ) , CSSStyleValue ) ;
25
25
} ) ;
26
26
27
- test ( 'CSSImageValue only accepts Image object ' , function ( ) {
27
+ test ( 'CSSImageValue only accepts Image objects ' , function ( ) {
28
28
var imageErr = / i m a g e m u s t b e a n I m a g e o b j e c t / ;
29
29
assert . throws ( function ( ) { new typedOM . internal . CSSImageValue ( ) ; } , TypeError , imageErr ) ;
30
30
assert . throws ( function ( ) { new typedOM . internal . CSSImageValue ( 1 ) ; } , TypeError , imageErr ) ;
@@ -33,7 +33,21 @@ suite('CSSImageValue', function() {
33
33
assert . throws ( function ( ) { new typedOM . internal . CSSImageValue ( { x : 1 , y : 2 } ) ; } , TypeError , imageErr ) ;
34
34
} ) ;
35
35
36
- test ( 'CSSImageValue\'s state and dimensions are correct before and after loaded' , function ( done ) {
36
+ /*
37
+ test('Can accept an already loaded image', function(done) {
38
+ var image = new Image();
39
+ //image.src = "resources/1x1-green.png";
40
+ image.onload = function() {
41
+ var cssImageValue = new typedOM.internal.CSSImageValue(image);
42
+ assert.strictEqual(image.state, "loaded");
43
+ assert.strictEqual(image.intrinsicWidth, 1);
44
+ assert.strictEqual(image.intrinsicHeight, 1);
45
+ assert.strictEqual(image.intrinsicRatio, 1);
46
+ done();
47
+ };
48
+ });*/
49
+
50
+ test ( 'State and dimensions are correct before and after loading' , function ( done ) {
37
51
var image = new typedOM . internal . CSSImageValue ( new Image ( ) ) ;
38
52
assert . strictEqual ( image . state , "unloaded" ) ;
39
53
assert . strictEqual ( image . intrinsicWidth , null ) ;
@@ -44,7 +58,7 @@ suite('CSSImageValue', function() {
44
58
image . _image . onload = function ( ) {
45
59
oldOnload ( ) ;
46
60
assert . strictEqual ( image . state , "loaded" ) ;
47
- assert . strictEqual ( image . intrinsicWidth , 1 ) ;
61
+ assert . strictEqual ( image . intrinsicWidth , 2 ) ;
48
62
assert . strictEqual ( image . intrinsicHeight , 1 ) ;
49
63
assert . strictEqual ( image . intrinsicRatio , 1 ) ;
50
64
done ( ) ;
0 commit comments