zoom-computed-with-sign-expression.html (1642B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Test: getComputedStyle().zoom, with a specified value that includes a sign() expression</title> 4 <link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property"> 5 <link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/css/support/computed-testcommon.js"></script> 9 <style> 10 #container { 11 container-type: inline-size; 12 width: 100px; 13 font-size: 20px; 14 } 15 </style> 16 <div id="container"> 17 <div id="target"></div> 18 </div> 19 <script> 20 // The sign() expressions below are all expected to resolve to -1. 21 22 // Same units: 23 test_computed_value("zoom", 'calc(1 + (sign(2cqw - 3cqw) * 0.5))', '0.5'); 24 test_computed_value("zoom", 'calc(1 + (sign(5px - 10px) * 0.5))', '0.5'); 25 test_computed_value("zoom", 'calc(1 + (sign(5 - 10) * 0.5))', '0.5'); 26 test_computed_value("zoom", 'calc(1 + (sign(30deg - 40deg) * 0.5))', '0.5'); 27 test_computed_value("zoom", 'calc(1 + (sign(3em - 5em) * 0.5))', '0.5'); 28 29 // Mixed absolute units: 30 test_computed_value("zoom", 'calc(1 + (sign(1cm - 1in) * 0.5))', '0.5'); 31 test_computed_value("zoom", 'calc(1 + (sign(1deg - 1rad) * 0.5))', '0.5'); 32 33 // Mixed units, one or more of which is context-dependent: 34 test_computed_value("zoom", 'calc(1 + (sign(2cqw - 10px) * 0.5))', '0.5'); 35 test_computed_value("zoom", 'calc(100% + (sign(2cqw - 10px) * 50%))', '0.5'); 36 test_computed_value("zoom", 'calc(100% + (sign(1em - 30px) * 50%))', '0.5'); 37 test_computed_value("zoom", 'calc(100% + (sign(2cqw - 1em) * 50%))', '0.5'); 38 </script>