mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d
This commit is contained in:
parent
3f07cfec7c
commit
578498ba24
4001 changed files with 159517 additions and 30260 deletions
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<title>The legend element: block formatting context</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<style>
|
||||
/* Set margin and padding for fieldset to 0 to make things simpler */
|
||||
fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.wrapper {
|
||||
height: 200px;
|
||||
position: relative;
|
||||
}
|
||||
.float {
|
||||
float: left;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: orange;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class=wrapper>
|
||||
<div class=float></div>
|
||||
<legend id=in-body><div class=float></div></legend>
|
||||
<div class=float></div>
|
||||
</div>
|
||||
|
||||
<div class=wrapper>
|
||||
<fieldset>
|
||||
<div class=float></div>
|
||||
<legend id=rendered-legend><div class=float></div></legend>
|
||||
<legend id=in-fieldset-second-child><div class=float></div></legend>
|
||||
<div><legend id=in-fieldset-descendant><div class=float></div></legend></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const fieldsetBorderWidth = 2;
|
||||
const legendPadding = 2;
|
||||
|
||||
test(() => {
|
||||
const legend = document.getElementById('in-body');
|
||||
assert_equals(legend.offsetLeft, 0, 'legend.offsetLeft');
|
||||
assert_equals(legend.offsetTop, 0, 'legend.offsetTop');
|
||||
assert_equals(legend.clientHeight, 0, 'legend.clientHeight');
|
||||
const divAfter = legend.nextElementSibling;
|
||||
assert_equals(divAfter.offsetLeft, 100, 'divAfter.offsetLeft');
|
||||
assert_equals(divAfter.offsetTop, 0, 'divAfter.offsetTop');
|
||||
}, 'in-body');
|
||||
|
||||
test(() => {
|
||||
const legend = document.getElementById('rendered-legend');
|
||||
assert_equals(legend.offsetLeft, fieldsetBorderWidth, 'legend.offsetLeft');
|
||||
assert_equals(legend.offsetTop, 0, 'legend.offsetTop');
|
||||
assert_equals(legend.clientHeight, 50, 'legend.clientHeight');
|
||||
const divChild = legend.firstChild;
|
||||
assert_equals(divChild.offsetLeft, fieldsetBorderWidth + legendPadding, 'divChild.offsetLeft');
|
||||
assert_equals(divChild.offsetTop, 0, 'divChild.offsetTop');
|
||||
}, 'rendered-legend');
|
||||
|
||||
test(() => {
|
||||
const legend = document.getElementById('in-fieldset-second-child');
|
||||
assert_equals(legend.offsetLeft, fieldsetBorderWidth, 'legend.offsetLeft');
|
||||
assert_equals(legend.offsetTop, 50, 'legend.offsetTop');
|
||||
assert_equals(legend.clientHeight, 0, 'legend.clientHeight');
|
||||
const divChild = legend.firstChild;
|
||||
assert_equals(divChild.offsetLeft, fieldsetBorderWidth + 50, 'divChild.offsetLeft');
|
||||
assert_equals(divChild.offsetTop, 50, 'divChild.offsetTop');
|
||||
}, 'in-fieldset-second-child');
|
||||
|
||||
test(() => {
|
||||
const legend = document.getElementById('in-fieldset-descendant');
|
||||
assert_equals(legend.offsetLeft, fieldsetBorderWidth, 'legend.offsetLeft');
|
||||
assert_equals(legend.offsetTop, 50, 'legend.offsetTop');
|
||||
assert_equals(legend.clientHeight, 0, 'legend.clientHeight');
|
||||
const divChild = legend.firstChild;
|
||||
assert_equals(divChild.offsetLeft, fieldsetBorderWidth + 50 + 50, 'divChild.offsetLeft');
|
||||
assert_equals(divChild.offsetTop, 50, 'divChild.offsetTop');
|
||||
}, 'in-fieldset-descendant');
|
||||
</script>
|
|
@ -0,0 +1,62 @@
|
|||
<!doctype html>
|
||||
<title>The legend element</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<style>
|
||||
#ref {
|
||||
display: block;
|
||||
unicode-bidi: isolate;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
/* TODO: uncomment this when these properties are widely supported
|
||||
padding-inline-start: 2px; padding-inline-end: 2px;
|
||||
*/
|
||||
}
|
||||
</style>
|
||||
|
||||
<legend id=in-body></legend>
|
||||
<fieldset>
|
||||
<legend id=rendered-legend></legend>
|
||||
<legend id=in-fieldset-second-child></legend>
|
||||
<div><legend id=in-fieldset-descendant></legend></div>
|
||||
</fieldset>
|
||||
<div id=ref></div>
|
||||
|
||||
<script>
|
||||
setup(() => {
|
||||
self.legends = [].slice.call(document.querySelectorAll('legend'));
|
||||
self.refStyle = getComputedStyle(document.getElementById('ref'));
|
||||
self.props = ['display',
|
||||
'unicodeBidi',
|
||||
'marginTop',
|
||||
'marginRight',
|
||||
'marginBottom',
|
||||
'marginLeft',
|
||||
'paddingTop',
|
||||
'paddingRight',
|
||||
'paddingBottom',
|
||||
'paddingLeft',
|
||||
'overflow',
|
||||
// Extra tests
|
||||
'height',
|
||||
'box-sizing',
|
||||
];
|
||||
});
|
||||
legends.forEach(legend => {
|
||||
const testStyle = getComputedStyle(legend);
|
||||
props.forEach(prop => {
|
||||
test(() => {
|
||||
assert_equals(testStyle[prop], refStyle[prop]);
|
||||
}, `${legend.id}: ${prop}`);
|
||||
});
|
||||
|
||||
// Test width separately since it differs outside fieldset vs. in fieldset vs. rendered legend
|
||||
test(() => {
|
||||
if (legend.id === 'rendered-legend') {
|
||||
assert_equals(testStyle.width, '0px');
|
||||
} else {
|
||||
assert_not_equals(testStyle.width, '0px');
|
||||
}
|
||||
}, `${legend.id}: width`);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<title>The hr element</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<style>
|
||||
#ref {
|
||||
display: block;
|
||||
unicode-bidi: isolate;
|
||||
color: gray;
|
||||
border-style: inset;
|
||||
border-width: 1px;
|
||||
margin: 0.5em auto;
|
||||
/* TODO: uncomment this when these properties are widely supported
|
||||
margin-block-start: 0.5em;
|
||||
margin-inline-end: auto;
|
||||
margin-block-end: 0.5em;
|
||||
margin-inline-start: auto;
|
||||
*/
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<hr id=test>
|
||||
<div id=ref></div>
|
||||
|
||||
<script>
|
||||
setup(() => {
|
||||
self.testStyle = getComputedStyle(document.getElementById('test'));
|
||||
self.refStyle = getComputedStyle(document.getElementById('ref'));
|
||||
});
|
||||
['display',
|
||||
'unicodeBidi',
|
||||
'color',
|
||||
'borderTopStyle',
|
||||
'borderRightStyle',
|
||||
'borderBottomStyle',
|
||||
'borderLeftStyle',
|
||||
'borderTopWidth',
|
||||
'borderRightWidth',
|
||||
'borderBottomWidth',
|
||||
'borderLeftWidth',
|
||||
'marginTop',
|
||||
'marginRight',
|
||||
'marginBottom',
|
||||
'marginLeft',
|
||||
'overflow',
|
||||
// Extra tests
|
||||
'height',
|
||||
'box-sizing',
|
||||
].forEach(prop => {
|
||||
test(() => {
|
||||
assert_equals(testStyle[prop], refStyle[prop]);
|
||||
}, prop);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<title>The hr element: setting 'overflow: visible'</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<style>
|
||||
/* Use 0 margin for hr instead of default 0.5em to make things simpler */
|
||||
hr {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.wrapper {
|
||||
height: 150px;
|
||||
position: relative;
|
||||
}
|
||||
#test-visible {
|
||||
overflow: visible;
|
||||
}
|
||||
.float, hr::before {
|
||||
content: "";
|
||||
float: left;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: orange;
|
||||
}
|
||||
.clear {
|
||||
clear: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class=wrapper>
|
||||
<div class=float></div>
|
||||
<hr id=test-control>
|
||||
<div class=float></div>
|
||||
</div>
|
||||
|
||||
<div class=wrapper>
|
||||
<div class=float></div>
|
||||
<hr id=test-visible>
|
||||
<div class=float></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
test(() => {
|
||||
const hr = document.getElementById('test-control');
|
||||
assert_equals(hr.offsetLeft, 50, 'hr.offsetLeft');
|
||||
assert_equals(hr.offsetTop, 0, 'hr.offsetTop');
|
||||
assert_equals(hr.clientHeight, 50, 'hr.clientHeight');
|
||||
const divAfter = hr.nextElementSibling;
|
||||
assert_equals(divAfter.offsetLeft, 0, 'divAfter.offsetLeft');
|
||||
assert_equals(divAfter.offsetTop, 50 + 1 + 1 /* hr border */, 'divAfter.offsetTop');
|
||||
}, 'control');
|
||||
|
||||
test(() => {
|
||||
const hr = document.getElementById('test-visible');
|
||||
assert_equals(hr.offsetLeft, 0, 'hr.offsetLeft');
|
||||
assert_equals(hr.offsetTop, 0, 'hr.offsetTop');
|
||||
assert_equals(hr.clientHeight, 0, 'hr.clientHeight');
|
||||
const divAfter = hr.nextElementSibling;
|
||||
assert_equals(divAfter.offsetLeft, 50 + 50, 'divAfter.offsetLeft');
|
||||
assert_equals(divAfter.offsetTop, 1 + 1 /* hr border */, 'divAfter.offsetTop');
|
||||
}, 'overflow: visible');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<title>iframe and body margin attributes</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body marginwidth=20 marginheight=20 topmargin=10 rightmargin=10 bottommargin=10 leftmargin=10>
|
||||
<iframe data-desc="iframe marginwidth vs child body leftmargin" src="support/body-topmargin-leftmargin.html" marginwidth=10 marginheight=10></iframe>
|
||||
<iframe data-desc="iframe marginwidth vs child body marginwidth" src="support/body-marginwidth-marginheight.html" marginwidth=10 marginheight=10></iframe>
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
|
||||
onload = () => {
|
||||
test(() => {
|
||||
const style = getComputedStyle(document.body);
|
||||
assert_style_props(style);
|
||||
}, 'body marginwidth vs body leftmargin');
|
||||
|
||||
[].forEach.call(document.querySelectorAll('iframe'), iframe => {
|
||||
test(() => {
|
||||
const win = iframe.contentWindow;
|
||||
const style = win.getComputedStyle(win.document.body);
|
||||
assert_style_props(style);
|
||||
}, iframe.dataset.desc);
|
||||
});
|
||||
done();
|
||||
}
|
||||
|
||||
function assert_style_props(style) {
|
||||
for (let prop of ['marginTop', 'marginRight', 'marginBottom', 'marginLeft']) {
|
||||
assert_equals(style[prop], '20px', prop);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<title>iframe marginwidth and marginheight</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe src="/common/blank.html" marginwidth=0 marginheight=0></iframe>
|
||||
<script>
|
||||
onload = () => {
|
||||
assert_equals(window[0].document.body.attributes.length, 0, "Number of attributes on the child document's body");
|
||||
done();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<body marginwidth=20 marginheight=20>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<body topmargin=20 rightmargin=20 bottommargin=20 leftmargin=20>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>option element with br child</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#concept-option-label">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-option-text">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-select-element-2">
|
||||
|
||||
<p>This test passes if the option element displays three options:</p>
|
||||
|
||||
<pre>a
|
||||
b
|
||||
ab</pre>
|
||||
|
||||
<p>Importantly the third option must not be split across two lines.</p>
|
||||
|
||||
<select multiple>
|
||||
<option>a</option>
|
||||
<option>b</option>
|
||||
<option>ab</option>
|
||||
</select>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>option element with br child</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#concept-option-label">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-option-text">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-select-element-2">
|
||||
|
||||
<link rel="match" href="option-with-br-ref.html">
|
||||
|
||||
<p>This test passes if the option element displays three options:</p>
|
||||
|
||||
<pre>a
|
||||
b
|
||||
ab</pre>
|
||||
|
||||
<p>Importantly the third option must not be split across two lines.</p>
|
||||
|
||||
<select multiple>
|
||||
<option>a</option>
|
||||
<option>b</option>
|
||||
<option id="manipulate-me"></option>
|
||||
</select>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
const option = document.querySelector("#manipulate-me");
|
||||
|
||||
option.appendChild(document.createTextNode("a"));
|
||||
option.appendChild(document.createElement("br"));
|
||||
option.appendChild(document.createTextNode("b"));
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue