simulate click jest
import React from 'react';
import { shallow } from 'enzyme';
import Button from './Button';
describe('Test Button component', () => {
it('Test click event', () => {
const mockCallBack = jest.fn();
const button = shallow((<Button onClick={mockCallBack}>Ok!</Button>));
button.find('button').simulate('click');
expect(mockCallBack.mock.calls.length).toEqual(1);
});
});
Also in JavaScript:
- jquery on input
- n JavaScript, select your <h1> element and give it some text
- how to change input border color with js
- javascript dataurl to blob
- button in vanilla js
- js add animation to element
- mongoose bulk update
- closures in javascript
- ajax stand for
- js generator
- electron scrollbar
- generate random color jquery
- discord.js bot
- javascript press tab key
- javascript function destructuring
- how do you create a function js?
- anonymous function javascript
- import vue js
- react admin
- javascript stringify line breaks
- angular @Output()
- iterate over enum angular ngfor
- insert js in html
- javascript remove the current tr with click