Answers for "handle changes testing react"

0

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);
  });
});
Posted by: Guest on October-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language