inset-valid.html (1766B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Positioned Layout Module: parsing inset with valid values</title> 6 <link rel="help" href="https://drafts.csswg.org/css-position/#insets"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/css/support/parsing-testcommon.js"></script> 10 </head> 11 <body> 12 <script> 13 const single_values = [ 14 // [input, serialized(optional)] 15 ["0", "0px"], 16 ["auto"], 17 ["10%"], 18 ["1rem"], 19 ["-10px"], 20 ["-20%"], 21 ["calc(2em + 3ex)"], 22 ]; 23 const double_values = [ 24 // [input, serialized(optional)] 25 ["auto auto", "auto"], 26 ["100px 100px", "100px"], 27 ["10% -5px"], 28 ["1rem calc(0px)"] 29 ]; 30 function test_inset_longhand(longhand_property) { 31 for (let value of single_values) { 32 if (value[1] === undefined) 33 test_valid_value(longhand_property, value[0]); 34 else 35 test_valid_value(longhand_property, value[0], value[1]); 36 } 37 } 38 function test_inset_shorthand(shorthand_property) { 39 for (let value of single_values) { 40 if (value[1] === undefined) 41 test_valid_value(shorthand_property, value[0]); 42 else 43 test_valid_value(shorthand_property, value[0], value[1]); 44 } 45 for (let value of double_values) { 46 if (value[1] === undefined) 47 test_valid_value(shorthand_property, value[0]); 48 else 49 test_valid_value(shorthand_property, value[0], value[1]); 50 } 51 } 52 53 test_inset_longhand("inset-block-start"); 54 test_inset_longhand("inset-block-end"); 55 test_inset_longhand("inset-inline-start"); 56 test_inset_longhand("inset-inline-end"); 57 58 test_inset_shorthand("inset-block"); 59 test_inset_shorthand("inset-inline"); 60 </script> 61 </body> 62 </html>