我正在尝试用QUnit设置ember测试,以测试我的Ember.js应用程序,下面的博客文章是:开始使用成员测试和qunit对ember.js进行集成测试
我的问题是,每次我尝试访问带成员测试访问助手的路由时,visit(<route>).then承诺都不会被调用,但是呈现正确的视图。
这里是我当前的Ember.js设置:(我也尝试了测试版)
编辑1:
QUnit只显示测试正在运行,没有失败或成功消息。
测试:
module("Ember.js Library", {
setup: function() {
Ember.run(App, App.advanceReadiness);
},
teardown: function() {
App.reset();
}
});
test("Check HTML is returned", function() {
expect(2);
visit("/").then(function() {
ok(false, "Show me an error!");
});
});测试设置(test_helper.js):
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
document.write('<style>#ember-testing-container { position: absolute; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; } #ember-testing { zoom: 50%; }</style>');
App.rootElement = '#ember-testing';
App.setupForTesting();
App.injectTestHelpers();编辑2:
QUnit似乎是正确的。如果我使用下面的测试,那么QUnit测试运行程序将显示正确的失败。但是,如果我在上面的承诺中包含了断言,那么QUnit将测试显示为正在运行,但是测试似乎并没有停止。
test("Check HTML is returned", function() {
expect(2);
ok(false, "Show me an error!");
});发布于 2013-11-27 14:42:31
发布于 2013-11-25 19:41:49
你错过了qunit,把这个家伙和你的另一个document.writes加在一起
document.write('<div id="qunit"></div>');http://emberjs.jsbin.com/inATaNE/1/edit
https://stackoverflow.com/questions/20196325
复制相似问题