| <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.insertBefore(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.insertBefore(c)"); |
| const retVal = node.insertBefore(c); |
| shouldBeTrue("node.children.length === 1"); |
| shouldBeTrue("node.children[0] === c"); |
| shouldBeTrue("retVal === c"); |
| |
| debug(""); |
| debug("node.insertBefore(a, c)"); |
| node.insertBefore(a, c); |
| shouldBeTrue("node.children.length === 2"); |
| shouldBeTrue("node.children[0] === a"); |
| shouldBeTrue("node.children[1] === c"); |
| |
| debug(""); |
| debug("node.insertBefore(b, c)"); |
| node.insertBefore(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.insertBefore(a, c)"); |
| node.insertBefore(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> |