-
Environment
QuestionWhen I'm trying to unit-test my components with shallow rendering function of Enzyme I can not test for Blueprint component name, because they all look like 'Blueprint3.{name}' and enzyme find() function consider this selector as element with name 'Blueprint3' and a class 'Spinner'. So I need to set additional properties/class names even for simple Spinner only to be able to test if it's present in my layout or not. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can import the component and query for it with Enzyme. import { Button } from "@blueprintjs/core";
const wrapper = shallow(
<Button text="hello" />
);
const button = wrapper.find(Button); Note that this returns the React component node and not the |
Beta Was this translation helpful? Give feedback.
You can import the component and query for it with Enzyme.
Note that this returns the React component node and not the
<button>
element; for the latter you will need to access.hostNodes()
.