forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[css-cascade] parsing tests for 'all' property
- Loading branch information
1 parent
e347325
commit 5ecb1f7
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Cascading and Inheritance Level 3: parsing all with invalid values</title> | ||
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-cascade-3/#propdef-all"> | ||
<meta name="assert" content="all supports only the grammar 'initial | inherit | unset'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_invalid_value("all", "auto"); | ||
test_invalid_value("all", "none"); | ||
test_invalid_value("all", "filter"); | ||
test_invalid_value("all", "unset inherit"); | ||
test_invalid_value("all", "inherit initial"); | ||
test_invalid_value("all", "initial unset"); | ||
test_invalid_value("all", "opacity transform"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Cascading and Inheritance Level 3: parsing all with valid values</title> | ||
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-cascade-3/#propdef-all"> | ||
<meta name="assert" content="all supports the full grammar 'initial | inherit | unset'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_valid_value("all", "initial"); | ||
test_valid_value("all", "inherit"); | ||
test_valid_value("all", "unset"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
// serializedValue can be the expected serialization of value, | ||
// or an array of permitted serializations, | ||
// or omitted if value should serialize as value. | ||
function test_valid_value(property, value, serializedValue) { | ||
if (arguments.length < 3) | ||
serializedValue = value; | ||
|
||
var stringifiedValue = JSON.stringify(value); | ||
|
||
test(function(){ | ||
var div = document.createElement('div'); | ||
div.style[property] = value; | ||
assert_not_equals(div.style.getPropertyValue(property), "", "property should be set"); | ||
|
||
var div = document.createElement('div'); | ||
div.style[property] = value; | ||
var readValue = div.style.getPropertyValue(property); | ||
if (serializedValue instanceof Array) | ||
assert_in_array(readValue, serializedValue, "serialization should be sound"); | ||
else | ||
assert_equals(readValue, serializedValue, "serialization should be canonical"); | ||
|
||
div.style[property] = readValue; | ||
assert_equals(div.style.getPropertyValue(property), readValue, "serialization should round-trip"); | ||
|
||
}, "e.style['" + property + "'] = " + stringifiedValue + " should set the property value"); | ||
} | ||
|
||
function test_invalid_value(property, value) { | ||
var stringifiedValue = JSON.stringify(value); | ||
|
||
test(function(){ | ||
var div = document.createElement('div'); | ||
div.style[property] = value; | ||
assert_equals(div.style.getPropertyValue(property), ""); | ||
}, "e.style['" + property + "'] = " + stringifiedValue + " should not set the property value"); | ||
} |