testing/web-platform/tests/css/css-values/minmax-integer-computed.html
author Florian Quèze <florian@queze.net>
Tue, 08 Jul 2025 20:48:53 +0000 (12 hours ago)
changeset 795809 b01190f141a12f4b506acb1f4476561c4b0f2407
parent 518164 25004bf6cb294de36af9ce585fbc7f68e2ba0ebd
permissions -rw-r--r--
Bug 1960567 - remove the last C++ and scriptable APIs to accumulate data to legacy telemetry histograms, r=chutten. Differential Revision: https://phabricator.services.mozilla.com/D255582
<!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/numeric-testcommon.js"></script>
<div id="target"></div>
<script>
function test_integer_equals(value, expected) {
  test_math_used(value, expected,
    {base: '123',
     prop: 'z-index'}
  );
}

// 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>