Skip to content

Enzyme shallow rendering support #5884

Answered by adidahiya
alexiusp asked this question in Q&A
Discussion options

You must be logged in to vote

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 <button> element; for the latter you will need to access .hostNodes().

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by adidahiya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #3670 on January 24, 2023 15:14.