mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 097043b336e46876e281ddec3bb014fe9c480128
This commit is contained in:
parent
ecd32570c0
commit
b68253eac0
405 changed files with 9164 additions and 3050 deletions
|
@ -0,0 +1,59 @@
|
|||
<!doctype html>
|
||||
<title>align attribute mapping on replaced elements</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<img id="replaced" src="/images/green.png">
|
||||
<something id="non-replaced"></something>
|
||||
<script>
|
||||
const kMapping = {
|
||||
"left": ["float", "left"],
|
||||
"right": ["float", "right"],
|
||||
|
||||
"top": ["vertical-align", "top"],
|
||||
|
||||
// This one requires a magic value (`-moz-middle-with-baseline` on Gecko,
|
||||
// `-webkit-baseline-middle` on WebKit-based browsers).
|
||||
"middle": ["vertical-align", undefined],
|
||||
// These are inconsistent across browsers. WebKit maps it to "middle", Gecko
|
||||
// to the aforementioned value.
|
||||
"center": ["vertical-align", undefined],
|
||||
|
||||
"baseline": ["vertical-align", "baseline"],
|
||||
"bottom": ["vertical-align", "baseline"], // *shrug*
|
||||
|
||||
"texttop": ["vertical-align", "text-top"],
|
||||
"absmiddle": ["vertical-align", "middle"],
|
||||
"abscenter": ["vertical-align", "middle"],
|
||||
"absbottom": ["vertical-align", "bottom"],
|
||||
};
|
||||
|
||||
const kInitialValues = {
|
||||
"vertical-align": "baseline",
|
||||
"float": "none",
|
||||
};
|
||||
|
||||
let replaced = document.getElementById("replaced");
|
||||
let nonReplaced = document.getElementById("non-replaced");
|
||||
let t = async_test("align attribute mapping");
|
||||
onload = t.step_func_done(function() {
|
||||
for (const attributeValue in kMapping) {
|
||||
for (const element of [replaced, nonReplaced]) {
|
||||
test(function() {
|
||||
element.setAttribute("align", attributeValue);
|
||||
let [property, expected] = kMapping[attributeValue];
|
||||
let actual = getComputedStyle(element).getPropertyValue(property);
|
||||
if (element == nonReplaced) {
|
||||
assert_equals(actual, kInitialValues[property], "align shouldn't map to non-replaced elements")
|
||||
} else {
|
||||
if (expected) {
|
||||
assert_equals(actual, expected, `align=${attributeValue} should map to ${property}: ${expected}`);
|
||||
} else {
|
||||
assert_equals(property, "vertical-align");
|
||||
assert_not_equals(actual, "baseline", `align=${attributeValue} should map a vertical-align value`);
|
||||
}
|
||||
}
|
||||
}, `align=${attributeValue} on ${element == replaced ? "replaced" : "non-replaced"} elements`);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue