Update tests and Element.animate first parameter

The tests no longer test onsample, since it's not part of the standard.
This commit is contained in:
Nathan Shively-Sanders
2018-12-13 10:54:22 -08:00
parent 7114a88a1f
commit 4e0b451c2f
2 changed files with 1 additions and 29 deletions
+1 -1
View File
@@ -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 {
@@ -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);
});
}
}