how to use jest function for on change in react code example
Example: handle changes testing react
describe("handleChange", () => {
it("should call setState on title", () => {
const mockEvent = {
target: {
name: "title",
value: "test"
}
};
const expected = {
title: "test",
description: "",
submitActive: false
};
wrapper.instance().handleChange(mockEvent);
expect(wrapper.state()).toEqual(expected);
});
});