blob: 002d6f748c80afb4c84d71854bf31b1fc12c8e50 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.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.removeChild(child)</code> method.");
window.jsTestIsAsync = true;
const node = new LayoutNode;
const a = new LayoutNode;
const b = new LayoutNode;
const c = new LayoutNode;
debug("node.children = [a, b, c]");
node.children = [a, b, c];
shouldBeTrue("node.children.length === 3");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("node.children[1] === b");
shouldBeTrue("node.children[2] === c");
debug("");
debug("node.removeChild(b)");
const retVal = node.removeChild(b);
shouldBeTrue("node.children.length === 2");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("node.children[1] === c");
shouldBeTrue("retVal === b");
debug("");
debug("node.removeChild(a)");
node.removeChild(a);
shouldBeTrue("node.children.length === 1");
shouldBeTrue("node.children[0] === c");
debug("");
debug("node.removeChild(a)");
node.removeChild(a);
shouldBeTrue("node.children.length === 1");
shouldBeTrue("node.children[0] === c");
scheduler.frameDidFire = function()
{
debug("");
debug("Layout was performed");
shouldBeTrue("node.element.childElementCount === 1");
shouldBeTrue("node.element.firstElementChild === c.element");
finishMediaControlsTest();
};
</script>
<script src="../../../resources/js-test-post.js"></script>