Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -0,0 +1,12 @@
<!doctype html>
<title>dialog: display</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
dialog { position: static }
</style>
<dialog open id=dialog></dialog>
<script>
assert_equals(getComputedStyle(document.getElementById('dialog')).display, 'block');
done();
</script>

View file

@ -0,0 +1,104 @@
<!doctype html>
<title>The dialog element</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#ref-element {
padding-top: 1em;
background-color: white;
color: black;
border: solid;
}
</style>
<!--
HTML used to have a style rule with `@media screen and (max-width: 540px)`.
That was removed in https://github.com/whatwg/html/pull/2459
-->
<div><iframe style="width: 540px" src="support/dialog-framed.html"></iframe></div>
<div><iframe style="width: 538px" src="support/dialog-framed.html"></iframe></div>
<div id=ref-element></div>
<script>
setup(() => {
const refStyle = getComputedStyle(document.getElementById('ref-element'));
window.ref1em = refStyle.paddingTop;
window.refWhite = refStyle.backgroundColor;
window.refBlack = refStyle.color;
window.refMediumBorder = refStyle.borderTopWidth;
const iframeHeight = 150;
const bodyTopMargin = 8;
window.dialogSize = parseFloat(ref1em) * 2 + parseFloat(refMediumBorder) * 2;
window.centeredVerticalDistance = iframeHeight / 2 - dialogSize / 2;
window.normalBottomDistance = iframeHeight - bodyTopMargin - dialogSize;
}, {explicit_done: true});
onload = () => {
for (let iframe of document.querySelectorAll('iframe')) {
const win = iframe.contentWindow;
const styleAttr = iframe.getAttribute('style');
const iframeWidth = parseInt(styleAttr.split(' ')[1]);
const horizontalDistance = iframeWidth / 2 - dialogSize / 2;
test(() => {
const style = win.getComputedStyle(win.dialogClosed);
assert_equals(style.display, 'none', 'display');
assert_equals(style.top, 'auto', 'top');
assert_equals(style.right, '0px', 'right');
assert_equals(style.bottom, 'auto', 'bottom');
assert_equals(style.left, '0px', 'left');
assert_equals(style.width, 'fit-content', 'width');
assert_equals(style.height, 'fit-content', 'height');
assert_equals(style.marginTop, 'auto', 'marginTop');
assert_equals(style.marginRight, 'auto', 'marginRight');
assert_equals(style.marginBottom, 'auto', 'marginBottom');
assert_equals(style.marginLeft, 'auto', 'marginLeft');
assertCommon(style);
}, `Closed dialog in ${styleAttr} iframe`);
test(() => {
const style = win.getComputedStyle(win.dialogOpen);
assert_equals(style.display, 'block', 'display');
assert_equals(style.top, '8px', 'top');
assert_equals(style.right, '0px', 'right');
assert_equals(style.bottom, normalBottomDistance + 'px', 'bottom');
assert_equals(style.left, '0px', 'left');
assert_equals(style.width, '0px', 'width');
assert_equals(style.height, '0px', 'height');
assert_equals(style.marginTop, '0px', 'marginTop');
assert_equals(style.marginRight, horizontalDistance + 'px', 'marginRight');
assert_equals(style.marginBottom, '0px', 'marginBottom');
assert_equals(style.marginLeft, horizontalDistance + 'px', 'marginLeft');
assertCommon(style);
}, `Open dialog in ${styleAttr} iframe`);
test(() => {
const style = win.getComputedStyle(win.dialogModal);
assert_equals(style.display, 'block', 'display');
assert_equals(style.top, centeredVerticalDistance + 'px', 'top');
assert_equals(style.right, '0px', 'right');
assert_equals(style.bottom, centeredVerticalDistance + 'px', 'bottom');
assert_equals(style.left, '0px', 'left');
assert_equals(style.width, '0px', 'width');
assert_equals(style.height, '0px', 'height');
assert_equals(style.marginTop, '0px', 'marginTop');
assert_equals(style.marginRight, horizontalDistance + 'px', 'marginRight');
assert_equals(style.marginBottom, '0px', 'marginBottom');
assert_equals(style.marginLeft, horizontalDistance + 'px', 'marginLeft');
assertCommon(style);
}, `Modal dialog in ${styleAttr} iframe`);
}
done();
};
function assertCommon(style) {
assert_equals(style.position, 'absolute', 'position');
assert_equals(style.borderTopStyle, 'solid', 'borderTopStyle');
assert_equals(style.borderRightStyle, 'solid', 'borderRightStyle');
assert_equals(style.borderBottomStyle, 'solid', 'borderBottomStyle');
assert_equals(style.borderLeftStyle, 'solid', 'borderLeftStyle');
assert_equals(style.paddingTop, ref1em, 'paddingTop');
assert_equals(style.paddingRight, ref1em, 'paddingRight');
assert_equals(style.paddingBottom, ref1em, 'paddingBottom');
assert_equals(style.paddingLeft, ref1em, 'paddingLeft');
assert_equals(style.backgroundColor, refWhite, 'backgroundColor');
assert_equals(style.color, refBlack, 'color');
}
</script>

View file

@ -0,0 +1,13 @@
<!doctype html>
<style>
html { color: red }
</style>
<dialog id=dialog-closed></dialog>
<dialog id=dialog-open open></dialog>
<dialog id=dialog-modal></dialog>
<script>
window.dialogClosed = document.getElementById('dialog-closed');
window.dialogOpen = document.getElementById('dialog-open');
window.dialogModal = document.getElementById('dialog-modal');
dialogModal.showModal();
</script>

View file

@ -0,0 +1,6 @@
var testStyle = getComputedStyle(document.getElementById('test'));
var refStyle = getComputedStyle(document.getElementById('ref'));
for (var prop in testStyle) {
assert_equals(testStyle[prop], refStyle[prop], prop);
}
done();

View file

@ -0,0 +1,7 @@
<title>multicol default styles (quirks mode)</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#multicol">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<multicol id=test></multicol>
<asdfasdf id=ref></asdfasdf>
<script src="compare-computed-style.js"></script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>multicol default styles (standards mode)</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#multicol">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<multicol id=test></multicol>
<asdfasdf id=ref></asdfasdf>
<script src="compare-computed-style.js"></script>