background-333.html (3012B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Backgrounds and Borders Test: background shorthand - background-color 'red'</title> 5 <link rel="author" title="Intel" href="http://www.intel.com" /> 6 <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background" /> 7 <meta name="flags" content="dom" /> 8 <meta name="assert" content="Check that given a valid declaration, for each layer the shorthand 'backgound' first sets the corresponding layer of each of 'background-image', 'background-position', 'background-size', 'background-repeat', 'background-origin', 'background-clip' and 'background-attachment' to that property's initial value, then assigns any explicit values specified for this layer in the declaration, and finally 'background-color' is set to the specified color, if any, else set to its initial value" /> 9 <style> 10 #test { 11 background: red; 12 } 13 </style> 14 <script src="/resources/testharness.js"></script> 15 <script src="/resources/testharnessreport.js"></script> 16 </head> 17 <body> 18 <div id="log"></div> 19 <div id="test"></div> 20 <script> 21 var cs = getComputedStyle(document.getElementById("test"), null); 22 23 test(function() { 24 assert_equals(cs.getPropertyValue("background-image"), 25 "none", "background initial value for background-image"); 26 }, "background_specified_color_image"); 27 28 test(function() { 29 assert_equals(cs.getPropertyValue("background-position"), 30 "0% 0%", "background initial value for background-position"); 31 }, "background_specified_color_position"); 32 33 test(function() { 34 assert_equals(cs.getPropertyValue("background-size"), 35 "auto", "background initial value for background-size"); 36 }, "background_specified_color_size"); 37 38 test(function() { 39 assert_equals(cs.getPropertyValue("background-repeat"), 40 "repeat", "background initial value for background-repeat"); 41 }, "background_specified_color_repeat"); 42 43 test(function() { 44 assert_equals(cs.getPropertyValue("background-attachment"), 45 "scroll", "background initial value for background-attachment"); 46 }, "background_specified_color_attachment"); 47 48 test(function() { 49 assert_equals(cs.getPropertyValue("background-origin"), 50 "padding-box", "background initial value for background-origin"); 51 }, "background_specified_color_origin"); 52 53 test(function() { 54 assert_equals(cs.getPropertyValue("background-clip"), 55 "border-box", "background initial value for background-clip"); 56 }, "background_specified_color_clip"); 57 58 test(function() { 59 assert_equals(cs.getPropertyValue("background-color"), 60 "rgb(255, 0, 0)", "background specified value for background-color"); 61 }, "background_specified_color_color"); 62 </script> 63 </body> 64 </html>