blob: b9cac16642031db75854f33b7d1c60aac921fb0f [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.insertAfter(newSibling, referenceSibling)</code> method.");
window.jsTestIsAsync = true;
const node = new LayoutNode;
const a = new LayoutNode;
const b = new LayoutNode;
const c = new LayoutNode;
debug("node.insertAfter(a)");
const retVal = node.insertAfter(a);
shouldBeTrue("node.children.length === 1");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("retVal === a");
debug("");
debug("node.insertAfter(c, a)");
node.insertAfter(c, a);
shouldBeTrue("node.children.length === 2");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("node.children[1] === c");
debug("");
debug("node.insertAfter(b, a)");
node.insertAfter(b, a);
shouldBeTrue("node.children.length === 3");
shouldBeTrue("node.children[0] === a");
shouldBeTrue("node.children[1] === b");
shouldBeTrue("node.children[2] === c");
debug("");
debug("node.insertAfter(a, c)");
node.insertAfter(a, c);
shouldBeTrue("node.children.length === 3");
shouldBeTrue("node.children[0] === b");
shouldBeTrue("node.children[1] === c");
shouldBeTrue("node.children[2] === a");
scheduler.frameDidFire = function()
{
debug("");
debug("Layout was performed");
shouldBeTrue("node.element.childElementCount === 3");
shouldBeTrue("node.element.firstElementChild === b.element");
shouldBeTrue("node.element.firstElementChild.nextElementSibling === c.element");
shouldBeTrue("node.element.lastElementChild === a.element");
finishMediaControlsTest();
};
</script>
<script src="../../../resources/js-test-post.js"></script>