mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Update web-platform-tests to revision 53876e32d827db82f4b7af38053529302c243d40
This commit is contained in:
parent
a0f14ceb7b
commit
02d2f1860a
87 changed files with 2931 additions and 515 deletions
|
@ -5,61 +5,71 @@
|
|||
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/parsing-testcommon.js"></script>
|
||||
<script src="../support/serialize-testcommon.js"></script>
|
||||
<div style="width: 100px;">
|
||||
<div id=target></div>
|
||||
</div>
|
||||
<script>
|
||||
const property = 'letter-spacing';
|
||||
|
||||
function test_valid_length(value, expected) {
|
||||
test_valid_value(property, value, expected);
|
||||
function test_serialization(t,s,c,u, {prop}={}) {
|
||||
test_specified_serialization(prop || 'text-indent', t, s);
|
||||
test_computed_serialization(prop || 'text-indent', t, c);
|
||||
if(u) test_used_serialization(prop || 'margin-left', t, u);
|
||||
}
|
||||
|
||||
test_valid_length('min(1px)', 'min(1px)');
|
||||
test_valid_length('min(1cm)', 'min(1cm)');
|
||||
test_valid_length('min(1mm)', 'min(1mm)');
|
||||
test_serialization(
|
||||
'min(1px)',
|
||||
'calc(1px)',
|
||||
'1px');
|
||||
test_serialization(
|
||||
'min(1in)',
|
||||
'calc(96px)',
|
||||
'96px');
|
||||
test_serialization(
|
||||
'max(1px)',
|
||||
'calc(1px)',
|
||||
'1px');
|
||||
test_serialization(
|
||||
'max(1in)',
|
||||
'calc(96px)',
|
||||
'96px');
|
||||
|
||||
// Values are case-insensitive and serialize as lower case, for example 1Q
|
||||
// serializes as 1q.
|
||||
test_valid_length('min(1Q)', 'min(1q)');
|
||||
test_valid_length('min(1in)', 'min(1in)');
|
||||
test_valid_length('min(1pc)', 'min(1pc)');
|
||||
test_valid_length('min(1pt)', 'min(1pt)');
|
||||
test_valid_length('min(1em)', 'min(1em)');
|
||||
test_valid_length('min(1ex)', 'min(1ex)');
|
||||
test_valid_length('min(1ch)', 'min(1ch)');
|
||||
test_valid_length('min(1rem)', 'min(1rem)');
|
||||
test_valid_length('min(1vh)', 'min(1vh)');
|
||||
test_valid_length('min(1vw)', 'min(1vw)');
|
||||
test_valid_length('min(1vmin)', 'min(1vmin)');
|
||||
test_valid_length('min(1vmax)', 'min(1vmax)');
|
||||
test_valid_length('max(1px)', 'max(1px)');
|
||||
test_valid_length('max(1cm)', 'max(1cm)');
|
||||
test_valid_length('max(1mm)', 'max(1mm)');
|
||||
test_valid_length('max(1Q)', 'max(1q)');
|
||||
test_valid_length('max(1in)', 'max(1in)');
|
||||
test_valid_length('max(1pc)', 'max(1pc)');
|
||||
test_valid_length('max(1pt)', 'max(1pt)');
|
||||
test_valid_length('max(1em)', 'max(1em)');
|
||||
test_valid_length('max(1ex)', 'max(1ex)');
|
||||
test_valid_length('max(1ch)', 'max(1ch)');
|
||||
test_valid_length('max(1rem)', 'max(1rem)');
|
||||
test_valid_length('max(1vh)', 'max(1vh)');
|
||||
test_valid_length('max(1vw)', 'max(1vw)');
|
||||
test_valid_length('max(1vmin)', 'max(1vmin)');
|
||||
test_valid_length('max(1vmax)', 'max(1vmax)');
|
||||
test_serialization(
|
||||
'min(1PX)',
|
||||
'calc(1px)',
|
||||
'1px');
|
||||
|
||||
test_valid_length('min(10px, 20px, 30px)', 'min(10px, 20px, 30px)');
|
||||
test_valid_length('min(30px, 20px, 10px)', 'min(30px, 20px, 10px)');
|
||||
test_valid_length('min(20px, 1em, 10vw)', 'min(20px, 1em, 10vw)');
|
||||
test_valid_length('min(10vw, 1em, 20px)', 'min(10vw, 1em, 20px)');
|
||||
test_valid_length('max(10px, 20px, 30px)', 'max(10px, 20px, 30px)');
|
||||
test_valid_length('max(30px, 20px, 10px)', 'max(30px, 20px, 10px)');
|
||||
test_valid_length('max(20px, 1em, 10vw)', 'max(20px, 1em, 10vw)');
|
||||
test_valid_length('max(10vw, 1em, 20px)', 'max(10vw, 1em, 20px)');
|
||||
// Arguments simplify down eagerly
|
||||
test_serialization(
|
||||
'min(50px, 1in + 1px)',
|
||||
'calc(50px)',
|
||||
'50px');
|
||||
test_serialization(
|
||||
'max(50px, 1in + 1px)',
|
||||
'calc(97px)',
|
||||
'97px');
|
||||
|
||||
test_valid_length('calc(min(10px) + max(1em) + min(10vw))', 'calc(min(10px) + max(1em) + min(10vw))');
|
||||
test_valid_length('calc(max(1em) + min(10vw) + max(10px))', 'calc(max(1em) + min(10vw) + max(10px))');
|
||||
test_valid_length('calc(10px + min(1em))', 'calc(10px + min(1em))');
|
||||
test_valid_length('calc(min(1em) + 10px)', 'calc(10px + min(1em))');
|
||||
test_valid_length('calc(10px + max(1em))', 'calc(10px + max(1em))');
|
||||
test_valid_length('calc(max(1em) + 10px)', 'calc(10px + max(1em))');
|
||||
// And the entire function simplifies eagerly if possible
|
||||
test_serialization(
|
||||
'calc(1px + min(1in, 100px))',
|
||||
'calc(97px)',
|
||||
'97px');
|
||||
test_serialization(
|
||||
'calc(1px + max(1in, 100px))',
|
||||
'calc(101px)',
|
||||
'101px');
|
||||
|
||||
// Computed-value units preserve min()/max() in specified values
|
||||
test_serialization(
|
||||
'min(1px, 1em)',
|
||||
'min(1px, 1em)',
|
||||
'1px');
|
||||
test_serialization(
|
||||
'calc(min(1px, 1in) + max(100px + 1em, 10px + 1in) + 1px)',
|
||||
'calc(2px + max(1em + 100px, 106px))',
|
||||
'118px');
|
||||
|
||||
// Can't test that min()/max() are preserved in computed values with just lengths;
|
||||
// see minmax-length-percentage-serialize for tests of that.
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue