|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=477531 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 477531</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 |
|
11 <style type="text/css"> |
|
12 #s { |
|
13 margin-left: 10px; |
|
14 } |
|
15 |
|
16 #s:indeterminate { |
|
17 margin-left: 30px; |
|
18 } |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=477531">Mozilla Bug 477531</a> |
|
23 <p id="display"></p> |
|
24 <div id="content"> |
|
25 |
|
26 <input type="checkbox" id="s" /> |
|
27 |
|
28 </div> |
|
29 <pre id="test"> |
|
30 <script class="testbody" type="text/javascript"> |
|
31 |
|
32 /** Test for Bug 477531 **/ |
|
33 is(document.defaultView.getComputedStyle($("s"), null).getPropertyValue("margin-left"), |
|
34 "10px", |
|
35 "Non-indeterminate checkbox should have a margin of 10px"); |
|
36 |
|
37 $("s").indeterminate = true; |
|
38 |
|
39 is(document.defaultView.getComputedStyle($("s"), null).getPropertyValue("margin-left"), |
|
40 "30px", |
|
41 "Indeterminate checkbox should have a margin of 30px"); |
|
42 |
|
43 $("s").setAttribute("type", "radio"); |
|
44 |
|
45 is(document.defaultView.getComputedStyle($("s"), null).getPropertyValue("margin-left"), |
|
46 "10px", |
|
47 "Only checkboxes should have indeterminate styles applied to them"); |
|
48 |
|
49 $("s").setAttribute("type", "checkbox"); |
|
50 |
|
51 is(document.defaultView.getComputedStyle($("s"), null).getPropertyValue("margin-left"), |
|
52 "30px", |
|
53 "Setting an indeterminate element to type checkbox should give it indeterminate styles"); |
|
54 |
|
55 $("s").indeterminate = false; |
|
56 |
|
57 is(document.defaultView.getComputedStyle($("s"), null).getPropertyValue("margin-left"), |
|
58 "10px", |
|
59 "Newly non-indeterminate checkbox should have a margin of 10px"); |
|
60 |
|
61 </script> |
|
62 </pre> |
|
63 </body> |
|
64 </html> |
|
65 |