summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html')
-rw-r--r--testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html b/testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html
new file mode 100644
index 0000000000..9c9aff511d
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/animation-frames/cancel-pending.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>cancelAnimationFrame cancels a pending animation frame callback</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#run-the-animation-frame-callbacks">
+<div id="log"></div>
+<script>
+async_test(t => {
+ let didCall = false;
+
+ function callbackOne() {
+ cancelAnimationFrame(twoHandle);
+ requestAnimationFrame(t.step_func(() => {
+ assert_false(didCall, 'Should NOT have called the second callback');
+ t.done();
+ }));
+ }
+
+ function callbackTwo() {
+ didCall = true;
+ }
+
+ requestAnimationFrame(callbackOne);
+ const twoHandle = requestAnimationFrame(callbackTwo);
+}, 'cancelAnimationFrame cancels a pending animation frame callback');
+</script>