blob: 3e130b9a969103d50bf64826907b31dd4576ffc5 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<script type="text/javascript">
description("Testing the <code>LayoutNode.addChild(child[, index])</code> method.");
window.jsTestIsAsync = true;
const node = new LayoutNode;
const a = new LayoutNode;
const b = new LayoutNode;
debug("node.addChild(a)");
const retVal = node.addChild(a);
shouldBeTrue("node.children.length === 1");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("retVal === a");
debug("");
debug("node.addChild(b, 0)");
node.addChild(b, 0);
shouldBeTrue("node.children.length === 2");
shouldBeTrue("node.children[0] === b");
shouldBeTrue("node.children[1] === a");
debug("");
shouldBecomeEqual("node.element.childElementCount", "2", () => {
shouldBeTrue("node.element.firstElementChild === b.element");
shouldBeTrue("node.element.lastElementChild === a.element");
finishMediaControlsTest();
});
</script>
<script src="../../../resources/js-test-post.js"></script>