background-333

background shorthand - background-color 'red'

WeasyPrint

This browser

Flags
dom, script
Assertion
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

Source

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