I am writing some tests for my React component:
let DebugElement = TestUtils.renderIntoDocument(<Debug />);
console.log(DebugElement)
spyOn(DebugElement, 'fetchAndSelect');
However, it says that fetchAndSelect
doesn't exist. Which is true.
I wrap my component like so:
import { DragDropContext } from 'react-dnd';
const Debug = React.createClass({
fetchAndSelect() {}
});
export default DragDropContext(HTML5Backend)(Debug);
If you look at the screenshot below, you can see that I can access my component methods inside refs.child
. Is this the right way?
Aucun commentaire:
Enregistrer un commentaire