test_css_property_is_shorthand.html (1156B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test InspectorUtils::CssPropertyIsShorthand</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 <script type="application/javascript"> 9 const InspectorUtils = SpecialPowers.InspectorUtils; 10 11 let tests = [ 12 { 13 property: "color", 14 expected: false 15 }, 16 { 17 property: "background", 18 expected: true 19 }, 20 { 21 property: "--anything", 22 expected: false 23 } 24 ]; 25 26 for (let {property, expected} of tests) { 27 let result = InspectorUtils.cssPropertyIsShorthand(property); 28 is(result, expected, "checking whether " + property + " is shorthand"); 29 } 30 31 let sawException = false; 32 try { 33 let result = InspectorUtils.cssPropertyIsShorthand("nosuchproperty"); 34 } catch (e) { 35 sawException = true; 36 } 37 ok(sawException, "checking whether nosuchproperty throws"); 38 39 </script> 40 </head> 41 <body> 42 <h1>Test InspectorUtils::CssPropertyIsShorthand</h1> 43 <p id="display"></p> 44 <div id="content" style="display: none"> 45 46 </div> 47 <pre id="test"> 48 </pre> 49 </body> 50 </html>