Bug 1483660 - Add server test for UA widget support in inspector;r=ladybenko

Depends on D10538

Differential Revision: https://phabricator.services.mozilla.com/D10539

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-11-05 17:23:54 +00:00
parent 8aa1b2290c
commit 9dbd9e5cee
2 changed files with 42 additions and 0 deletions

View File

@ -137,3 +137,39 @@ add_task(async function() {
is(slotted._form.nodeValue, originalSlot._form.nodeValue,
"Slotted content is the same as original's");
});
add_task(async function() {
info("Test UA widgets when showUserAgentShadowRoots is true");
await SpecialPowers.pushPrefEnv({"set": [
["devtools.inspector.showUserAgentShadowRoots", true],
]});
const { walker } = await initInspectorFront(URL);
let el = await walker.querySelector(walker.rootNode, "#video-controls");
let hostChildren = await walker.children(el);
is(hostChildren.nodes.length, 1, "#video-controls tag has one child");
const shadowRoot = hostChildren.nodes[0];
ok(shadowRoot.isShadowRoot, "#video-controls has a shadow-root child");
el = await walker.querySelector(walker.rootNode, "#video-controls-with-children");
hostChildren = await walker.children(el);
is(hostChildren.nodes.length, 2, "#video-controls-with-children has two children");
});
add_task(async function() {
info("Test UA widgets when showUserAgentShadowRoots is false");
await SpecialPowers.pushPrefEnv({"set": [
["devtools.inspector.showUserAgentShadowRoots", false],
]});
const { walker } = await initInspectorFront(URL);
let el = await walker.querySelector(walker.rootNode, "#video-controls");
let hostChildren = await walker.children(el);
is(hostChildren.nodes.length, 0, "#video-controls tag has no children");
el = await walker.querySelector(walker.rootNode, "#video-controls-with-children");
hostChildren = await walker.children(el);
is(hostChildren.nodes.length, 1, "#video-controls-with-children has one child");
});

View File

@ -107,5 +107,11 @@
<test-simple-slot id="slot-inline-text">
Lorem ipsum
</test-simple-slot>
<hr>
<video id="video-controls" controls></video>
<video id="video-controls-with-children" controls>
<div>some content</div>
</video>
</body>
</html>