4 https://bugzilla.mozilla.org/show_bug.cgi?id=372770
7 <title>Test for Bug
372770</title>
8 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <style id=
"testStyle">
16 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=372770">Mozilla Bug
372770</a>
18 <div id=
"content" style=
"display: none">
22 <script class=
"testbody" type=
"text/javascript">
24 /** Test for Bug
372770 **/
25 var style1 = $(
"content").style;
26 var style2 = $(
"testStyle").sheet.cssRules[
0].style;
28 var colors = [
"rgb(128, 128, 128)",
"transparent" ]
31 for (i =
0; i < colors.length; ++i) {
32 var color = colors[i];
35 is(style1.color, color,
"Inline style color roundtripping failed at color " + i);
36 is(style2.color, color,
"Rule style color roundtripping failed at color " + i);
39 // This code is only here because of bug
372783. Once that's fixed, this test
40 // for
"rgba(0, 0, 0, 0)" will fail.
41 style1.color =
"rgba(0, 0, 0, 0)";
42 style2.color =
"rgba(0, 0, 0, 0)";
43 is(style1.color,
"transparent",
44 "Inline style should give transparent for rgba(0,0,0,0)");
45 is(style2.color,
"transparent",
46 "Rule style should give transparent for rgba(0,0,0,0)");
47 todo(style1.color ==
"rgba(0, 0, 0, 0)",
48 "Inline style should round-trip black transparent color correctly");
49 todo(style2.color ==
"rgba(0, 0, 0, 0)",
50 "Rule style should round-trip black transparent color correctly");
52 for (var i =
0; i <=
100; ++i) {
53 if (i ==
70 || i ==
90) {
54 // Tinderbox unhappy for some reason... just skip these for now?
57 var color1 =
"rgba(128, 128, 128, " + i/
100 +
")";
58 var color2 =
"rgba(175, 63, 27, " + i/
100 +
")";
59 style1.color = color1;
60 style1.backgroundColor = color2;
61 style2.color = color2;
62 style2.background = color1;
65 // Bug
372783 means this doesn't round-trip quite right
66 todo(style1.color == color1,
67 "Inline style color roundtripping failed at opacity " + i);
68 todo(style1.backgroundColor == color2,
69 "Inline style background roundtripping failed at opacity " + i);
70 todo(style2.color == color2,
71 "Rule style color roundtripping failed at opacity " + i);
72 todo(style2.backgroundColor == color1,
73 "Rule style background roundtripping failed at opacity " + i);
74 color1 =
"rgb(128, 128, 128)";
75 color2 =
"rgb(175, 63, 27)";
78 is(style1.color, color1,
79 "Inline style color roundtripping failed at opacity " + i);
80 is(style1.backgroundColor, color2,
81 "Inline style background roundtripping failed at opacity " + i);
82 is(style2.color, color2,
83 "Rule style color roundtripping failed at opacity " + i);
84 is(style2.backgroundColor, color1,
85 "Rule style background roundtripping failed at opacity " + i);