|
50 | 50 | 'Effect is inactive in the before phase');
|
51 | 51 |
|
52 | 52 | // Advance to the start offset, which triggers entry to the active phase.
|
53 |
| - container.scrollTop = 600; |
54 |
| - await waitForNextFrame(); |
| 53 | + await runAndWaitForFrameUpdate(() => { |
| 54 | + container.scrollTop = 600; |
| 55 | + }); |
55 | 56 | assert_percents_equal(timeline.currentTime, 0,
|
56 | 57 | "Timeline's current time at start offset");
|
57 | 58 | assert_percents_equal(anim.currentTime, 0,
|
|
60 | 61 | 'Effect at the start of the active phase');
|
61 | 62 |
|
62 | 63 | // Advance to the midpoint of the animation.
|
63 |
| - container.scrollTop = 800; |
64 |
| - await waitForNextFrame(); |
| 64 | + await runAndWaitForFrameUpdate(() => { |
| 65 | + container.scrollTop = 800; |
| 66 | + }); |
65 | 67 | assert_percents_equal(timeline.currentTime, 50,
|
66 | 68 | "Timeline's currentTime at midpoint");
|
67 | 69 | assert_percents_equal(anim.currentTime, 50,
|
|
70 | 72 | 'Effect at the midpoint of the active range');
|
71 | 73 |
|
72 | 74 | // Advance to the end of the animation.
|
73 |
| - container.scrollTop = 1000; |
74 |
| - await waitForNextFrame(); |
| 75 | + await runAndWaitForFrameUpdate(() => { |
| 76 | + container.scrollTop = 1000; |
| 77 | + }); |
75 | 78 | assert_percents_equal(timeline.currentTime, 100,
|
76 | 79 | "Timeline's currentTime at end offset");
|
77 | 80 | assert_percents_equal(anim.currentTime, 100,
|
|
80 | 83 | 'Effect is in the after phase at effect end time');
|
81 | 84 |
|
82 | 85 | // Advance to the scroll limit.
|
83 |
| - container.scrollTop = 1600; |
84 |
| - await waitForNextFrame(); |
| 86 | + await runAndWaitForFrameUpdate(() => { |
| 87 | + container.scrollTop = 1600; |
| 88 | + }); |
85 | 89 | assert_percents_equal(timeline.currentTime, 250,
|
86 | 90 | "Timeline's currentTime at scroll limit");
|
87 | 91 | // Hold time set when the animation finishes, which clamps the value of
|
|
101 | 105 | leading.style = null;
|
102 | 106 | });
|
103 | 107 |
|
104 |
| - container.scrollTop = 0; |
105 |
| - await waitForNextFrame(); |
| 108 | + await runAndWaitForFrameUpdate(() => { |
| 109 | + container.scrollTop = 0; |
| 110 | + }); |
106 | 111 |
|
107 | 112 | const anim = CreateViewTimelineOpacityAnimation(t, target);
|
108 | 113 | const timeline = anim.timeline;
|
|
117 | 122 |
|
118 | 123 |
|
119 | 124 | // Advance to midpoint
|
120 |
| - container.scrollTop = 100; |
121 |
| - await waitForNextFrame(); |
| 125 | + await runAndWaitForFrameUpdate(() => { |
| 126 | + container.scrollTop = 100; |
| 127 | + }); |
122 | 128 | assert_percents_equal(timeline.currentTime, 75,
|
123 | 129 | "Timeline's current time at midpoint");
|
124 | 130 | assert_percents_equal(anim.currentTime, 75,
|
|
127 | 133 | 'Effect at the middle of the active phase');
|
128 | 134 |
|
129 | 135 | // Advance to end-offset
|
130 |
| - container.scrollTop = 200; |
131 |
| - await waitForNextFrame(); |
| 136 | + await runAndWaitForFrameUpdate(() => { |
| 137 | + container.scrollTop = 200; |
| 138 | + }); |
132 | 139 | assert_percents_equal(timeline.currentTime, 100,
|
133 | 140 | "Timeline's current time at end offset");
|
134 | 141 | assert_percents_equal(anim.currentTime, 100,
|
|
137 | 144 | 'Effect inactive at the end offset');
|
138 | 145 |
|
139 | 146 | // Advance to scroll limit.
|
140 |
| - container.scrollTop = 800; |
141 |
| - await waitForNextFrame(); |
| 147 | + await runAndWaitForFrameUpdate(() => { |
| 148 | + container.scrollTop = 800; |
| 149 | + }); |
142 | 150 | assert_percents_equal(timeline.currentTime, 250,
|
143 | 151 | "Timeline's current time at scroll limit");
|
144 | 152 | assert_percents_equal(anim.currentTime, 100,
|
|
155 | 163 | trailing.style = null;
|
156 | 164 | });
|
157 | 165 |
|
158 |
| - container.scrollTop = 0; |
159 |
| - await waitForNextFrame(); |
| 166 | + await runAndWaitForFrameUpdate(() => { |
| 167 | + container.scrollTop = 0; |
| 168 | + }); |
160 | 169 |
|
161 | 170 | const anim = CreateViewTimelineOpacityAnimation(t, target);
|
162 | 171 | const timeline = anim.timeline;
|
|
171 | 180 | 'Effect enters active phase at container start boundary');
|
172 | 181 |
|
173 | 182 | // Advance to start offset.
|
174 |
| - container.scrollTop = 600; |
175 |
| - await waitForNextFrame(); |
| 183 | + await runAndWaitForFrameUpdate(() => { |
| 184 | + container.scrollTop = 600; |
| 185 | + }); |
176 | 186 | assert_percents_equal(timeline.currentTime, 0,
|
177 | 187 | "Timeline's current time at start offset");
|
178 | 188 | assert_percents_equal(anim.currentTime, 0,
|
|
181 | 191 | 'Effect at the start of the active phase');
|
182 | 192 |
|
183 | 193 | // Advance to midpoint.
|
184 |
| - container.scrollTop = 700; |
185 |
| - await waitForNextFrame(); |
| 194 | + await runAndWaitForFrameUpdate(() => { |
| 195 | + container.scrollTop = 700; |
| 196 | + }); |
186 | 197 | assert_percents_equal(timeline.currentTime, 25,
|
187 | 198 | "Timeline's current time at the midpoint");
|
188 | 199 | assert_percents_equal(anim.currentTime, 25,
|
|
191 | 202 | 'Effect at the midpoint of the active phase');
|
192 | 203 |
|
193 | 204 | // Advance to end offset.
|
194 |
| - container.scrollTop = 800; |
195 |
| - await waitForNextFrame(); |
| 205 | + await runAndWaitForFrameUpdate(() => { |
| 206 | + container.scrollTop = 800; |
| 207 | + }); |
196 | 208 | assert_percents_equal(timeline.currentTime, 50,
|
197 | 209 | "Timeline's currentTime at max scroll offset");
|
198 | 210 | assert_percents_equal(anim.currentTime, 50,
|
|
0 commit comments