Top "Enzyme" questions

Unit test library for React.

Simulate a button click in Jest

Simulating a button click seems like a very easy/standard operation. Yet, I can't get it to work in Jest.…

javascript reactjs testing jestjs enzyme
Enzyme - How to access and set <input> value?

I'm confused about how to access <input> value when using mount. Here's what I've got as my test: …

unit-testing reactjs enzyme
Jest spyOn function called

I'm trying to write a simple test for a simple React component, and I want to use Jest to confirm …

javascript reactjs testing jestjs enzyme
How to test style for a React component attribute with Enzyme

I am trying to test a style attribute for a React component. What is the best way to get style …

reactjs enzyme
Jest - how to test if a component does not exist?

How do I check if a component is not present, i.e. that a specific component has not been rendered?

jestjs enzyme
How can I use Jest to spy on a method call?

I recently wanted to test that some custom method gets conditionally called in the componentDidMount method of a React component. …

javascript reactjs testing jestjs enzyme
How to mock React component methods with jest and enzyme

I have a react component(this is simplified in order to demonstrate the issue): class MyComponent extends Component { handleNameInput = (value) =&…

javascript reactjs jestjs enzyme
how to change jest mock function return value in each test?

I have a mock module like this in my component test file jest.mock('../../../magic/index', () => ({ navigationEnabled: () => …

reactjs react-native jestjs enzyme
Enzyme simulate an onChange event

I'm testing a react component with Mocha and Enzyme. Here is the component (shortened for simplicity of course): class New …

javascript reactjs mocha enzyme
how to select element text with react+enzyme

Just what it says. Some example code: let wrapper = shallow(<div><button class='btn btn-primary'>OK&…

reactjs enzyme