Lio*_*cer 6 javascript reactjs
我试图在我的react组件上运行测试,但是当我遇到这个错误时console.log(nav)
错误:
Chrome 44.0.2403 (Mac OS X 10.10.4) App has nav FAILED
Error: the error "TypeError: target.dispatchEvent is not a function" was thrown, throw an Error :)
Run Code Online (Sandbox Code Playgroud)
码:
import React from 'react/addons';
var TestUtils = React.addons.TestUtils;
import testHelper from '../../test/helpers/testHelper.js';
import App from '../../app/views/app.js';
var app = testHelper.getRouterComponent(App);
describe('App', function() {
it('has nav', function(done) {
var nav = TestUtils.findRenderedDOMComponentWithTag(app, 'nav');
console.log(nav);
expect(nav).to.exist;
done();
});
});
Run Code Online (Sandbox Code Playgroud)
不太确定如何调试这个或为什么会发生这种情况.当我删除时,console.log(nav)错误没有出现.
小智 8
而不是console.log尝试:
console.log(require('util').inspect(nav, { depth: null }));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1431 次 |
| 最近记录: |