summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/shorthand-setProperty-important.html
blob: c0e00ca859eaaa1f61c83e8dfaaf90949ccc8c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>

description("Verify that the priority parameter is a case-insensitive match to 'important' or the empty string.");

var testContainer = document.createElement("div");
document.body.appendChild(testContainer);

testContainer.innerHTML = '<div id="test">hello</div>';

e = document.getElementById('test');

// Test "important" strictness
e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", "!important");
shouldBeEqualToString("e.style.getPropertyValue('border-bottom-style')", "");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "''");

e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", "very important");
shouldBeEqualToString("e.style.getPropertyValue('border-bottom-style')", "");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "''");

e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", "impORTANT");
shouldBe("e.style.getPropertyValue('border-bottom-style')", "'solid'");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "'important'");

e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", "random");
shouldBeEqualToString("e.style.getPropertyValue('border-bottom-style')", "");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "''");

e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", "undefined");
shouldBeEqualToString("e.style.getPropertyValue('border-bottom-style')", "");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "''");

e.style.borderBottomStyle = "";
e.style.setProperty("border-bottom-style", "solid", undefined);
shouldBe("e.style.getPropertyValue('border-bottom-style')", "'solid'");
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "''");

document.body.removeChild(testContainer);
</script>
</body>
</html>