layout/inspector/tests/test_bug609549.xhtml

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <!--
michael@0 3 https://bugzilla.mozilla.org/show_bug.cgi?id=609549
michael@0 4 -->
michael@0 5 <head>
michael@0 6 <title>Test for Bug 609549</title>
michael@0 7 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 9
michael@0 10 <bindings xmlns="http://www.mozilla.org/xbl">
michael@0 11 <binding id="testBinding">
michael@0 12 <!-- No linebreaks since this is html and whitespace is preserved. -->
michael@0 13 <content><div anonid="box-A">x</div><div anonid="box-B"><children includes="span"/></div><div anonid="box-C">x</div><children/></content>
michael@0 14 </binding>
michael@0 15 </bindings>
michael@0 16 </head>
michael@0 17
michael@0 18 <body>
michael@0 19 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=609549">Mozilla Bug 609549</a>
michael@0 20 <div id="bound" style="-moz-binding: url(#testBinding);"><p id="p">lorem ipsum dolor sit amet</p><span id="sandwiched">sandwiched</span></div>
michael@0 21
michael@0 22 <div id="content" style="display: none">
michael@0 23
michael@0 24 </div>
michael@0 25 <pre id="test">
michael@0 26 <script type="application/javascript">
michael@0 27 <![CDATA[
michael@0 28
michael@0 29 /** Test for Bug 609549 **/
michael@0 30 SimpleTest.waitForExplicitFinish();
michael@0 31
michael@0 32 addLoadEvent(function() {
michael@0 33 var domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
michael@0 34 getService(SpecialPowers.Ci.inIDOMUtils);
michael@0 35 ok("getChildrenForNode" in domUtils, "domUtils has no getChildrenForNode");
michael@0 36 var withoutAnons = SpecialPowers.unwrap(domUtils.getChildrenForNode($("bound"), false));
michael@0 37
michael@0 38 is(withoutAnons.length, $("bound").childNodes.length,
michael@0 39 "withoutAnons should be the same length as childNodes");
michael@0 40 is(withoutAnons[0], $("p"), "didn't get paragraph - without anons");
michael@0 41 is(withoutAnons[1], $("sandwiched"),
michael@0 42 "didn't get sandwiched span - without anons");
michael@0 43
michael@0 44 var withAnons = domUtils.getChildrenForNode($("bound"), true);
michael@0 45
michael@0 46 is(withAnons.length, 4, "bad withAnons.length");
michael@0 47 is(withAnons[0].getAttribute("anonid"), "box-A",
michael@0 48 "didn't get anonymous box-A");
michael@0 49 is(withAnons[1].getAttribute("anonid"), "box-B",
michael@0 50 "didn't get anonymous box-B");
michael@0 51 is(withAnons[2].getAttribute("anonid"), "box-C",
michael@0 52 "didn't get anonymous box-C");
michael@0 53 is(withAnons[3].id, "p", "didn't get paragraph - with anons");
michael@0 54
michael@0 55 var bKids = domUtils.getChildrenForNode(withAnons[1], true);
michael@0 56 is(bKids.length, 1, "bKids.length is bad");
michael@0 57 is(SpecialPowers.unwrap(bKids[0]), $("sandwiched"),
michael@0 58 "didn't get sandwiched span inserted into box-B");
michael@0 59
michael@0 60 SimpleTest.finish();
michael@0 61 });
michael@0 62
michael@0 63 ]]>
michael@0 64 </script>
michael@0 65 </pre>
michael@0 66 </body>
michael@0 67 </html>

mercurial