mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision 33c263fb308d1c3f6ac6d2590d7292317262819d
This commit is contained in:
parent
5bf00c07c2
commit
482fda3a78
524 changed files with 14686 additions and 3270 deletions
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#angles">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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>
|
||||
function test_valid_angle(value, expected) {
|
||||
test_valid_value('transform', `rotate(${value})`, `rotate(${expected})`);
|
||||
}
|
||||
|
||||
test_valid_angle('min(1deg)', 'min(1deg)');
|
||||
test_valid_angle('min(1rad)', 'min(1rad)');
|
||||
test_valid_angle('min(1turn)', 'min(1turn)');
|
||||
test_valid_angle('min(1grad)', 'min(1grad)');
|
||||
test_valid_angle('max(1deg)', 'max(1deg)');
|
||||
test_valid_angle('max(1rad)', 'max(1rad)');
|
||||
test_valid_angle('max(1turn)', 'max(1turn)');
|
||||
test_valid_angle('max(1grad)', 'max(1grad)');
|
||||
|
||||
// TODO(crbug.com/978682): Complete this test suite
|
||||
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#integers">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-range">
|
||||
<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/computed-testcommon.js"></script>
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
<script>
|
||||
const property = 'z-index';
|
||||
|
||||
function test_integer_equals(value, expected) {
|
||||
const reference = document.getElementById('reference');
|
||||
reference.style[property] = '';
|
||||
reference.style[property] = expected;
|
||||
const computed = getComputedStyle(reference)[property];
|
||||
test_computed_value(property, value, computed);
|
||||
}
|
||||
|
||||
// Identity tests
|
||||
test_integer_equals('min(1)', '1');
|
||||
test_integer_equals('max(1)', '1');
|
||||
|
||||
// Rounding
|
||||
test_integer_equals('min(0.4)', '0');
|
||||
test_integer_equals('min(0.6)', '1');
|
||||
test_integer_equals('max(0.4)', '0');
|
||||
test_integer_equals('max(0.6)', '1');
|
||||
|
||||
// Rounding and nesting
|
||||
test_integer_equals('min(1.1, max(0.4, 0.6))', '1');
|
||||
test_integer_equals('max(0.3, min(1.1, 0.4))', '0');
|
||||
|
||||
// No rounding at intermediate steps
|
||||
test_integer_equals('calc(min(0.3, 0.6) * 2)', '1');
|
||||
test_integer_equals('calc(max(0.3, 0.6) / 2)', '0');
|
||||
</script>
|
|
@ -0,0 +1,119 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#lengths">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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/computed-testcommon.js"></script>
|
||||
<div id="container" style="font-size: 20px">
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
</div>
|
||||
<script>
|
||||
const property = 'letter-spacing';
|
||||
|
||||
function test_length_equals(value, expected) {
|
||||
const reference = document.getElementById('reference');
|
||||
reference.style[property] = '';
|
||||
reference.style[property] = expected;
|
||||
const computed = getComputedStyle(reference)[property];
|
||||
test_computed_value(property, value, computed);
|
||||
}
|
||||
|
||||
// Identity tests
|
||||
test_length_equals('min(1px)', '1px');
|
||||
test_length_equals('min(1cm)', '1cm');
|
||||
test_length_equals('min(1mm)', '1mm');
|
||||
test_length_equals('min(1Q)', '1Q');
|
||||
test_length_equals('min(1in)', '1in');
|
||||
test_length_equals('min(1pc)', '1pc');
|
||||
test_length_equals('min(1pt)', '1pt');
|
||||
test_length_equals('min(1em)', '1em');
|
||||
test_length_equals('min(1ex)', '1ex');
|
||||
test_length_equals('min(1ch)', '1ch');
|
||||
test_length_equals('min(1rem)', '1rem');
|
||||
test_length_equals('min(1vh)', '1vh');
|
||||
test_length_equals('min(1vw)', '1vw');
|
||||
test_length_equals('min(1vmin)', '1vmin');
|
||||
test_length_equals('min(1vmax)', '1vmax');
|
||||
test_length_equals('max(1px)', '1px');
|
||||
test_length_equals('max(1cm)', '1cm');
|
||||
test_length_equals('max(1mm)', '1mm');
|
||||
test_length_equals('max(1Q)', '1Q');
|
||||
test_length_equals('max(1in)', '1in');
|
||||
test_length_equals('max(1pc)', '1pc');
|
||||
test_length_equals('max(1pt)', '1pt');
|
||||
test_length_equals('max(1em)', '1em');
|
||||
test_length_equals('max(1ex)', '1ex');
|
||||
test_length_equals('max(1ch)', '1ch');
|
||||
test_length_equals('max(1rem)', '1rem');
|
||||
test_length_equals('max(1vh)', '1vh');
|
||||
test_length_equals('max(1vw)', '1vw');
|
||||
test_length_equals('max(1vmin)', '1vmin');
|
||||
test_length_equals('max(1vmax)', '1vmax');
|
||||
|
||||
// Comparisons between same units
|
||||
test_length_equals('min(1px, 2px)', '1px');
|
||||
test_length_equals('min(1cm, 2cm)', '1cm');
|
||||
test_length_equals('min(1mm, 2mm)', '1mm');
|
||||
test_length_equals('min(1Q, 2Q)', '1Q');
|
||||
test_length_equals('min(1in, 2in)', '1in');
|
||||
test_length_equals('min(1pc, 2pc)', '1pc');
|
||||
test_length_equals('min(1pt, 2pt)', '1pt');
|
||||
test_length_equals('min(1em, 2em)', '1em');
|
||||
test_length_equals('min(1ex, 2ex)', '1ex');
|
||||
test_length_equals('min(1ch, 2ch)', '1ch');
|
||||
test_length_equals('min(1rem, 2rem)', '1rem');
|
||||
test_length_equals('min(1vh, 2vh)', '1vh');
|
||||
test_length_equals('min(1vw, 2vw)', '1vw');
|
||||
test_length_equals('min(1vmin, 2vmin)', '1vmin');
|
||||
test_length_equals('min(1vmax, 2vmax)', '1vmax');
|
||||
test_length_equals('max(1px, 2px)', '2px');
|
||||
test_length_equals('max(1cm, 2cm)', '2cm');
|
||||
test_length_equals('max(1mm, 2mm)', '2mm');
|
||||
test_length_equals('max(1Q, 2Q)', '2Q');
|
||||
test_length_equals('max(1in, 2in)', '2in');
|
||||
test_length_equals('max(1pc, 2pc)', '2pc');
|
||||
test_length_equals('max(1pt, 2pt)', '2pt');
|
||||
test_length_equals('max(1em, 2em)', '2em');
|
||||
test_length_equals('max(1ex, 2ex)', '2ex');
|
||||
test_length_equals('max(1ch, 2ch)', '2ch');
|
||||
test_length_equals('max(1rem, 2rem)', '2rem');
|
||||
test_length_equals('max(1vh, 2vh)', '2vh');
|
||||
test_length_equals('max(1vw, 2vw)', '2vw');
|
||||
test_length_equals('max(1vmin, 2vmin)', '2vmin');
|
||||
test_length_equals('max(1vmax, 2vmax)', '2vmax');
|
||||
|
||||
// Comparisons between different absolute units
|
||||
test_length_equals('min(95px, 1in)', '95px');
|
||||
test_length_equals('max(95px, 1in)', '1in');
|
||||
|
||||
// Comparisons between absolute and relative units
|
||||
test_length_equals('min(15px, 1em)', '15px');
|
||||
test_length_equals('min(25px, 1em)', '20px');
|
||||
test_length_equals('max(15px, 1em)', '20px');
|
||||
test_length_equals('max(25px, 1em)', '25px');
|
||||
|
||||
document.getElementById('container').style.fontSize = '10px';
|
||||
test_length_equals('min(15px, 1em)', '10px');
|
||||
test_length_equals('max(15px, 2em)', '20px');
|
||||
|
||||
document.getElementById('container').style.fontSize = '20px';
|
||||
|
||||
// Nestings
|
||||
test_length_equals('min(25px, max(15px, 1em))', '20px');
|
||||
test_length_equals('max(15px, min(25px, 1em))', '20px');
|
||||
|
||||
// General calculations
|
||||
test_length_equals('calc(min(1em, 21px) + 10px)', '30px');
|
||||
test_length_equals('calc(min(1em, 21px) - 10px)', '10px');
|
||||
test_length_equals('calc(min(1em, 21px) * 2', '40px');
|
||||
test_length_equals('calc(min(1em, 21px) / 2', '10px');
|
||||
test_length_equals('calc(max(1em, 19px) + 10px)', '30px');
|
||||
test_length_equals('calc(max(1em, 19px) - 10px)', '10px');
|
||||
test_length_equals('calc(max(1em, 19px) * 2', '40px');
|
||||
test_length_equals('calc(max(1em, 19px) / 2', '10px');
|
||||
test_length_equals('calc(min(1em, 21px) + max(0.9em, 20px))', '40px');
|
||||
test_length_equals('calc(min(1em, 21px) - max(0.9em, 20px))', '0px');
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#lengths">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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>
|
||||
function test_invalid_length(value) {
|
||||
// 'letter-spacing' accepts <length> only, not <percentage> or any mixes.
|
||||
test_invalid_value('letter-spacing', value);
|
||||
}
|
||||
|
||||
// Syntax checking
|
||||
test_invalid_length('min()');
|
||||
test_invalid_length('min( )');
|
||||
test_invalid_length('min(,)');
|
||||
test_invalid_length('min(1py)');
|
||||
test_invalid_length('min(1px, )');
|
||||
test_invalid_length('min(, 1px)');
|
||||
test_invalid_length('min(1px + )');
|
||||
test_invalid_length('min(1px - )');
|
||||
test_invalid_length('min(1px * )');
|
||||
test_invalid_length('min(1px / )');
|
||||
test_invalid_length('min(1px 2px)');
|
||||
test_invalid_length('min(1px, , 2px)');
|
||||
test_invalid_length('max()');
|
||||
test_invalid_length('max( )');
|
||||
test_invalid_length('max(,)');
|
||||
test_invalid_length('max(1py)');
|
||||
test_invalid_length('max(1px, )');
|
||||
test_invalid_length('max(, 1px)');
|
||||
test_invalid_length('max(1px + )');
|
||||
test_invalid_length('max(1px - )');
|
||||
test_invalid_length('max(1px * )');
|
||||
test_invalid_length('max(1px / )');
|
||||
test_invalid_length('max(1px 2px)');
|
||||
test_invalid_length('max(1px, , 2px)');
|
||||
|
||||
// Type checking
|
||||
test_invalid_length('min(0)');
|
||||
test_invalid_length('min(0%)');
|
||||
test_invalid_length('min(0s)');
|
||||
test_invalid_length('min(0Hz)');
|
||||
test_invalid_length('min(0dpi)');
|
||||
test_invalid_length('min(0fr)');
|
||||
test_invalid_length('min(1px, 0)');
|
||||
test_invalid_length('min(1px, 0%)');
|
||||
test_invalid_length('min(1px, 0s)');
|
||||
test_invalid_length('min(1px, 0Hz)');
|
||||
test_invalid_length('min(1px, 0dpi)');
|
||||
test_invalid_length('min(1px, 0fr)');
|
||||
test_invalid_length('max(0)');
|
||||
test_invalid_length('max(0%)');
|
||||
test_invalid_length('max(0s)');
|
||||
test_invalid_length('max(0Hz)');
|
||||
test_invalid_length('max(0dpi)');
|
||||
test_invalid_length('max(0fr)');
|
||||
test_invalid_length('max(1px, 0)');
|
||||
test_invalid_length('max(1px, 0%)');
|
||||
test_invalid_length('max(1px, 0s)');
|
||||
test_invalid_length('max(1px, 0Hz)');
|
||||
test_invalid_length('max(1px, 0dpi)');
|
||||
test_invalid_length('max(1px, 0fr)');
|
||||
</script>
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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/computed-testcommon.js"></script>
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
<script>
|
||||
const property = 'opacity';
|
||||
|
||||
function test_number_equals(value, expected) {
|
||||
const reference = document.getElementById('reference');
|
||||
reference.style[property] = '';
|
||||
reference.style[property] = expected;
|
||||
const computed = getComputedStyle(reference)[property];
|
||||
test_computed_value(property, value, computed);
|
||||
}
|
||||
|
||||
// Identity tests
|
||||
test_number_equals('min(1)', '1');
|
||||
test_number_equals('max(1)', '1');
|
||||
|
||||
// Nestings
|
||||
test_number_equals('min(0.2, max(0.1, 0.15))', '0.15');
|
||||
test_number_equals('max(0.1, min(0.2, 0.15))', '0.15');
|
||||
|
||||
// General calculations
|
||||
test_number_equals('calc(min(0.1, 0.2) + 0.05)', '0.15');
|
||||
test_number_equals('calc(min(0.1, 0.2) - 0.05)', '0.05');
|
||||
test_number_equals('calc(min(0.1, 0.2) * 2)', '0.2');
|
||||
test_number_equals('calc(min(0.1, 0.2) / 2)', '0.05');
|
||||
test_number_equals('calc(max(0.1, 0.2) + 0.05)', '0.25');
|
||||
test_number_equals('calc(max(0.1, 0.2) - 0.05)', '0.15');
|
||||
test_number_equals('calc(max(0.1, 0.2) * 2)', '0.4');
|
||||
test_number_equals('calc(max(0.1, 0.2) / 2)', '0.1');
|
||||
test_number_equals('calc(min(0.1, 0.2) + max(0.1, 0.05))', '0.2');
|
||||
test_number_equals('calc(min(0.1, 0.2) - max(0.1, 0.05))', '0');
|
||||
</script>
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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>
|
||||
function test_invalid_number(value) {
|
||||
test_invalid_value('opacity', value);
|
||||
}
|
||||
|
||||
// Syntax checking
|
||||
test_invalid_number('min()');
|
||||
test_invalid_number('min( )');
|
||||
test_invalid_number('min(,)');
|
||||
test_invalid_number('min(1, )');
|
||||
test_invalid_number('min(, 1)');
|
||||
test_invalid_number('min(1 + )');
|
||||
test_invalid_number('min(1 - )');
|
||||
test_invalid_number('min(1 * )');
|
||||
test_invalid_number('min(1 / )');
|
||||
test_invalid_number('min(1 2)');
|
||||
test_invalid_number('min(1, , 2)');
|
||||
test_invalid_number('max()');
|
||||
test_invalid_number('max( )');
|
||||
test_invalid_number('max(,)');
|
||||
test_invalid_number('max(1, )');
|
||||
test_invalid_number('max(, 1)');
|
||||
test_invalid_number('max(1 + )');
|
||||
test_invalid_number('max(1 - )');
|
||||
test_invalid_number('max(1 * )');
|
||||
test_invalid_number('max(1 / )');
|
||||
test_invalid_number('max(1 2)');
|
||||
test_invalid_number('max(1, , 2)');
|
||||
|
||||
// Type checking
|
||||
test_invalid_number('min(0px)');
|
||||
test_invalid_number('min(0s)');
|
||||
test_invalid_number('min(0deg)');
|
||||
test_invalid_number('min(0Hz)');
|
||||
test_invalid_number('min(0dpi)');
|
||||
test_invalid_number('min(0fr)');
|
||||
test_invalid_number('min(1, 1%)');
|
||||
test_invalid_number('min(1, 0px)');
|
||||
test_invalid_number('min(1, 0s)');
|
||||
test_invalid_number('min(1, 0deg)');
|
||||
test_invalid_number('min(1, 0Hz)');
|
||||
test_invalid_number('min(1, 0dpi)');
|
||||
test_invalid_number('min(1, 0fr)');
|
||||
test_invalid_number('max(0px)');
|
||||
test_invalid_number('max(0s)');
|
||||
test_invalid_number('max(0deg)');
|
||||
test_invalid_number('max(0Hz)');
|
||||
test_invalid_number('max(0dpi)');
|
||||
test_invalid_number('max(0fr)');
|
||||
test_invalid_number('max(1, 1%)');
|
||||
test_invalid_number('max(1, 0px)');
|
||||
test_invalid_number('max(1, 0s)');
|
||||
test_invalid_number('max(1, 0deg)');
|
||||
test_invalid_number('max(1, 0Hz)');
|
||||
test_invalid_number('max(1, 0dpi)');
|
||||
test_invalid_number('max(1, 0fr)');
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#percentages">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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/computed-testcommon.js"></script>
|
||||
<div id="container" style="width: 400px">
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
</div>
|
||||
<script>
|
||||
const property = 'margin-left';
|
||||
|
||||
function test_percentage_equals(value, expected) {
|
||||
const reference = document.getElementById('reference');
|
||||
reference.style[property] = '';
|
||||
reference.style[property] = expected;
|
||||
const computed = getComputedStyle(reference)[property];
|
||||
test_computed_value(property, value, computed);
|
||||
}
|
||||
|
||||
// Identity tests
|
||||
test_percentage_equals('min(1%)', '1%');
|
||||
test_percentage_equals('max(1%)', '1%');
|
||||
|
||||
// Nestings
|
||||
test_percentage_equals('min(20%, max(10%, 15%))', '15%');
|
||||
test_percentage_equals('max(10%, min(20%, 15%))', '15%');
|
||||
|
||||
// General calculations
|
||||
test_percentage_equals('calc(min(10%, 20%) + 5%)', '15%');
|
||||
test_percentage_equals('calc(min(10%, 20%) - 5%)', '5%');
|
||||
test_percentage_equals('calc(min(10%, 20%) * 2)', '20%');
|
||||
test_percentage_equals('calc(min(10%, 20%) / 2)', '5%');
|
||||
test_percentage_equals('calc(max(10%, 20%) + 5%)', '25%');
|
||||
test_percentage_equals('calc(max(10%, 20%) - 5%)', '15%');
|
||||
test_percentage_equals('calc(max(10%, 20%) * 2)', '40%');
|
||||
test_percentage_equals('calc(max(10%, 20%) / 2)', '10%');
|
||||
test_percentage_equals('calc(min(10%, 20%) + max(10%, 5%))', '20%');
|
||||
test_percentage_equals('calc(min(10%, 20%) - max(10%, 5%))', '0%');
|
||||
</script>
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#percentages">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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>
|
||||
function test_invalid_percentage(value) {
|
||||
test_invalid_value('margin-left', value);
|
||||
}
|
||||
|
||||
// Syntax checking
|
||||
test_invalid_percentage('min()');
|
||||
test_invalid_percentage('min( )');
|
||||
test_invalid_percentage('min(,)');
|
||||
test_invalid_percentage('min(1#)');
|
||||
test_invalid_percentage('min(%1)');
|
||||
test_invalid_percentage('min(1%, )');
|
||||
test_invalid_percentage('min(, 1%)');
|
||||
test_invalid_percentage('min(1% + )');
|
||||
test_invalid_percentage('min(1% - )');
|
||||
test_invalid_percentage('min(1% * )');
|
||||
test_invalid_percentage('min(1% / )');
|
||||
test_invalid_percentage('min(1% 2%)');
|
||||
test_invalid_percentage('min(1%, , 2%)');
|
||||
test_invalid_percentage('max()');
|
||||
test_invalid_percentage('max( )');
|
||||
test_invalid_percentage('max(,)');
|
||||
test_invalid_percentage('max(1#)');
|
||||
test_invalid_percentage('max(%1)');
|
||||
test_invalid_percentage('max(1%, )');
|
||||
test_invalid_percentage('max(, 1%)');
|
||||
test_invalid_percentage('max(1% + )');
|
||||
test_invalid_percentage('max(1% - )');
|
||||
test_invalid_percentage('max(1% * )');
|
||||
test_invalid_percentage('max(1% / )');
|
||||
test_invalid_percentage('max(1% 2%)');
|
||||
test_invalid_percentage('max(1%, , 2%)');
|
||||
|
||||
// Type checking
|
||||
test_invalid_percentage('min(0s)');
|
||||
test_invalid_percentage('min(0deg)');
|
||||
test_invalid_percentage('min(0Hz)');
|
||||
test_invalid_percentage('min(0dpi)');
|
||||
test_invalid_percentage('min(0fr)');
|
||||
test_invalid_percentage('min(1%, 0)');
|
||||
test_invalid_percentage('min(1%, 0s)');
|
||||
test_invalid_percentage('min(1%, 0deg)');
|
||||
test_invalid_percentage('min(1%, 0Hz)');
|
||||
test_invalid_percentage('min(1%, 0dpi)');
|
||||
test_invalid_percentage('min(1%, 0fr)');
|
||||
test_invalid_percentage('max(0s)');
|
||||
test_invalid_percentage('max(0deg)');
|
||||
test_invalid_percentage('max(0Hz)');
|
||||
test_invalid_percentage('max(0dpi)');
|
||||
test_invalid_percentage('max(0fr)');
|
||||
test_invalid_percentage('max(1%, 0)');
|
||||
test_invalid_percentage('max(1%, 0s)');
|
||||
test_invalid_percentage('max(1%, 0deg)');
|
||||
test_invalid_percentage('max(1%, 0Hz)');
|
||||
test_invalid_percentage('max(1%, 0dpi)');
|
||||
test_invalid_percentage('max(1%, 0fr)');
|
||||
</script>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#time">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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/computed-testcommon.js"></script>
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
<script>
|
||||
const property = 'transition-delay';
|
||||
|
||||
function test_time_equals(value, expected) {
|
||||
const reference = document.getElementById('reference');
|
||||
reference.style[property] = '';
|
||||
reference.style[property] = expected;
|
||||
const computed = getComputedStyle(reference)[property];
|
||||
test_computed_value(property, value, computed);
|
||||
}
|
||||
|
||||
// Identity tests
|
||||
test_time_equals('min(1s)', '1s');
|
||||
test_time_equals('min(1ms)', '1ms');
|
||||
test_time_equals('max(1s)', '1s');
|
||||
test_time_equals('max(1ms)', '1ms');
|
||||
|
||||
// Comparisons between same units
|
||||
test_time_equals('min(1s, 2s)', '1s');
|
||||
test_time_equals('min(1ms, 2ms)', '1ms');
|
||||
test_time_equals('max(1s, 2s)', '2s');
|
||||
test_time_equals('max(1ms, 2ms)', '2ms');
|
||||
|
||||
// Comparisons between different units
|
||||
test_time_equals('min(1s, 1100ms)', '1s');
|
||||
test_time_equals('max(0.9s, 1000ms)', '1000ms');
|
||||
|
||||
// Nestings
|
||||
test_time_equals('min(2s, max(1s, 1500ms))', '1500ms');
|
||||
test_time_equals('max(1000ms, min(2000ms, 1.5s))', '1.5s');
|
||||
|
||||
// General calculations
|
||||
test_time_equals('calc(min(0.5s, 600ms) + 500ms)', '1s');
|
||||
test_time_equals('calc(min(0.5s, 600ms) - 500ms)', '0s');
|
||||
test_time_equals('calc(min(0.5s, 600ms) * 2)', '1s');
|
||||
test_time_equals('calc(min(0.5s, 600ms) / 2)', '0.25s');
|
||||
test_time_equals('calc(max(0.5s, 400ms) + 500ms)', '1s');
|
||||
test_time_equals('calc(max(0.5s, 400ms) - 500ms)', '0s');
|
||||
test_time_equals('calc(max(0.5s, 400ms) * 2)', '1s');
|
||||
test_time_equals('calc(max(0.5s, 400ms) / 2)', '0.25s');
|
||||
test_time_equals('calc(min(0.5s, 600ms) + max(500ms, 0.4s))', '1s');
|
||||
test_time_equals('calc(min(0.5s, 600ms) - max(500ms, 0.4s))', '0s');
|
||||
</script>
|
|
@ -0,0 +1,69 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#time">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<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>
|
||||
function test_invalid_time(value) {
|
||||
test_invalid_value('transition-delay', value);
|
||||
}
|
||||
|
||||
// Syntax checking
|
||||
test_invalid_time('min()');
|
||||
test_invalid_time('min( )');
|
||||
test_invalid_time('min(,)');
|
||||
test_invalid_time('min(1mt)');
|
||||
test_invalid_time('min(1s, )');
|
||||
test_invalid_time('min(, 1s)');
|
||||
test_invalid_time('min(1s + )');
|
||||
test_invalid_time('min(1s - )');
|
||||
test_invalid_time('min(1s * )');
|
||||
test_invalid_time('min(1s / )');
|
||||
test_invalid_time('min(1s 2s)');
|
||||
test_invalid_time('min(1s, , 2s)');
|
||||
test_invalid_time('max()');
|
||||
test_invalid_time('max( )');
|
||||
test_invalid_time('max(,)');
|
||||
test_invalid_time('max(1dag)');
|
||||
test_invalid_time('max(1s, )');
|
||||
test_invalid_time('max(, 1s)');
|
||||
test_invalid_time('max(1s + )');
|
||||
test_invalid_time('max(1s - )');
|
||||
test_invalid_time('max(1s * )');
|
||||
test_invalid_time('max(1s / )');
|
||||
test_invalid_time('max(1s 2s)');
|
||||
test_invalid_time('max(1s, , 2s)');
|
||||
|
||||
// Type checking
|
||||
test_invalid_time('min(0)');
|
||||
test_invalid_time('min(0%)');
|
||||
test_invalid_time('min(0px)');
|
||||
test_invalid_time('min(0deg)');
|
||||
test_invalid_time('min(0Hz)');
|
||||
test_invalid_time('min(0dpi)');
|
||||
test_invalid_time('min(0fr)');
|
||||
test_invalid_time('min(1s, 0)');
|
||||
test_invalid_time('min(1s, 0%)');
|
||||
test_invalid_time('min(1s, 0px)');
|
||||
test_invalid_time('min(1s, 0deg)');
|
||||
test_invalid_time('min(1s, 0Hz)');
|
||||
test_invalid_time('min(1s, 0dpi)');
|
||||
test_invalid_time('min(1s, 0fr)');
|
||||
test_invalid_time('max(0)');
|
||||
test_invalid_time('max(0%)');
|
||||
test_invalid_time('max(0px)');
|
||||
test_invalid_time('max(0deg)');
|
||||
test_invalid_time('max(0Hz)');
|
||||
test_invalid_time('max(0dpi)');
|
||||
test_invalid_time('max(0fr)');
|
||||
test_invalid_time('max(1s, 0)');
|
||||
test_invalid_time('max(1s, 0%)');
|
||||
test_invalid_time('max(1s, 0px)');
|
||||
test_invalid_time('max(1s, 0deg)');
|
||||
test_invalid_time('max(1s, 0Hz)');
|
||||
test_invalid_time('max(1s, 0dpi)');
|
||||
test_invalid_time('max(1s, 0fr)');
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue