@@ -16,15 +16,60 @@ asyncTest('Test CSS Backgrounds', function () {
16
16
} , 'throws exception - elements are not images and do not have a background image' ) ;
17
17
18
18
19
- // Test for multiple backgrounds
19
+ // Tests for multiple backgrounds
20
20
var multiple = document . querySelector ( '.test--css-backgrounds .css-background--multiple' ) ;
21
21
22
22
throws ( function ( ) {
23
23
BackgroundCheck . init ( {
24
24
targets : '.test .target' ,
25
25
images : multiple
26
26
} ) ;
27
- } , 'throws exception - multiple backgrounds are not supported' ) ;
27
+ } , 'throws exception - multiple backgrounds are not supported (1)' ) ;
28
+
29
+ throws ( function ( ) {
30
+ multiple . style . backgroundImage = 'url(../examples/build/images/1.jpg), url(' + window . DataURI + ')' ;
31
+
32
+ BackgroundCheck . init ( {
33
+ targets : '.test .target' ,
34
+ images : multiple
35
+ } ) ;
36
+ } , 'throws exception - multiple backgrounds are not supported (2)' ) ;
37
+
38
+ throws ( function ( ) {
39
+ multiple . style . backgroundImage = 'url(' + window . DataURI + '), url(../examples/build/images/1.jpg)' ;
40
+
41
+ BackgroundCheck . init ( {
42
+ targets : '.test .target' ,
43
+ images : multiple
44
+ } ) ;
45
+ } , 'throws exception - multiple backgrounds are not supported (3)' ) ;
46
+
47
+ throws ( function ( ) {
48
+ multiple . style . backgroundImage = 'url(' + window . DataURI + '), url(' + window . DataURI + ')' ;
49
+
50
+ BackgroundCheck . init ( {
51
+ targets : '.test .target' ,
52
+ images : multiple
53
+ } ) ;
54
+ } , 'throws exception - multiple backgrounds are not supported (4)' ) ;
55
+
56
+ throws ( function ( ) {
57
+ multiple . style . backgroundImage = 'url(' + window . DataURI + '), url(' + window . DataURI + '), url(' + window . DataURI + ')' ;
58
+
59
+ BackgroundCheck . init ( {
60
+ targets : '.test .target' ,
61
+ images : multiple
62
+ } ) ;
63
+ } , 'throws exception - multiple backgrounds are not supported (5)' ) ;
64
+
65
+ throws ( function ( ) {
66
+ multiple . style . backgroundImage = 'url(../examples/build/images/1.jpg), url(../examples/build/images/1.jpg), url(../examples/build/images/1.jpg)' ;
67
+
68
+ BackgroundCheck . init ( {
69
+ targets : '.test .target' ,
70
+ images : multiple
71
+ } ) ;
72
+ } , 'throws exception - multiple backgrounds are not supported (6)' ) ;
28
73
29
74
30
75
// Create elements first
@@ -36,12 +81,15 @@ asyncTest('Test CSS Backgrounds', function () {
36
81
var element ;
37
82
var dash ;
38
83
var snippet ;
84
+ var url ;
39
85
40
86
for ( var e = 0 ; e < examples . length ; e ++ ) {
41
87
snippet = snippets [ e ] . innerHTML ;
42
88
89
+ url = image === 1 ? window . DataURI : '../examples/build/images/' + image + '.jpg' ;
90
+
43
91
element = document . createElement ( 'div' ) ;
44
- element . style . backgroundImage = 'url("../examples/build/images/ ' + image + '.jpg" )' ;
92
+ element . style . backgroundImage = 'url(' + url + ')' ;
45
93
element . className = 'css-background-image' ;
46
94
47
95
css = snippet . split ( ';' ) ;
0 commit comments