[Modern Media Controls] Scrubber stops moving while scrubbing on macOS
[WebKit-https.git] / LayoutTests / media / modern-media-controls / layout-node / children.html
1 <script src="../../../resources/js-test-pre.js"></script>
2 <script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
3 <script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js" type="text/javascript"></script>
4 <script src="../resources/media-controls-utils.js" type="text/javascript"></script>
5 <script type="text/javascript">
6
7 description("Testing the <code>LayoutNode.children</code> property.");
8
9 window.jsTestIsAsync = true;
10
11 const node = new LayoutNode;
12
13 debug("Check default state");
14 shouldBeTrue("Array.isArray(node.children)");
15 shouldBeTrue("node.children.length === 0");
16
17 const a = new LayoutNode;
18 const b = new LayoutNode;
19 const c = new LayoutNode;
20
21 const children = [a, b, c];
22 node.children = children;
23
24 debug("");
25 debug("Set children to [a, b, c]");
26 shouldBeTrue("node.children.length === 3");
27 shouldBeTrue("node.children[0] === a");
28 shouldBeTrue("node.children[1] === b");
29 shouldBeTrue("node.children[2] === c");
30 shouldBeTrue("node.children !== children");
31
32 let numberOfFrames = 0;
33 scheduler.frameDidFire = function()
34 {
35     debug("");
36     debug("Layout was performed");
37
38     switch (++numberOfFrames) {
39     case 1:
40         shouldBeTrue("node.element.childElementCount === 3");
41         shouldBeTrue("node.element.firstElementChild === a.element");
42         shouldBeTrue("node.element.firstElementChild.nextElementSibling === b.element");
43         shouldBeTrue("node.element.lastElementChild === c.element");
44         debug("");
45         debug("Set children to be a copy of itself");
46         node.children = Array.from(node.children);
47         shouldBeFalse("node.children[0].needsLayout");
48         shouldBeFalse("node.children[1].needsLayout");
49         shouldBeFalse("node.children[2].needsLayout");
50         debug("");
51         debug("Set children to [b, a]");
52         node.children = [b, a];
53         shouldBeTrue("node.children.length === 2");
54         shouldBeTrue("node.children[0] === b");
55         shouldBeTrue("node.children[1] === a");
56         break;
57     case 2:
58         shouldBeTrue("node.element.childElementCount === 2");
59         shouldBeTrue("node.element.firstElementChild === b.element");
60         shouldBeTrue("node.element.lastElementChild === a.element");
61         debug("");
62         debug("Set children to []");
63         node.children = [];
64         shouldBeTrue("node.children.length === 0");
65         break;
66     case 3:
67         shouldBeTrue("node.element.childElementCount === 0");
68         finishMediaControlsTest();
69         break;
70     }
71 };
72
73 </script>
74 <script src="../../../resources/js-test-post.js"></script>