mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision 7bfa241671d6ca921229f6601d2d7b70dd55da90
This commit is contained in:
parent
f78dd6142e
commit
441c1fa235
47 changed files with 888 additions and 163 deletions
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Attribute mapping</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#legacy-mathml-style-attributes">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
|
||||
<meta name="assert" content="Verify that dir, mathcolor, mathbackground and mathsize are mapped to CSS">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/mathml-fragments.js"></script>
|
||||
<style>
|
||||
#container {
|
||||
color: blue;
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
function runTests() {
|
||||
var container = document.getElementById("container");
|
||||
for (tag in MathMLFragments) {
|
||||
container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
|
||||
}
|
||||
Array.from(document.getElementsByClassName("element")).forEach(element => {
|
||||
var tag = element.tagName;
|
||||
var style = window.getComputedStyle(element);
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("direction"), "ltr", "no attribute");
|
||||
element.setAttribute("dir", "rtl");
|
||||
assert_equals(style.getPropertyValue("direction"), "rtl", "attribute specified");
|
||||
}, `dir on the ${tag} element is mapped to CSS direction`)
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("color"), "rgb(0, 0, 255)", "no attribute");
|
||||
element.setAttribute("mathcolor", "black");
|
||||
assert_equals(style.getPropertyValue("color"), "rgb(0, 0, 0)", "attribute specified");
|
||||
}, `mathcolor on the ${tag} element is mapped to CSS color`);
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("background-color"), "rgba(0, 0, 0, 0)", "no attribute");
|
||||
element.setAttribute("mathbackground", "lightblue");
|
||||
assert_equals(style.getPropertyValue("background-color"), "rgb(173, 216, 230)", "attribute specified");
|
||||
}, `mathbackground on the ${tag} element is mapped to CSS background-color`);
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("font-size"), "50px", "no attribute");
|
||||
element.setAttribute("mathsize", "20px");
|
||||
assert_equals(style.getPropertyValue("font-size"), "20px", "attribute specified");
|
||||
}, `mathsize on the ${tag} element is mapped to CSS font-size`);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="container">
|
||||
<math class="element"></math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Attribute mapping</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-mathvariant-attribute">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
|
||||
<meta name="assert" content="Verify that mathvariant, scriptlevel, displaystyle are mapped to CSS">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/mathml-fragments.js"></script>
|
||||
<script>
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
function runTests() {
|
||||
var container = document.getElementById("container");
|
||||
for (tag in MathMLFragments) {
|
||||
container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
|
||||
}
|
||||
Array.from(document.getElementsByClassName("element")).forEach(element => {
|
||||
var tag = element.tagName;
|
||||
var style = window.getComputedStyle(element);
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("text-transform"), "none", "no attribute");
|
||||
element.setAttribute("mathvariant", "fraktur");
|
||||
assert_equals(style.getPropertyValue("text-transform"), "math-fraktur", "attribute specified");
|
||||
}, `mathvariant on the ${tag} element is mapped to CSS text-transform`)
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("math-script-level"), "0", "no attribute");
|
||||
element.setAttribute("scriptlevel", "10");
|
||||
assert_equals(style.getPropertyValue("math-script-level"), "10", "attribute specified");
|
||||
}, `scriptlevel on the ${tag} element is mapped to CSS math-script-level`);
|
||||
|
||||
test(function() {
|
||||
assert_equals(style.getPropertyValue("math-style"), "inline", "no attribute");
|
||||
element.setAttribute("displaystyle", "true");
|
||||
assert_equals(style.getPropertyValue("math-style"), "display", "attribute specified");
|
||||
}, `displaystyle on the ${tag} element is mapped to CSS math-style`);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="container">
|
||||
<math class="element"></math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -57,10 +57,10 @@
|
|||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border"
|
||||
style="border-left: 20px;
|
||||
border-right: 30px;
|
||||
border-top: 40px;
|
||||
border-bottom: 50px;">
|
||||
style="border-left: 20px solid transparent;
|
||||
border-right: 30px solid transparent;
|
||||
border-top: 40px solid transparent;
|
||||
border-bottom: 50px solid transparent;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-shorthand"
|
||||
style="border: 20px;">
|
||||
style="border: 20px solid transparent;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
|
@ -80,10 +80,10 @@
|
|||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-logical"
|
||||
style="border-inline-start: 20px;
|
||||
border-inline-end: 30px;
|
||||
border-block-start: 40px;
|
||||
border-block-end: 50px;">
|
||||
style="border-inline-start: 20px solid transparent;
|
||||
border-inline-end: 30px solid transparent;
|
||||
border-block-start: 40px solid transparent;
|
||||
border-block-end: 50px solid transparent;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
|
@ -93,8 +93,8 @@
|
|||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-logical-shorthand"
|
||||
style="border-inline: 20px;
|
||||
border-block: 30px;">
|
||||
style="border-inline: 20px solid transparent;
|
||||
border-block: 30px solid transparent;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue