blob: 5f599b086ff6592eec972e6e8760cc38d23238b2 [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.remove()</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("b.remove()");
const retVal = b.remove();
shouldBeTrue("node.children.length === 2");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("node.children[1] === c");
shouldBeTrue("retVal === b");
debug("");
debug("a.remove()");
a.remove();
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>