From 4e0b451c2f82dd40f3cf149e87c9388e9e74960c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 13 Dec 2018 10:54:22 -0800 Subject: [PATCH] Update tests and Element.animate first parameter The tests no longer test onsample, since it's not part of the standard. --- types/web-animations-js/index.d.ts | 2 +- .../web-animations-js-tests.ts | 28 ------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/types/web-animations-js/index.d.ts b/types/web-animations-js/index.d.ts index c317675727..8e3ac25f95 100644 --- a/types/web-animations-js/index.d.ts +++ b/types/web-animations-js/index.d.ts @@ -103,7 +103,7 @@ declare class GroupEffect extends KeyframeEffect { constructor(effects: KeyframeEffect[]); } interface Element { - animate(effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming): Animation; + animate(effect: AnimationKeyFrame | AnimationKeyFrame[] | null, timing: number | AnimationEffectTiming): Animation; getAnimations(): Animation[]; } interface Document { diff --git a/types/web-animations-js/web-animations-js-tests.ts b/types/web-animations-js/web-animations-js-tests.ts index 934bc944d1..aa51fa14d1 100644 --- a/types/web-animations-js/web-animations-js-tests.ts +++ b/types/web-animations-js/web-animations-js-tests.ts @@ -88,31 +88,3 @@ function test_whiteRabbit() { } } } -// Testing onsample -// https://github.com/web-animations/web-animations-js/releases -function test_onsample_And_addEventListener() { - const elem = document.createElement("div"); - if (elem) { - elem.style.width = '150px'; - elem.style.color = 'black'; - elem.textContent = "HELLO"; - document.body.appendChild(elem); - const myEffect = new KeyframeEffect(elem, [], 1000); - myEffect.onsample = (timeFraction, effect, animation) => { - console.log("fraction", timeFraction); - // After finish event, timeFraction is null - if (timeFraction) { - effect.target.style.opacity = timeFraction.toFixed(2); - } - }; - // onsample is write only - console.log(myEffect.onsample); // => undefined - const myAnimation = document.timeline.play(myEffect); - myAnimation.addEventListener("finish", (e) => { - console.log("finished", e); - }); - myAnimation.addEventListener("cancel", (e) => { - console.log("canceled", e); - }); - } -}