blob: c69beb8ed64201b824dad6de27bc2b9600041adc [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 type="text/javascript">
description("Testing the <code>LayoutNode.parent</code> property.");
const node = new LayoutNode;
const a = new LayoutNode;
const b = new LayoutNode;
const c = new LayoutNode;
const d = new LayoutNode;
debug("Checking nodes have a null parent by default");
shouldBeTrue("a.parent === null");
shouldBeTrue("b.parent === null");
shouldBeTrue("c.parent === null");
shouldBeTrue("d.parent === null");
debug("");
debug("node.children = [a, b, c]");
node.children = [a, b, c];
shouldBeTrue("a.parent === node");
shouldBeTrue("b.parent === node");
shouldBeTrue("c.parent === node");
debug("");
debug("a.remove()");
a.remove();
shouldBeTrue("a.parent === null");
debug("");
debug("node.removeChild(b)");
node.removeChild(b);
shouldBeTrue("b.parent === null");
debug("");
debug("node.addChild(a)");
node.addChild(a);
shouldBeTrue("a.parent === node");
debug("");
debug("node.insertBefore(b, c)");
node.insertBefore(b, c);
shouldBeTrue("b.parent === node");
debug("");
debug("node.insertAfter(d, c)");
node.insertAfter(d, c);
shouldBeTrue("d.parent === node");
debug("");
debug("node.children = []");
node.children = [];
shouldBeTrue("a.parent === null");
shouldBeTrue("b.parent === null");
shouldBeTrue("c.parent === null");
shouldBeTrue("d.parent === null");
</script>
<script src="../../../resources/js-test-post.js"></script>