本文整理汇总了TypeScript中angular2/src/core/dom/dom_adapter.DOM.supportsAnimation方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.supportsAnimation方法的具体用法?TypeScript DOM.supportsAnimation怎么用?TypeScript DOM.supportsAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/core/dom/dom_adapter.DOM
的用法示例。
在下文中一共展示了DOM.supportsAnimation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should support duration and delay defined in CSS', inject([AnimationBuilder], (animate) => {
var animateCss = animate.css();
var element =
el(`<div style="${DOM.getAnimationPrefix()}transition: 0.5s ease 250ms;"></div>`);
var runner = animateCss.start(element);
runner.flush();
if (DOM.supportsAnimation()) {
expect(runner.computedDelay).toBe(250);
expect(runner.computedDuration).toBe(500);
} else {
expect(runner.computedDelay).toEqual(0);
expect(runner.computedDuration).toEqual(0);
}
}));
示例2: inject
inject([AnimationBuilder], (animate) => {
var spyObject = new SpyObject();
var callback = spyObject.spy('animationFinished');
var runner = animate.css()
.addClass('one')
.addClass('two')
.setDuration(100)
.start(el('<div></div>'))
.onComplete(callback);
expect(callback).not.toHaveBeenCalled();
runner.flush();
if (DOM.supportsAnimation()) {
expect(callback).not.toHaveBeenCalled();
runner.handleAnimationCompleted();
expect(callback).toHaveBeenCalled();
} else {
expect(callback).toHaveBeenCalled();
}
}));