white-space-shorthand.html (2544B)
1 <!DOCTYPE html> 2 <title>CSS Text Module Test: parsing white-space as a shorthand</title> 3 <link rel="help" href="https://drafts.csswg.org/css-text-4/#propdef-white-space"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/css/support/parsing-testcommon.js"></script> 7 <script src="/css/support/computed-testcommon.js"></script> 8 <div id="target"></div> 9 <script> 10 function test_valid_and_computed_value(property, specified, serialized) { 11 test_valid_value(property, specified, serialized); 12 test_computed_value(property, specified, serialized); 13 } 14 15 test_valid_and_computed_value("white-space", "collapse", "normal"); 16 test_valid_and_computed_value("white-space", "wrap", "normal"); 17 test_valid_and_computed_value("white-space", "collapse wrap", "normal"); 18 test_valid_and_computed_value("white-space", "wrap collapse", "normal"); 19 20 test_valid_and_computed_value("white-space", "preserve nowrap", "pre"); 21 test_valid_and_computed_value("white-space", "nowrap preserve", "pre"); 22 23 test_valid_and_computed_value("white-space", "nowrap", "nowrap"); 24 test_valid_and_computed_value("white-space", "collapse nowrap", "nowrap"); 25 test_valid_and_computed_value("white-space", "nowrap collapse", "nowrap"); 26 27 test_valid_and_computed_value("white-space", "preserve", "pre-wrap"); 28 test_valid_and_computed_value("white-space", "preserve wrap", "pre-wrap"); 29 test_valid_and_computed_value("white-space", "wrap preserve", "pre-wrap"); 30 31 test_valid_and_computed_value("white-space", "break-spaces", "break-spaces"); 32 test_valid_and_computed_value("white-space", "break-spaces wrap", "break-spaces"); 33 test_valid_and_computed_value("white-space", "wrap break-spaces", "break-spaces"); 34 35 test_valid_and_computed_value("white-space", "preserve-breaks", "pre-line"); 36 test_valid_and_computed_value("white-space", "preserve-breaks wrap", "pre-line"); 37 test_valid_and_computed_value("white-space", "wrap preserve-breaks", "pre-line"); 38 39 // Combinations of existing values that are not pre-defined. 40 test_valid_and_computed_value("white-space", "preserve-breaks nowrap", "preserve-breaks nowrap"); 41 test_valid_and_computed_value("white-space", "nowrap preserve-breaks", "preserve-breaks nowrap"); 42 43 // Values not available through the shorthand. 44 test_invalid_value("white-space", "balance"); 45 test_invalid_value("white-space", "collapse balance"); 46 test_invalid_value("white-space", "balance collapse"); 47 test_invalid_value("white-space", "preserve balance"); 48 test_invalid_value("white-space", "balance preserve"); 49 </script>