我使用业力编写angular2测试用例,但不知道如何测试动画。我试图获取并检查宿主元素的转换属性,但未获得任何结果,“ getCalculateStyle()”方法均无法正常工作。 有什么建议么?
要测试的示例代码:
func2Test() {
const animations: AnimationMetadata[] = [animate('500ms ease-in', style({transform: `translate3d(100px, 0px, 0px)`}))];
const myAnimation: AnimationFactory = this.animationBuilder.build(animations);
const player = myAnimation.create(this.slickTrack.nativeElement);
player.play();
}
答案 0 :(得分:1)
我想我找到一个例子
it('should fill in missing starting steps when a starting `style()` value is not used',
() => {
const steps = [animate(1000, style({width: 999}))];
const players = invokeAnimationSequence(rootElement, steps);
expect(players[0].keyframes).toEqual([
{width: AUTO_STYLE, offset: 0}, {width: 999, offset: 1}
]);
});