【问题标题】:How to test requestAnimationFrame with jasmine(2.4) testing?如何使用 jasmine(2.4) 测试来测试 requestAnimationFrame?
【发布时间】:2016-06-15 11:08:19
【问题描述】:

我是 jasmine 测试的新手,我在 jasmine document 中搜索了 requestAnimationFrame 的测试用例示例,但找不到。

我找到了这个plugin 来创建模拟 requestAnimationFrame,但我需要使用 jasmine 内置选项来测试 requestAnimationFrame。

是否有任何选项可以使用内置功能测试带有茉莉花的 requestAnimationFrame?

【问题讨论】:

标签: jasmine requestanimationframe


【解决方案1】:

使用setTimeout()done()

it("Spec with requestAnimationFrame", (done) => {
    window.requestAnimationFrame(() => {
        // Do something testable here
    });

    setTimeout(function() {
        // Verify testable values here

        done();
    }, 200);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-08
    • 2016-06-17
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 2013-04-19
    • 2016-03-17
    相关资源
    最近更新 更多