test_bug1006595.html (3004B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1006595 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1006595</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1006595 */ 14 15 const InspectorUtils = SpecialPowers.InspectorUtils; 16 17 function arraysEqual(arr1, arr2, message) { 18 is(arr1.length, arr2.length, message + " length"); 19 for (var i = 0; i < arr1.length; ++i) { 20 is(arr1[i], arr2[i], message + " element at index " + i); 21 } 22 } 23 24 var paddingSubProps = InspectorUtils.getSubpropertiesForCSSProperty("padding"); 25 arraysEqual(paddingSubProps, 26 [ "padding-top", 27 "padding-right", 28 "padding-bottom", 29 "padding-left" ], 30 "'padding' subproperties"); 31 32 var displaySubProps = InspectorUtils.getSubpropertiesForCSSProperty("color"); 33 arraysEqual(displaySubProps, [ "color" ], 34 "'color' subproperties"); 35 36 var varProps = InspectorUtils.getSubpropertiesForCSSProperty("--foo"); 37 arraysEqual(varProps, ["--foo"], "'--foo' subproperties"); 38 39 try { 40 InspectorUtils.cssPropertySupportsType("padding", 0); 41 ok(false, "Invalid types throw"); 42 } catch (ex) { 43 ok(true, "Invalid types don't crash"); 44 } 45 46 ok(InspectorUtils.cssPropertyIsShorthand("padding"), "'padding' is a shorthand") 47 ok(!InspectorUtils.cssPropertyIsShorthand("color"), "'color' is not a shorthand") 48 49 ok(!InspectorUtils.cssPropertySupportsType("padding", "color"), 50 "'padding' can't be a color"); 51 52 ok(InspectorUtils.cssPropertySupportsType("color", "color"), 53 "'color' can be a color"); 54 ok(InspectorUtils.cssPropertySupportsType("background", "color"), 55 "'background' can be a color"); 56 ok(!InspectorUtils.cssPropertySupportsType("background-image", "color"), 57 "'background-image' can't be a color"); 58 59 ok(InspectorUtils.cssPropertySupportsType("background-image", "gradient"), 60 "'background-image' can be a gradient"); 61 ok(InspectorUtils.cssPropertySupportsType("background", "gradient"), 62 "'background' can be a gradient"); 63 ok(!InspectorUtils.cssPropertySupportsType("background-color", "gradient"), 64 "'background-color' can't be a gradient"); 65 66 ok(InspectorUtils.cssPropertySupportsType("transition", "timing-function"), 67 "'transition' can be a timing function"); 68 ok(InspectorUtils.cssPropertySupportsType("transition-timing-function", "timing-function"), 69 "'transition-duration' can be a timing function"); 70 ok(!InspectorUtils.cssPropertySupportsType("background-color", "timing-function"), 71 "'background-color' can't be a timing function"); 72 73 </script> 74 </head> 75 <body> 76 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1006595">Mozilla Bug 1006595</a> 77 <p id="display"></p> 78 <div id="content" style="display: none"> 79 80 </div> 81 <pre id="test"> 82 </pre> 83 </body> 84 </html>