mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 3bac98b37f29ec287e115fcecff566eb081131a8
This commit is contained in:
parent
6ff2524781
commit
57ea61dc86
64 changed files with 1309 additions and 347 deletions
|
@ -0,0 +1,84 @@
|
|||
<!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/#mixed-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="font-size: 20px; width: 400px">
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
</div>
|
||||
<script>
|
||||
const property = 'margin-left';
|
||||
|
||||
function test_length_percent_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_percent_equals('min(1px + 1%)', 'calc(1px + 1%)');
|
||||
test_length_percent_equals('min(1cm + 1%)', 'calc(1cm + 1%)');
|
||||
test_length_percent_equals('min(1mm + 1%)', 'calc(1mm + 1%)');
|
||||
test_length_percent_equals('min(1Q + 1%)', 'calc(1Q + 1%)');
|
||||
test_length_percent_equals('min(1in + 1%)', 'calc(1in + 1%)');
|
||||
test_length_percent_equals('min(1pc + 1%)', 'calc(1pc + 1%)');
|
||||
test_length_percent_equals('min(1pt + 1%)', 'calc(1pt + 1%)');
|
||||
test_length_percent_equals('min(1em + 1%)', 'calc(1em + 1%)');
|
||||
test_length_percent_equals('min(1ex + 1%)', 'calc(1ex + 1%)');
|
||||
test_length_percent_equals('min(1ch + 1%)', 'calc(1ch + 1%)');
|
||||
test_length_percent_equals('min(1rem + 1%)', 'calc(1rem + 1%)');
|
||||
test_length_percent_equals('min(1vh + 1%)', 'calc(1vh + 1%)');
|
||||
test_length_percent_equals('min(1vw + 1%)', 'calc(1vw + 1%)');
|
||||
test_length_percent_equals('min(1vmin + 1%)', 'calc(1vmin + 1%)');
|
||||
test_length_percent_equals('min(1vmax + 1%)', 'calc(1vmax + 1%)');
|
||||
test_length_percent_equals('max(1px + 1%)', 'calc(1px + 1%)');
|
||||
test_length_percent_equals('max(1cm + 1%)', 'calc(1cm + 1%)');
|
||||
test_length_percent_equals('max(1mm + 1%)', 'calc(1mm + 1%)');
|
||||
test_length_percent_equals('max(1Q + 1%)', 'calc(1Q + 1%)');
|
||||
test_length_percent_equals('max(1in + 1%)', 'calc(1in + 1%)');
|
||||
test_length_percent_equals('max(1pc + 1%)', 'calc(1pc + 1%)');
|
||||
test_length_percent_equals('max(1pt + 1%)', 'calc(1pt + 1%)');
|
||||
test_length_percent_equals('max(1em + 1%)', 'calc(1em + 1%)');
|
||||
test_length_percent_equals('max(1ex + 1%)', 'calc(1ex + 1%)');
|
||||
test_length_percent_equals('max(1ch + 1%)', 'calc(1ch + 1%)');
|
||||
test_length_percent_equals('max(1rem + 1%)', 'calc(1rem + 1%)');
|
||||
test_length_percent_equals('max(1vh + 1%)', 'calc(1vh + 1%)');
|
||||
test_length_percent_equals('max(1vw + 1%)', 'calc(1vw + 1%)');
|
||||
test_length_percent_equals('max(1vmin + 1%)', 'calc(1vmin + 1%)');
|
||||
test_length_percent_equals('max(1vmax + 1%)', 'calc(1vmax + 1%)');
|
||||
|
||||
// Comparisons between lengths and percentages
|
||||
test_length_percent_equals('min(20px, 10%)', '20px');
|
||||
test_length_percent_equals('min(1em, 10%)', '20px');
|
||||
test_length_percent_equals('max(20px, 10%)', '40px');
|
||||
test_length_percent_equals('max(1em, 10%)', '40px');
|
||||
|
||||
document.getElementById('container').style.width = '100px';
|
||||
test_length_percent_equals('min(20px, 10%)', '10px');
|
||||
test_length_percent_equals('min(1em, 10%)', '10px');
|
||||
test_length_percent_equals('max(20px, 10%)', '20px');
|
||||
test_length_percent_equals('max(1em, 10%)', '20px');
|
||||
document.getElementById('container').style.width = '400px';
|
||||
|
||||
// Comparisons between different mixings
|
||||
test_length_percent_equals('min(30px + 10%, 60px + 5%)', '70px');
|
||||
test_length_percent_equals('max(2em + 10%, 1em + 20%)', '100px');
|
||||
|
||||
// General calculations
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) + 10px)', '40px');
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) - 10px)', '20px');
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) * 2)', '60px');
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) / 2)', '15px');
|
||||
test_length_percent_equals('calc(max(1em, 15%) + 10px)', '70px');
|
||||
test_length_percent_equals('calc(max(1em, 15%) - 10px)', '50px');
|
||||
test_length_percent_equals('calc(max(1em, 15%) * 2)', '120px');
|
||||
test_length_percent_equals('calc(max(1em, 15%) / 2)', '30px');
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) + max(1em, 15%))', '90px');
|
||||
test_length_percent_equals('calc(min(1.5em, 10%) - max(1em, 15%))', '-30px');
|
||||
</script>
|
|
@ -0,0 +1,36 @@
|
|||
<!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/#mixed-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_length_percent(value) {
|
||||
test_invalid_value('margin-left', value);
|
||||
}
|
||||
|
||||
// Type checking only. Syntax checking is done by other test files.
|
||||
// <length-percentage> accepts mixing lengths and percentages only.
|
||||
test_invalid_length_percent('min(1px, 0)');
|
||||
test_invalid_length_percent('min(1px, 0s)');
|
||||
test_invalid_length_percent('min(1px, 0Hz)');
|
||||
test_invalid_length_percent('min(1px, 0dpi)');
|
||||
test_invalid_length_percent('min(1px, 0fr)');
|
||||
test_invalid_length_percent('min(1%, 0)');
|
||||
test_invalid_length_percent('min(1%, 0s)');
|
||||
test_invalid_length_percent('min(1%, 0Hz)');
|
||||
test_invalid_length_percent('min(1%, 0dpi)');
|
||||
test_invalid_length_percent('min(1%, 0fr)');
|
||||
test_invalid_length_percent('max(1px, 0)');
|
||||
test_invalid_length_percent('max(1px, 0s)');
|
||||
test_invalid_length_percent('max(1px, 0Hz)');
|
||||
test_invalid_length_percent('max(1px, 0dpi)');
|
||||
test_invalid_length_percent('max(1px, 0fr)');
|
||||
test_invalid_length_percent('max(1%, 0)');
|
||||
test_invalid_length_percent('max(1%, 0s)');
|
||||
test_invalid_length_percent('max(1%, 0Hz)');
|
||||
test_invalid_length_percent('max(1%, 0dpi)');
|
||||
test_invalid_length_percent('max(1%, 0fr)');
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue