4 function print(message
, color
)
6 var paragraph
= document
.createElement("div");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 paragraph
.style
.fontFamily
= "monospace";
10 paragraph
.style
.color
= color
;
11 document
.getElementById("console").appendChild(paragraph
);
14 function shouldBe(a
, b
)
24 print("PASS: " + a
+ " should be " + b
+ " and is.", "green");
26 print("FAIL: " + a
+ " should be " + b
+ " but instead is " + evalA
+ ".", "red");
31 if (window
.testRunner
)
32 testRunner
.dumpAsText();
34 shouldBe("document.body.style.background == 'green'", true);
35 shouldBe("document.getElementById('div1').style.background == ''", true);
36 shouldBe("document.getElementById('div2').style.background == '50% 50% blue'", true);
37 shouldBe("document.getElementById('div3').style.background == 'none repeat scroll rgb(255, 255, 255)'", true);
42 <body onload=
"test();" style=
"background: green; color:white">
44 <div id=
"div1" style=
"background-repeat: repeat-x, repeat-y; background-color:white"></div>
45 <div id=
"div2" style=
"background: 50% 50% blue"></div>
46 <div id=
"div3" style=
"background: rgb(255, 255, 255) none repeat scroll"></div>
48 <p>This page tests whether or not the background shorthand properly omits
52 <div id='console'
style=
"background-color:white; border:2px solid black"></div>