首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Jasmine和Karma-runner进行单元测试的示例Extjs5应用程序

用Jasmine和Karma-runner进行单元测试的示例Extjs5应用程序
EN

Stack Overflow用户
提问于 2014-10-17 10:45:46
回答 1查看 857关注 0票数 3

我是Extjs5的新手,试图用业力运行器运行茉莉花单元测试用例。虽然我成功地能够在Ext4.2应用程序中完成这个任务,但是相同的进程并不适用于Extjs5。

我看过了,但没有任何有用的链接

如果有人已经执行了Ext5应用程序,请分享代码。

任何帮助都是非常感谢的。

谢谢塔帕斯维尼

EN

回答 1

Stack Overflow用户

发布于 2014-12-09 23:28:19

诀窍是在开始测试之前允许正确加载所需的ExtJS类。确保在karma.conf.js中包括以下内容

代码语言:javascript
复制
// We need to add an element with the ID 'appLoadingIndicator' because [app.js].launch() is     expecting it and tries to remove it

// Karma normally starts the tests right after all files specified in 'karma.config.js' have been loaded
// We only want the tests to start after Sencha Touch/ExtJS has bootstrapped the application
// 1. We temporary override the '__karma__.loaded' function
// 2. When Ext is ready we call the '__karma__.loaded' function manually
var karmaLoadedFunction = window.__karma__.loaded;
window.__karma__.loaded = function () {
};

bootstrapExtJS(); // Create this function to add anything that is not included in your class definition requires and you need to require explicitly

Ext.onReady(function () {
  window.__karma__.loaded = karmaLoadedFunction;
  window.__karma__.loaded();
});

如果对你有用的话请告诉我。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26423343

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档