mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dynamically changing HTMLStyleElement.media should change the rendering accordingly</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
|
||||
<style>
|
||||
span {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<style id="text-style" media="none">
|
||||
span {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
<style id="body-style" media="aural">
|
||||
body {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<span>text</span>
|
||||
<script>
|
||||
test(function() {
|
||||
var element = document.querySelector("span");
|
||||
assert_equals(getComputedStyle(element).color, "rgb(255, 0, 0)");
|
||||
document.getElementById("text-style").media = 'all';
|
||||
assert_equals(getComputedStyle(element).color, "rgb(0, 128, 0)");
|
||||
}, "change media value dynamically");
|
||||
|
||||
test(function() {
|
||||
var style = document.getElementById("body-style");
|
||||
assert_not_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
style.removeAttribute("media");
|
||||
assert_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
}, "removing media attribute");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Non-matching media type should have stylesheet</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style media="unknown">
|
||||
body { color: green }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title><style> type="" edge cases</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#update-a-style-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<style>
|
||||
#test1 { color: rgb(0, 128, 0); }
|
||||
</style>
|
||||
|
||||
<style type="">
|
||||
#test2 { color: rgb(0, 128, 0); }
|
||||
</style>
|
||||
|
||||
<style type="TEXT/CsS">
|
||||
#test3 { color: rgb(0, 128, 0); }
|
||||
</style>
|
||||
|
||||
<style type=" text/css ">
|
||||
#test4 { color: rgb(0, 128, 0); }
|
||||
</style>
|
||||
|
||||
<style type="text/css; charset=utf-8">
|
||||
#test5 { color: rgb(0, 128, 0); }
|
||||
</style>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="test1"></div>
|
||||
<div id="test2"></div>
|
||||
<div id="test3"></div>
|
||||
<div id="test4"></div>
|
||||
<div id="test5"></div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(() => {
|
||||
assertApplied("test1");
|
||||
}, "With no type attribute, the style should apply");
|
||||
|
||||
test(() => {
|
||||
assertApplied("test2");
|
||||
}, "With an empty type attribute, the style should apply");
|
||||
|
||||
test(() => {
|
||||
assertApplied("test3");
|
||||
}, "With a mixed-case type attribute, the style should apply");
|
||||
|
||||
test(() => {
|
||||
assertNotApplied("test4");
|
||||
}, "With a whitespace-surrounded type attribute, the style should not apply");
|
||||
|
||||
test(() => {
|
||||
assertNotApplied("test5");
|
||||
}, "With a charset parameter in the type attribute, the style should not apply");
|
||||
|
||||
function getColor(id) {
|
||||
return window.getComputedStyle(document.getElementById(id)).color;
|
||||
}
|
||||
|
||||
function assertApplied(id) {
|
||||
assert_equals(getColor(id), "rgb(0, 128, 0)");
|
||||
}
|
||||
|
||||
function assertNotApplied(id) {
|
||||
assert_not_equals(getColor(id), "rgb(0, 128, 0)");
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dynamically changing HTMLStyleElement.type should change the rendering accordingly</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
|
||||
<style type="no/mime">
|
||||
body { color: green }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
Text content.
|
||||
<script>
|
||||
var style = document.querySelector("style");
|
||||
test(function() {
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
}, "Check initial styleSheets length type");
|
||||
|
||||
test(function() {
|
||||
assert_not_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
style.type = "text/css";
|
||||
assert_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
}, "Change type from invalid type to valid type");
|
||||
|
||||
test(function() {
|
||||
assert_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
style.type = "no/mime";
|
||||
assert_not_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
}, "Change type from valid type to invalid type");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue