gecko-dev/testing/web-platform/tests/css/css-values/minmax-time-computed.html
Tab Atkins Jr 028e60736f Bug 1620728 [wpt PR 22127] - Cleanup min max, a=testonly
Automatic update from web-platform-tests
Cleanup min max (#22127)

* Use animation-play-state:paused rather than enormous durations. Add a red square to make failure obvious.

* Add a red square for obvious failure.

* Add a red square for obvious failure.

* Don't depend on the serialization of computed units being a particular thing.

* Math functions are aggressively reduced away if possible.

* Simplify with test_math_used().

* Add the ability, which other test functions have, to tack on an extra message to the built-in message.

* Simplify with test_math_used().

* Use 'margin-left' instead of 'left', since the latter's resolved value is the computed value if the element isn't positioned!

* Simplify with test_math_used().

* Restructure test_math_used() to accept a type specifier, and automatically choose a good property/base value/etc for that type. Also add test_math_computed, with different props where appropriate.

* Switch the inf/zero/nan functions over to just using the 'number' type so they're more obvious.

* Improve the documentation for numeric-testcommon.js.

* Make minmax-length-percent-serialize match the spec for serialization of computed values.

* Make minmax-length-serialize match the spec for serialization of computed values.

* Switch minmax-number-computed over to test_math_used().

* Fix errors in test_math_computed(), and add test_math_specified().

* Extract the base-selecting code, since it's shared by all the functions.

* Fix minmax-number-serialize to match spec for serialization.

* Fix minmax-percentage-computed to not rely on serialization.

* Well, the generic functions dont' let me test exact serialization, so start writing some that do.

* Add new serializ-testcommon helper, and rewrite all the serialization tests to use it.

* Remove the 'base' value from numeric-testcommon, as empty string works consistently across everything.

* [css-values] Final fixes/conversion of min()/max() tests to the newer templates and spec.
--

wpt-commits: 53876e32d827db82f4b7af38053529302c243d40
wpt-pr: 22127
2020-03-11 14:31:03 +00:00

48 lines
1.9 KiB
HTML

<!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/numeric-testcommon.js"></script>
<div id="target"></div>
<script>
function test_time_equals(t,e) {
test_math_used(t, e, {type:"time"});
}
// 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');
test_time_equals('min(1s + 100ms, 500ms * 3)', '1.1s');
test_time_equals('calc(min(1s, 2s) + max(3s, 4s) + 10s)', '15s');
</script>