Bug 1053898 - Update browser_markup_anonymous_03 test for new shadowdom display;r=bgrins draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 07 Mar 2018 17:47:10 +0100
changeset 774776 024ff11140b33ca2146eb43ba96d25b8e706aa36
parent 774775 620b1eba4d234b1333672f31862f6f349f962e2c
push id104503
push userjdescottes@mozilla.com
push dateThu, 29 Mar 2018 15:12:09 +0000
reviewersbgrins
bugs1053898
milestone61.0a1
Bug 1053898 - Update browser_markup_anonymous_03 test for new shadowdom display;r=bgrins MozReview-Commit-ID: FwFkeWuYPwj
devtools/client/inspector/markup/test/browser_markup_anonymous_03.js
--- a/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js
+++ b/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js
@@ -1,35 +1,44 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
+http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test shadow DOM content in the markupview.
 // Note that many features are not yet enabled, but basic listing
 // of elements should be working.
 const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
 
 add_task(async function() {
   Services.prefs.setBoolPref("dom.webcomponents.shadowdom.enabled", true);
 
   let {inspector} = await openInspectorForURL(TEST_URL);
 
-  let shadow = await getNodeFront("#shadow", inspector.markup);
-  let children = await inspector.walker.children(shadow);
+  let shadowHostFront = await getNodeFront("#shadow", inspector.markup);
+  is(shadowHostFront.numChildren, 3, "Children of the shadow host are correct");
 
-  // Bug 1441535.
-  todo_is(shadow.numChildren, 3, "Children of the shadow root are counted");
-  is(children.nodes.length, 3, "Children returned from walker");
+  await inspector.markup.expandNode(shadowHostFront);
+  await waitForMultipleChildrenUpdates(inspector);
+
+  let shadowContainer = inspector.markup.getContainer(shadowHostFront);
+  let containers = shadowContainer.getChildContainers();
 
   info("Checking the ::before pseudo element");
-  let before = children.nodes[0];
+  let before = containers[1].node;
   await isEditingMenuDisabled(before, inspector);
 
+  info("Checking shadow dom children");
+  let shadowRootFront = containers[0].node;
+  let children = await inspector.walker.children(shadowRootFront);
+
+  is(shadowRootFront.numChildren, 2, "Children of the shadow root are counted");
+  is(children.nodes.length, 2, "Children returned from walker");
+
   info("Checking the <h3> shadow element");
-  let shadowChild1 = children.nodes[1];
+  let shadowChild1 = children.nodes[0];
   await isEditingMenuDisabled(shadowChild1, inspector);
 
   info("Checking the <select> shadow element");
-  let shadowChild2 = children.nodes[2];
+  let shadowChild2 = children.nodes[1];
   await isEditingMenuDisabled(shadowChild2, inspector);
 });