Commit bb21e287 authored by hyatt's avatar hyatt
Browse files

Add layout test for better background dumping.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0beef8a8
ALERT: 50% 50% blue
This page tests whether or not the background shorthand properly omits initial values.
PASS: document.body.style.background == 'green' should be true and is.
PASS: document.getElementById('div1').style.background == 'repeat-x, repeat-y white' should be true and is.
PASS: document.getElementById('div2').style.background == '50% 50% blue' should be true and is.
<html>
<head>
<script>
function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(a, b)
{
var evalA;
try {
evalA = eval(a);
} catch(e) {
evalA = e;
}
if (evalA == b)
print("PASS: " + a + " should be " + b + " and is.", "green");
else
print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
}
function test()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
shouldBe("document.body.style.background == 'green'", true);
shouldBe("document.getElementById('div1').style.background == 'repeat-x, repeat-y white'", true);
shouldBe("document.getElementById('div2').style.background == '50% 50% blue'", true);
}
</script>
</head>
<body onload="test();" style="background: green; color:white">
<div id="div1" style="background-repeat: repeat-x, repeat-y; background-color:white"></div>
<div id="div2" style="background: 50% 50% blue"></div>
<script>
alert(document.getElementById('div2').style.background);
</script>
<p>This page tests whether or not the background shorthand properly omits
initial values.
<hr>
<div id='console' style="background-color:white; border:2px solid black"></div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment