Update web-platform-tests to revision 81962ac8802223d038b188b6f9cb88a0a9c5beee

This commit is contained in:
WPT Sync Bot 2018-05-18 22:02:29 -04:00
parent fe1a057bd1
commit 24183668c4
1960 changed files with 29853 additions and 10555 deletions

View file

@ -42,8 +42,8 @@
element = document.createElement('span');
function canSetProperty(propertyName) {
element.style.setProperty(propertyName, 'initial');
function canSetProperty(propertyName, priority) {
element.style.setProperty(propertyName, 'initial', priority);
return element.style.getPropertyValue(propertyName) == 'initial';
}
@ -56,13 +56,21 @@
var propertyName = shorthandProperties[i];
test(function(){
assert_true(canSetProperty(propertyName), 'can setPropertyValue with shorthand');
assert_true(canSetProperty(propertyName, ''), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be set with setProperty');
test(function(){
assert_true(canRemoveProperty(propertyName), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be removed with removeProperty');
test(function(){
assert_true(canSetProperty(propertyName, 'important'), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be set with setProperty and priority !important');
test(function(){
assert_true(canRemoveProperty(propertyName), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be removed with removeProperty even when set with !important');
}
</script>
</body>

View file

@ -11,6 +11,8 @@
"preferredStyleSheetSet",
"styleSheetSets",
"enableStyleSheetsForSet",
"selectedStylesheetSet",
"preferredStylesheetSet",
].forEach(function(name) {
test(function() {
assert_false(name in document);

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/cssom/#add-a-css-style-sheet">
<link rel="help" href="https://drafts.csswg.org/cssom/#create-a-css-style-sheet">
<link rel="help" href="https://html.spec.whatwg.org/#update-a-style-block">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="t1">This text should be green</div>
<script>
function createStyleElement(text, title) {
var elm = document.createElement("style");
elm.setAttribute("title", title);
elm.appendChild(document.createTextNode(text));
return elm;
}
test(function() {
document.head.appendChild(createStyleElement("#t1 {color:green}", "preferred"));
document.head.appendChild(createStyleElement("#t1 {color:red}", "notpreferred"));
assert_equals(getComputedStyle(t1).color, "rgb(0, 128, 0)");
}, "Preferred stylesheet where insertion order is reversed tree order");
</script>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/cssom/#add-a-css-style-sheet">
<link rel="help" href="https://drafts.csswg.org/cssom/#create-a-css-style-sheet">
<link rel="help" href="https://html.spec.whatwg.org/#update-a-style-block">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="t1">This text should be green</div>
<script>
function createStyleElement(text, title) {
var elm = document.createElement("style");
elm.setAttribute("title", title);
elm.appendChild(document.createTextNode(text));
return elm;
}
test(function() {
document.head.insertBefore(createStyleElement("#t1 {color:green}", "preferred"), document.head.firstChild);
document.head.insertBefore(createStyleElement("#t1 {color:red}", "notpreferred"), document.head.firstChild);
assert_equals(getComputedStyle(t1).color, "rgb(0, 128, 0)");
}, "Preferred stylesheet where insertion order is tree order");
</script>

View file

@ -0,0 +1,39 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: StyleSheet's title attribute</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://drafts.csswg.org/cssom/#preferred-css-style-sheet-set-name">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-style-title">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style></style>
<style title=""></style>
<style title="Preferred">
p { color: green; }
</style>
<style title="Not preferred">
p { color: red; }
</style>
<p id="test-element">Should be green</p>
<script>
test(function() {
assert_equals(
getComputedStyle(document.getElementById("test-element")).color,
"rgb(0, 128, 0)",
"Preferred style should apply"
);
}, "Preferred style sheet name");
test(function() {
let sheets = document.styleSheets;
let styleElements = Array.from(document.querySelectorAll("style"));
assert_equals(sheets.length, styleElements.length);
for (let i = 0; i < sheets.length; ++i) {
let titleAttr = styleElements[i].getAttribute("title");
if (titleAttr === null || titleAttr === "")
assert_equals(sheets[i].title, null, "Empty title returns null");
else
assert_equals(sheets[i].title, titleAttr, "Selected title is properly reflected");
}
}, "StyleSheet.title");
</script>