Ember.js 用于在应用程序路由中呈现模式的Qunit
在我的申请过程中,我从ember网站上获得了关于如何呈现modals的打开和关闭的代码。 我一直在寻找如何对渲染操作进行单元测试的示例,但找不到太多文档 在我对应用程序路由的单元测试中,只是为了触发路由上的操作并查看会发生什么,这就是我所拥有的和我得到的错误。感谢您提供的任何指导Ember.js 用于在应用程序路由中呈现模式的Qunit,ember.js,ember-cli,qunit,ember-router,ember-qunit,Ember.js,Ember Cli,Qunit,Ember Router,Ember Qunit,在我的申请过程中,我从ember网站上获得了关于如何呈现modals的打开和关闭的代码。 我一直在寻找如何对渲染操作进行单元测试的示例,但找不到太多文档 在我对应用程序路由的单元测试中,只是为了触发路由上的操作并查看会发生什么,这就是我所拥有的和我得到的错误。感谢您提供的任何指导 test('route open modal', function(assert) { let route = this.subject(); route.send('openModal', 'cancel-
test('route open modal', function(assert) {
let route = this.subject();
route.send('openModal', 'cancel-modal');
assert.ok(route);
});
Died on test #1 at Module.callback (http://localhost:4200/exampleApp/assets/tests.js:1113:24)
at Module.exports (http://localhost:4200/exampleApp/assets/vendor.js:140:32)
at requireModule (http://localhost:4200/exampleApp/assets/vendor.js:32:18)
at TestLoader.require (http://localhost:4200/exampleApp/assets/test-support.js:7124:7)
at TestLoader.loadModules (http://localhost:4200/exampleApp/assets/test-support.js:7116:14)
at Function.TestLoader.load (http://localhost:4200/exampleApp/assets/test-support.js:7146:22)
at http://localhost:4200/exampleApp/assets/test-support.js:7030:18: Cannot read property 'state' of undefined@ 31 ms
Source:
TypeError: Cannot read property 'state' of undefined
at parentRoute (http://localhost:4200/exampleApp/assets/vendor.js:41309:64)
at buildRenderOptions (http://localhost:4200/exampleApp/assets/vendor.js:41371:27)
at Class.render (http://localhost:4200/exampleApp/assets/vendor.js:41191:27)
at Class.openModal (http://localhost:4200/exampleApp/assets/exampleApp.js:1118:14)
at Class.send (http://localhost:4200/exampleApp/assets/vendor.js:40471:39)
at Class.superWrapper [as send] (http://localhost:4200/exampleApp/assets/vendor.js:54491:22)
at Object.<anonymous> (http://localhost:4200/exampleApp/assets/tests.js:1115:11)
at runTest (http://localhost:4200/exampleApp/assets/test-support.js:3471:30)
at Test.run (http://localhost:4200/exampleApp/assets/test-support.js:3457:6
测试('route open model',函数(assert){
让route=this.subject();
route.send('openmodel','cancel model');
assert.ok(路由);
});
在Module.callback的测试#1中死亡(http://localhost:4200/exampleApp/assets/tests.js:1113:24)
at Module.exports(http://localhost:4200/exampleApp/assets/vendor.js:140:32)
按要求(http://localhost:4200/exampleApp/assets/vendor.js:32:18)
在TestLoader.require(http://localhost:4200/exampleApp/assets/test-support.js:7124:7)
在TestLoader.loadModules上(http://localhost:4200/exampleApp/assets/test-support.js:7116:14)
在Function.TestLoader.load(http://localhost:4200/exampleApp/assets/test-support.js:7146:22)
在http://localhost:4200/exampleApp/assets/test-support.js:7030:18:无法读取未定义@31 ms的属性“state”
资料来源:
TypeError:无法读取未定义的属性“状态”
在父母之路(http://localhost:4200/exampleApp/assets/vendor.js:41309:64)
在建筑渲染时(http://localhost:4200/exampleApp/assets/vendor.js:41371:27)
在课堂上(http://localhost:4200/exampleApp/assets/vendor.js:41191:27)
在Class.openModal(http://localhost:4200/exampleApp/assets/exampleApp.js:1118:14)
在课堂上,发送(http://localhost:4200/exampleApp/assets/vendor.js:40471:39)
在Class.superWrapper[作为发送](http://localhost:4200/exampleApp/assets/vendor.js:54491:22)
反对。(http://localhost:4200/exampleApp/assets/tests.js:1115:11)
运行测试时(http://localhost:4200/exampleApp/assets/test-support.js:3471:30)
在测试运行时(http://localhost:4200/exampleApp/assets/test-support.js:3457:6
两件事
test('route open modal', function(assert) {
let route = this.subject();
route.send('openModal', 'cancel-modal');
assert.ok(route);
});
Died on test #1 at Module.callback (http://localhost:4200/exampleApp/assets/tests.js:1113:24)
at Module.exports (http://localhost:4200/exampleApp/assets/vendor.js:140:32)
at requireModule (http://localhost:4200/exampleApp/assets/vendor.js:32:18)
at TestLoader.require (http://localhost:4200/exampleApp/assets/test-support.js:7124:7)
at TestLoader.loadModules (http://localhost:4200/exampleApp/assets/test-support.js:7116:14)
at Function.TestLoader.load (http://localhost:4200/exampleApp/assets/test-support.js:7146:22)
at http://localhost:4200/exampleApp/assets/test-support.js:7030:18: Cannot read property 'state' of undefined@ 31 ms
Source:
TypeError: Cannot read property 'state' of undefined
at parentRoute (http://localhost:4200/exampleApp/assets/vendor.js:41309:64)
at buildRenderOptions (http://localhost:4200/exampleApp/assets/vendor.js:41371:27)
at Class.render (http://localhost:4200/exampleApp/assets/vendor.js:41191:27)
at Class.openModal (http://localhost:4200/exampleApp/assets/exampleApp.js:1118:14)
at Class.send (http://localhost:4200/exampleApp/assets/vendor.js:40471:39)
at Class.superWrapper [as send] (http://localhost:4200/exampleApp/assets/vendor.js:54491:22)
at Object.<anonymous> (http://localhost:4200/exampleApp/assets/tests.js:1115:11)
at runTest (http://localhost:4200/exampleApp/assets/test-support.js:3471:30)
at Test.run (http://localhost:4200/exampleApp/assets/test-support.js:3457:6