diff --git a/src/__tests__/__snapshots__/index.js.snap b/src/__tests__/__snapshots__/index.js.snap index 7a48820..76327b8 100644 --- a/src/__tests__/__snapshots__/index.js.snap +++ b/src/__tests__/__snapshots__/index.js.snap @@ -4,10 +4,10 @@ exports[`snapshot - default 1`] = `
foo @@ -18,17 +18,12 @@ exports[`snapshot - onEdit 1`] = `
- + + bar +
`; diff --git a/src/__tests__/index.js b/src/__tests__/index.js index a31cd23..f4fa564 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -30,7 +30,7 @@ test("enter editing mode when clicking CTE", () => { const wrapper = shallow( ); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); expect(wrapper.find("input")).toHaveLength(1); }); @@ -38,7 +38,7 @@ test("enter editing mode and change value", () => { const wrapper = shallow( ); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); wrapper.find("input").simulate("change", { target: { value: "WORLD" } }); expect(wrapper.find("input").prop("value")).toBe("WORLD"); }); @@ -46,7 +46,7 @@ test("enter editing mode and change value", () => { test("invoke endEditing function and leave editing mode after pressing the enter key", () => { const mock = jest.fn(); const wrapper = mount(); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); const inputWrapper = wrapper.find("input"); inputWrapper.simulate("keypress", { keyCode: 13 @@ -58,7 +58,7 @@ test("invoke endEditing function and leave editing mode after pressing the enter test("invoke endEditing function and leave editing mode after blurring the input", () => { const mock = jest.fn(); const wrapper = mount(); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); const inputWrapper = wrapper.find("input"); inputWrapper.simulate("blur"); expect(mock).toHaveBeenCalledTimes(1); @@ -68,7 +68,7 @@ test("invoke endEditing function and leave editing mode after blurring the input test("stay on editing mode if press all keys except Enter key", () => { const mock = jest.fn(); const wrapper = mount(); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); const inputWrapper = wrapper.find("input"); inputWrapper.simulate("keypress", { keyCode: 1 @@ -90,6 +90,6 @@ test("pass class props to customize component style", () => { expect(wrapper.hasClass("wrapperClass")).toBeTruthy(); expect(wrapper.find("span.textClass")).toHaveLength(1); - wrapper.simulate("click"); + wrapper.find("span").simulate("click"); expect(wrapper.find("input.inputClass")).toHaveLength(1); });