6
मैं अपने react
घटकों पर परीक्षण चलाने के लिए कोशिश कर रहा हूँ, लेकिन मैं इस त्रुटि हो रही है जब मैं console.log(nav)
लेखन त्रुटि जब console.log चर
त्रुटि:
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 :)
कोड:
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();
});
});
यह सुनिश्चित नहीं है कि इसे कैसे डिबग किया जाए या यह क्यों हो रहा है। जब मैंने console.log(nav)
हटा दिया तो त्रुटि प्रकट नहीं होती है।
मैं एक बहुत ही इसी तरह की समस्या हुई है और इस इसे हल (अंतर है, मैं 'उपयोग कर रहा था TestUtils.scryRenderedDOMComponentsWithTag') – Sergio