layout/style/test/test_bug229915.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=229915
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 229915</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 <style type="text/css">
michael@0 11
michael@0 12 p { color: black; background: transparent; }
michael@0 13 p.prev + p { color: green; }
michael@0 14 p.prev ~ p { background: white; }
michael@0 15
michael@0 16 </style>
michael@0 17 </head>
michael@0 18 <body>
michael@0 19 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=229915">Mozilla Bug 229915</a>
michael@0 20 <div id="display">
michael@0 21
michael@0 22 <div>
michael@0 23 <p id="toinsertbefore">After testing, this should turn green.</p>
michael@0 24 </div>
michael@0 25
michael@0 26 <div>
michael@0 27 <p id="toreplace">To be replaced.</p>
michael@0 28 <p id="replacecolor">After testing, this should turn green.</p>
michael@0 29 </div>
michael@0 30
michael@0 31 <div>
michael@0 32 <p class="prev">Previous paragraph.</p>
michael@0 33 <p id="toremove">To be removed.</p>
michael@0 34 <p id="removecolor">After testing, this should turn green.</p>
michael@0 35 </div>
michael@0 36
michael@0 37 </div>
michael@0 38 <div id="content" style="display: none">
michael@0 39
michael@0 40 </div>
michael@0 41 <pre id="test">
michael@0 42 <script class="testbody" type="text/javascript">
michael@0 43
michael@0 44 /** Test for Bug 229915 **/
michael@0 45
michael@0 46 const GREEN = "rgb(0, 128, 0)";
michael@0 47 const BLACK = "rgb(0, 0, 0)";
michael@0 48 const TRANSPARENT = "transparent";
michael@0 49 const WHITE = "rgb(255, 255, 255)";
michael@0 50
michael@0 51 function make_prev() {
michael@0 52 var result = document.createElement("p");
michael@0 53 result.setAttribute("class", "prev");
michael@0 54 var t = document.createTextNode("Dynamically created previous paragraph.");
michael@0 55 result.appendChild(t);
michael@0 56 return result;
michael@0 57 }
michael@0 58
michael@0 59 function color(id) {
michael@0 60 return getComputedStyle(document.getElementById(id), "").color;
michael@0 61 }
michael@0 62 function bg(id) {
michael@0 63 return getComputedStyle(document.getElementById(id), "").backgroundColor;
michael@0 64 }
michael@0 65
michael@0 66 var node;
michael@0 67
michael@0 68 // test insert
michael@0 69 is(color("toinsertbefore"), BLACK, "initial state (insertion test)");
michael@0 70 is(bg("toinsertbefore"), TRANSPARENT, "initial state (insertion test)");
michael@0 71 node = document.getElementById("toinsertbefore");
michael@0 72 node.parentNode.insertBefore(make_prev(), node);
michael@0 73 is(color("toinsertbefore"), GREEN, "inserting should turn node green");
michael@0 74 is(bg("toinsertbefore"), WHITE, "inserting should turn background white");
michael@0 75
michael@0 76 // test replace
michael@0 77 is(color("replacecolor"), BLACK, "initial state (replacement test)");
michael@0 78 is(bg("replacecolor"), TRANSPARENT, "initial state (replacement test)");
michael@0 79 node = document.getElementById("toreplace");
michael@0 80 node.parentNode.replaceChild(make_prev(), node);
michael@0 81 is(color("replacecolor"), GREEN, "replacing should turn node green");
michael@0 82 is(bg("replacecolor"), WHITE, "replacing should turn background white");
michael@0 83
michael@0 84 // test remove
michael@0 85 is(color("removecolor"), BLACK, "initial state (removal test)");
michael@0 86 is(bg("removecolor"), WHITE, "initial state (removal test; no change)");
michael@0 87 node = document.getElementById("toremove");
michael@0 88 node.parentNode.removeChild(node);
michael@0 89 is(color("removecolor"), GREEN, "removing should turn node green");
michael@0 90 is(bg("removecolor"), WHITE, "removing should leave background");
michael@0 91
michael@0 92 </script>
michael@0 93 </pre>
michael@0 94 </body>
michael@0 95 </html>

mercurial