Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// testing duration
const testDuration =
mode === TRANSITION_EVENTS.UPDATE
? testCase.input[ti].transitionDuration - UPDATE_INTERVAL
: testCase.input[ti].transitionDuration;
t.is(
equals(transitionManager.state.duration, testDuration, 1e-7),
testCase.shouldChange[mode].transitionDuration,
'transitionDuration match'
);
// testing easing function
let testEasingFunc = testCase.input[ti].transitionEasing;
if (mode === TRANSITION_EVENTS.UPDATE) {
const completion = UPDATE_INTERVAL / testCase.input[ti].transitionDuration;
testEasingFunc = cropEasingFunction(testCase.input[ti].transitionEasing, completion);
}
t.is(
compareFunc(transitionManager.state.easing, testEasingFunc, 0.1),
testCase.shouldChange[mode].transitionEasing,
'transitionEasing match'
);
// We provided an external timer so the animation never ends.
// The test cannot end if there is a pending animation frame requested.
transitionManager._endTransition();
}
});
t.end();
interruptions.forEach(x0 => {
var newEasing = cropEasingFunction(func, x0);
t.ok(equals(newEasing(0), 0), 'cropped easing function starts at (0, 0)');
t.ok(equals(newEasing(1), 1), 'cropped easing function ends at (1, 1)');
values.forEach(val => {
t.ok(
equals(func(x0 + val * (1 - x0)), func(x0) + (1 - func(x0)) * newEasing(val)),
'cropped easing function matches the old one'
);
});
});
});