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);
});
});
Are there any code examples left?
New code examples in category Javascript