mirror of
https://github.com/servo/servo.git
synced 2025-08-17 19:35:33 +01:00
Update web-platform-tests to revision fb15e14b52049f952612623ee0d7fb7a620a57c9
This commit is contained in:
parent
200cc8aa6b
commit
4a942c982f
141 changed files with 2563 additions and 1589 deletions
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
|
||||
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#containing-block-details">
|
||||
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#anonymous-block-level">
|
||||
<p>There should be a green square below, and no red.</p>
|
||||
<div style="position:relative; width:100px; height:100px; background:red;">
|
||||
<span id="posMe">
|
||||
<div id="removeMe"></div>
|
||||
</span>
|
||||
<span>
|
||||
<div>
|
||||
<div id="target" style="position:absolute; width:100%; height:100%; background:green;"></div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(()=> {
|
||||
document.body.offsetTop;
|
||||
removeMe.style.display = "none";
|
||||
document.body.offsetTop;
|
||||
posMe.style.position = "relative";
|
||||
assert_equals(document.getElementById("target").offsetWidth, 100);
|
||||
assert_equals(document.getElementById("target").offsetHeight, 100);
|
||||
assert_equals(document.getElementById("target").offsetLeft, 0);
|
||||
assert_equals(document.getElementById("target").offsetTop, 0);
|
||||
}, "Make sure that we're sized by the right ancestor");
|
||||
</script>
|
|
@ -32,13 +32,7 @@
|
|||
margin-top: 0em;
|
||||
}
|
||||
|
||||
div#X
|
||||
{
|
||||
float: left;
|
||||
margin-left: 50%;
|
||||
}
|
||||
|
||||
div#after-X
|
||||
div
|
||||
{
|
||||
background-color: aqua;
|
||||
width: 25%;
|
||||
|
@ -58,9 +52,7 @@
|
|||
the others should all be<br />
|
||||
<em>aligned on the left</em> of the window.</p>
|
||||
|
||||
<div id="X">X</div>
|
||||
|
||||
<div id="after-X"><br />The X on the previous line should be centered across the window.</div>
|
||||
<div><span style="padding-left:50%">X The first X in this sentence should be indented to the center of this block.</span></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<em>aligned on the left</em> of the window.
|
||||
</p>
|
||||
<div>
|
||||
X The X on the previous line should be centered across the window.
|
||||
X The first X in this sentence should be indented to the center of this block.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<title>text-indent test</title>
|
||||
<style type="text/css">
|
||||
div { width: 500px; }
|
||||
p { width: 300px; text-indent: 50px; }
|
||||
p { width: 300px; text-indent: 30px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -11,4 +11,4 @@ p { width: 300px; text-indent: 50px; }
|
|||
</div>
|
||||
|
||||
|
||||
</body></html>
|
||||
</body></html>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Animations: getComputedValue().animationDelay</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-delay">
|
||||
<meta name="assert" content="animation-delay converts to seconds.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("animation-delay", "-500ms", "-0.5s");
|
||||
test_computed_value("animation-delay", "calc(2 * 3s)", "6s");
|
||||
test_computed_value("animation-delay", "20s, 10s");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Animations: getComputedValue().animationDuration</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-duration">
|
||||
<meta name="assert" content="animation-duration converts to seconds.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("animation-duration", "500ms", "0.5s");
|
||||
test_computed_value("animation-duration", "calc(2 * 3s)", "6s");
|
||||
test_computed_value("animation-duration", "20s, 10s");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Tests that we consider main axis sizes to be definite in column flexboxes
|
||||
when the height is an explicit definite height, even if the container does
|
||||
not have a definite main axis size.</title>
|
||||
<link rel="author" title="Google Inc." href="https://www.google.com/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#definite-sizes">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
|
||||
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div style="display:flex; flex-direction:column;">
|
||||
<div style="width:100px; height:100px; background:red;">
|
||||
<div style="height:100%; background:green;"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Reference</title>
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: TestWeight;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-weight: 200 300;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestWeight;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-weight: 300 400;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStyle;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-style: oblique 20deg 30deg;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStyle;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-style: oblique 30deg 40deg;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStretch;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-stretch: 110% 120%;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStretch;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-stretch: 120% 130%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p style="font-family: TestWeight; font-weight: 250;">A</p>
|
||||
<p style="font-family: TestStyle; font-style: oblique 25deg;">A</p>
|
||||
<p style="font-family: TestStretch; font-stretch: 115%;">A</p>
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>CSS Test: Matching @font-face font-weight, font-style, and font-stretch descriptors with reversed ranges</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop-desc">
|
||||
<link rel="match" href="font-descriptor-range-reversed-ref.html">
|
||||
|
||||
<!-- Using csstest-weights-{100,900}-kerned.ttf just as two convenient
|
||||
different fonts here with different "A" glyphs -->
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: TestWeight;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-weight: 300 200;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestWeight;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-weight: 300 400;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStyle;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-style: oblique 30deg 20deg;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStyle;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-style: oblique 30deg 40deg;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStretch;
|
||||
src: url(resources/csstest-weights-100-kerned.ttf);
|
||||
font-stretch: 120% 110%;
|
||||
}
|
||||
@font-face {
|
||||
font-family: TestStretch;
|
||||
src: url(resources/csstest-weights-900-kerned.ttf);
|
||||
font-stretch: 120% 130%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Matches `font-weight: 300 200;` -->
|
||||
<p style="font-family: TestWeight; font-weight: 250;">A</p>
|
||||
|
||||
<!-- Matches `font-style: oblique 30deg 20deg;` -->
|
||||
<p style="font-family: TestStyle; font-style: oblique 25deg;">A</p>
|
||||
|
||||
<!-- Matches `font-style: oblique 120% 110%;` -->
|
||||
<p style="font-family: TestStretch; font-stretch: 115%;">A</p>
|
||||
|
||||
<script>
|
||||
document.fonts.ready.then(function() {
|
||||
document.documentElement.className = "";
|
||||
});
|
||||
</script>
|
|
@ -2,6 +2,8 @@
|
|||
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#register-a-custom-property" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="./resources/utils.js"></script>
|
||||
<div id=target></div>
|
||||
<script>
|
||||
// Tests for error checking during property registration
|
||||
|
||||
|
@ -45,4 +47,29 @@ test(function(){
|
|||
CSS.registerProperty({name: '--inherit-test-2', syntax: '<length>', initialValue: '0px', inherits: false});
|
||||
assert_throws(new TypeError(), () => CSS.registerProperty({name: '--inherit-test-3', syntax: '<length>', initialValue: '0px'}));
|
||||
}, "registerProperty requires inherits");
|
||||
|
||||
test(function(){
|
||||
try {
|
||||
let name = generate_name();
|
||||
|
||||
target.style.setProperty(name, 'green');
|
||||
target.style.transitionProperty = name;
|
||||
target.style.transitionDuration = '1s';
|
||||
target.style.transitionTimingFunction = 'steps(1, end)';
|
||||
|
||||
assert_equals(getComputedStyle(target).getPropertyValue(name), 'green');
|
||||
|
||||
CSS.registerProperty({
|
||||
name: name,
|
||||
syntax: '<color>',
|
||||
initialValue: 'red',
|
||||
inherits: false
|
||||
});
|
||||
|
||||
assert_equals(getComputedStyle(target).getPropertyValue(name), 'rgb(0, 128, 0)');
|
||||
} finally {
|
||||
target.style = '';
|
||||
}
|
||||
}, 'Registering a property should not cause a transition');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree">
|
||||
<div id="host"><span id="slotted">This text should be green.</span></div>
|
||||
<script>
|
||||
const root = host.attachShadow({mode:"open"});
|
||||
root.innerHTML = '<slot name="nomatch" style="color:green"></slot><slot style="color:red"></slot>';
|
||||
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(slotted).color, "rgb(255, 0, 0)");
|
||||
}, "Initial computed color.");
|
||||
|
||||
test(() => {
|
||||
root.querySelector("slot").removeAttribute("name");
|
||||
assert_equals(getComputedStyle(slotted).color, "rgb(0, 128, 0)");
|
||||
|
||||
}, "Computed color after re-slotting.");
|
||||
</script>
|
|
@ -5,3 +5,4 @@
|
|||
<div>PASS</div>
|
||||
<div>PASS</div>
|
||||
<div style="color:green">PASS</div>
|
||||
<div style="color:green">PASS</div>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<div id="host1"><span></span></div>
|
||||
<div id="host2"><span></span></div>
|
||||
<div id="host3"><span></span></div>
|
||||
<div id="host4"><span></span></div>
|
||||
<style>
|
||||
#host3 > span::before { content: "PASS" }
|
||||
</style>
|
||||
|
@ -19,4 +20,12 @@
|
|||
attachShadowWithSlottedStyle(host1, "::slotted(span)::before { content: 'PASS' }");
|
||||
attachShadowWithSlottedStyle(host2, "::slotted(span)::after { content: 'PASS' }");
|
||||
attachShadowWithSlottedStyle(host3, "::slotted(span)::before { content: 'FAIL'; color: green }");
|
||||
attachShadowWithSlottedStyle(host4, `
|
||||
::slotted(span)::before { content: 'PASS'; color: red }
|
||||
::slotted(.foo)::before { color: green }
|
||||
`);
|
||||
onload = function() {
|
||||
host4.offsetTop;
|
||||
host4.firstElementChild.classList.add("foo");
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Text Test: hanging punctuation is scrollable overflow</title>
|
||||
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#hanging-punctuation-property">
|
||||
<meta name="flags" content="">
|
||||
<link rel="match" href="reference/hanging-scrollable-001-ref.html">
|
||||
<meta name="assert" content="Hanging characters that overflow their block container are treated as scrollable overflow. ">
|
||||
<style>
|
||||
div {
|
||||
font-family: monospace;
|
||||
font-size: 50px;
|
||||
hanging-punctuation: last;
|
||||
overflow: hidden;
|
||||
color: red;
|
||||
}
|
||||
span {color: white; }
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is no red below.
|
||||
<table><tr><td><div id="t">X<span>”</span></div></table>
|
||||
<!--
|
||||
The table is to do sizing based on the min content size.
|
||||
A simpler test could be written using `div { width: min-content; }`,
|
||||
but that is not widely supported yet.
|
||||
-->
|
||||
|
||||
<script>
|
||||
document.getElementById("t").scrollLeft=100;
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Text Test reference</title>
|
||||
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
|
||||
|
||||
<p>Test passes if there is no red below.
|
|
@ -19,7 +19,7 @@
|
|||
<body>
|
||||
<p>Test passes if there is no red visible on the page.</p>
|
||||
<div id="parent">
|
||||
<div>X</div>
|
||||
<div style="padding-left: 100px">X</div>
|
||||
</div>
|
||||
<p>Test passes if the following two text blocks look same in terms of margin-left and text-indent respectively.</p>
|
||||
<div>
|
||||
|
@ -31,4 +31,4 @@
|
|||
ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ.<br />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
<title>CSS Text Test reference</title>
|
||||
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
|
||||
<style>
|
||||
body { background: white; }
|
||||
div {
|
||||
padding-left: 50px;
|
||||
font-family: Ahem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a single black X below and no red.
|
||||
<div>X</div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#reference1
|
||||
{
|
||||
color: red;
|
||||
left: 0;
|
||||
left: 100px; /* see comments for #test1 below */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
|
@ -29,8 +29,8 @@
|
|||
}
|
||||
#test1
|
||||
{
|
||||
text-indent: 50%;
|
||||
margin-left: -50%;
|
||||
margin-left: -50%; /* -50% * 400px = -200px which makes the inline-size of this block 600px */
|
||||
text-indent: 50%; /* 50% * 600px = 300px (which is 100px from the start of #parent due to the negative margin) */
|
||||
}
|
||||
#test2
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
|
||||
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box">
|
||||
<style>
|
||||
section { position: absolute; }
|
||||
body { background: white; }
|
||||
section, div {
|
||||
border-right: 10px solid white;
|
||||
margin-right: 10px;
|
||||
|
@ -19,10 +19,7 @@ div {
|
|||
box-sizing: border-box;
|
||||
width: 120px;
|
||||
}
|
||||
.test div { text-indent: 50%; color: red; }
|
||||
.ref div { text-indent: 50px; }
|
||||
.test div { text-indent: 50%; }
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a single black X below and no red.
|
||||
<section class=test><div>X</div></section>
|
||||
<section class=ref><div>X</div></section>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
|
||||
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box">
|
||||
<style>
|
||||
section { position: absolute; }
|
||||
body { background: white; }
|
||||
section, div {
|
||||
border-right: 10px solid white;
|
||||
margin-right: 10px;
|
||||
|
@ -19,10 +19,7 @@ div {
|
|||
box-sizing: border-box;
|
||||
width: 120px;
|
||||
}
|
||||
.test div { text-indent: 50%; color: red; overflow: hidden; } /* overflow:hidden should not make any difference, but it does in some browsers */
|
||||
.ref div { text-indent: 50px; }
|
||||
.test div { text-indent: 50%; overflow: hidden; } /* overflow:hidden should not make any difference, but it does in some browsers */
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a single black X below and no red.
|
||||
<section class=test><div>X</div></section>
|
||||
<section class=ref><div>X</div></section>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
|
||||
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box, when used in a calc expression">
|
||||
<style>
|
||||
section { position: absolute; }
|
||||
body { background: white; }
|
||||
section, div {
|
||||
border-right: 10px solid white;
|
||||
margin-right: 10px;
|
||||
|
@ -19,10 +19,7 @@ div {
|
|||
box-sizing: border-box;
|
||||
width: 120px;
|
||||
}
|
||||
.test div { text-indent: calc(25px + 25%); color: red; }
|
||||
.ref div { text-indent: 50px; }
|
||||
.test div { text-indent: calc(25px + 25%); }
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a single black X below and no red.
|
||||
<section class=test><div>X</div></section>
|
||||
<section class=ref><div>X</div></section>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
|
||||
|
||||
<style>
|
||||
div {
|
||||
white-space: pre-wrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>This test passes if the 4 letters below are verticaly aligned.
|
||||
|
||||
<div> P</div>
|
||||
<div> A</div>
|
||||
<div> S</div>
|
||||
<div> S</div>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSS test Reference</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
|
||||
|
||||
<p>This test passes if you can see the word PASS below, without any extra spaces.
|
||||
|
||||
<div>PASS</div>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
|
||||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-001-ref.html">
|
||||
<meta name="assert" content="Preserved white space at the end of the line is hanged when white-space is pre-wrap.">
|
||||
|
||||
<style>
|
||||
div {
|
||||
white-space: pre-wrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
div:nth-of-type(1),
|
||||
div:nth-of-type(2) {
|
||||
width: 5ch;
|
||||
text-align: right;
|
||||
}
|
||||
div:nth-of-type(3),
|
||||
div:nth-of-type(4) {
|
||||
width: 9ch;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>This test passes if the 4 letters below are verticaly aligned.
|
||||
|
||||
<div>P</div>
|
||||
<div>A </div>
|
||||
<div>S</div>
|
||||
<div>S </div>
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSS Text test: intrinsic maximum sizing of trailing spaces with white-space:pre-wrap</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
|
||||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-002-ref.html">
|
||||
<meta name="assert" content="Preserved white space at the end of the line is hanged when white-space is pre-wrap, and therefore does not count when computing the (maximum) intrinsic size.">
|
||||
|
||||
<style>
|
||||
span {
|
||||
display: inline-block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#s1 { text-align: right; }
|
||||
#s2 { text-align: center; }
|
||||
</style>
|
||||
|
||||
<p>This test passes if you can see the word PASS below, without any extra spaces.
|
||||
|
||||
<div><span id=s1>P </span><span id=s2>A </span>SS</div>
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSS Text test: intrinsic minimum sizing of trailing spaces with white-space:pre-wrap</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
|
||||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-002-ref.html">
|
||||
<meta name="assert" content="Preserved white space at the end of the line is hanged when white-space is pre-wrap, and therefore does not count when computing the (minimum) intrinsic size.">
|
||||
|
||||
<style>
|
||||
/* Make the table invisible */
|
||||
table { border-collapse: collapse; }
|
||||
td { padding: 0; }
|
||||
|
||||
/* for the content of the table to be sized to their mininum intrinsic size */
|
||||
table { width: 0; }
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#s1 { text-align: right; }
|
||||
#s2 { text-align: center; }
|
||||
</style>
|
||||
|
||||
<p>This test passes if you can see the word PASS below, without any extra spaces.
|
||||
|
||||
<table><td><span id=s1>P </span><td><span id=s2>A </span><td>SS</table>
|
|
@ -11,57 +11,56 @@
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
// none -> none
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'none',
|
||||
to: 'none',
|
||||
},
|
||||
[{ at: 0.25, expect: 'none' }]
|
||||
[{ at: 0.25, expect: 'none' }],
|
||||
'none -> none'
|
||||
);
|
||||
|
||||
// none -> something
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'none',
|
||||
to: 'translate(200px) rotate(720deg)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'translate(50px) rotate(180deg)' }]
|
||||
[{ at: 0.25, expect: 'translate(50px) rotate(180deg)' }],
|
||||
'none -> something'
|
||||
);
|
||||
|
||||
// something -> none
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'translate(200px) rotate(720deg)',
|
||||
to: 'none',
|
||||
},
|
||||
[{ at: 0.25, expect: 'translate(150px) rotate(540deg)' }]
|
||||
[{ at: 0.25, expect: 'translate(150px) rotate(540deg)' }],
|
||||
'something -> none'
|
||||
);
|
||||
|
||||
// Mismatched lengths (from is shorter), common part matches
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'translate(100px)',
|
||||
to: 'translate(200px) rotate(720deg)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'translate(125px) rotate(180deg)' }]
|
||||
[{ at: 0.25, expect: 'translate(125px) rotate(180deg)' }],
|
||||
'Mismatched lengths (from is shorter), common part matches'
|
||||
);
|
||||
|
||||
// Mismatched lengths (to is shorter), common part matches
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'translate(100px) rotate(720deg)',
|
||||
to: 'translate(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'translate(125px) rotate(540deg)' }]
|
||||
[{ at: 0.25, expect: 'translate(125px) rotate(540deg)' }],
|
||||
'Mismatched lengths (to is shorter), common part matches'
|
||||
);
|
||||
|
||||
// Perfect match
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
|
@ -73,47 +72,68 @@ test_interpolation(
|
|||
at: 0.25,
|
||||
expect: 'scale(2.25) rotate(540deg) translate(125px) matrix(1, 0, 0, 1, 75, 50) skew(180deg)',
|
||||
},
|
||||
]
|
||||
],
|
||||
'Perfect match'
|
||||
);
|
||||
|
||||
// Matches on primitives
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'translateX(100px) scaleX(3) translate(500px) scale(2)',
|
||||
to: 'translateY(200px) scale(5) translateX(100px) scaleY(3)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'translate(75px, 50px) scale(3.5, 2) translate(400px, 0px) scale(1.75, 2.25)' }]
|
||||
[{ at: 0.25, expect: 'translate(75px, 50px) scale(3.5, 2) translate(400px, 0px) scale(1.75, 2.25)' }],
|
||||
'Matches on primitives'
|
||||
);
|
||||
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'rotateX(90deg) translateX(100px)',
|
||||
to: 'rotate3d(50, 0, 0, 180deg) translateY(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'rotateX(112.5deg) translate(75px, 50px)' }],
|
||||
'Match on rotation vector'
|
||||
);
|
||||
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'rotateX(90deg) translateX(100px)',
|
||||
to: 'rotateY(0deg) translateY(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'rotateX(67.5deg) translate(75px, 50px)' }],
|
||||
'Match on rotation due to 0deg angle'
|
||||
);
|
||||
|
||||
// Common prefix
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'rotate(0deg) translate(100px)',
|
||||
to: 'rotate(720deg) scale(2) translate(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'rotate(180deg) matrix(1.25, 0, 0, 1.25, 175, 0)' }]
|
||||
[{ at: 0.25, expect: 'rotate(180deg) matrix(1.25, 0, 0, 1.25, 175, 0)' }],
|
||||
'Common prefix'
|
||||
);
|
||||
|
||||
// Complete mismatch (except length)
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'scale(2) rotate(0deg) translate(100px)',
|
||||
to: 'rotate(720deg) scale(2) translate(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'matrix(2, 0, 0, 2, 250, 0)' }]
|
||||
[{ at: 0.25, expect: 'matrix(2, 0, 0, 2, 250, 0)' }],
|
||||
'Complete mismatch (except length)'
|
||||
);
|
||||
|
||||
// Complete mismatch including length
|
||||
test_interpolation(
|
||||
{
|
||||
property: 'transform',
|
||||
from: 'scale(2) rotate(0deg)',
|
||||
to: 'rotate(720deg) scale(2) translate(200px)',
|
||||
},
|
||||
[{ at: 0.25, expect: 'matrix(2, 0, 0, 2, 100, 0)' }]
|
||||
[{ at: 0.25, expect: 'matrix(2, 0, 0, 2, 100, 0)' }],
|
||||
'Complete mismatch including length'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
function test_interpolation(settings, expectations) {
|
||||
function test_interpolation(settings, expectations, name) {
|
||||
var message_prefix = name ? name + ': ' : '';
|
||||
// Returns a timing function that at 0.5 evaluates to progress.
|
||||
function timingFunction(progress) {
|
||||
if (progress === 0)
|
||||
|
@ -13,7 +14,7 @@ function test_interpolation(settings, expectations) {
|
|||
test(function(){
|
||||
assert_true(CSS.supports(settings.property, settings.from), 'Value "' + settings.from + '" is supported by ' + settings.property);
|
||||
assert_true(CSS.supports(settings.property, settings.to), 'Value "' + settings.to + '" is supported by ' + settings.property);
|
||||
}, '"' + settings.from + '" and "' + settings.to + '" are valid ' + settings.property + ' values');
|
||||
}, message_prefix + '"' + settings.from + '" and "' + settings.to + '" are valid ' + settings.property + ' values');
|
||||
|
||||
for (var i = 0; i < expectations.length; ++i) {
|
||||
var progress = expectations[i].at;
|
||||
|
@ -49,6 +50,6 @@ function test_interpolation(settings, expectations) {
|
|||
reference.style = '';
|
||||
|
||||
assert_equals(getComputedStyle(target)[settings.property], getComputedStyle(reference)[settings.property]);
|
||||
}, 'Animation between "' + settings.from + '" and "' + settings.to + '" at progress ' + progress);
|
||||
}, message_prefix + 'Animation between "' + settings.from + '" and "' + settings.to + '" at progress ' + progress);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Transitions: getComputedValue().transitionDuration</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-duration">
|
||||
<meta name="assert" content="transition-duration converts to seconds.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("transition-duration", "500ms", "0.5s");
|
||||
test_computed_value("transition-duration", "calc(2 * 3s)", "6s");
|
||||
test_computed_value("transition-duration", "20s, 10s");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<title>When non-empty placeholder becomes empty, :placeholder-shown test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://drafts.csswg.org/selectors-4/#placeholder">
|
||||
<input id="myinput" type="text" placeholder="FAIL">
|
||||
<textarea id="mytextarea" placeholder="FAIL"></textarea>
|
||||
<script>
|
||||
test(() => {
|
||||
const input = document.querySelector("input");
|
||||
input.placeholder = "";
|
||||
input.value = "NO RED";
|
||||
assert_false(input.matches(":placeholder-shown"));
|
||||
}, "input:placeholder-shown should not be matched");
|
||||
|
||||
test(() => {
|
||||
const textarea = document.querySelector("textarea");
|
||||
textarea.placeholder = "";
|
||||
textarea.value = "No RED";
|
||||
assert_false(textarea.matches(":placeholder-shown"));
|
||||
}, "textarea:placeholder-shown should not be matched");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue