diff --git a/src/components/Editor.vue b/src/components/Editor.vue index 61bd3c9..bea0b1c 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -34,6 +34,7 @@ autocomplete="off" autocorrect="off" data-gramm="false" + v-on="$listeners" > diff --git a/tests/unit/Editor.spec.js b/tests/unit/Editor.spec.js index d0a7bca..d477a1c 100644 --- a/tests/unit/Editor.spec.js +++ b/tests/unit/Editor.spec.js @@ -91,6 +91,31 @@ describe("Editor.vue", () => { expect(mockHandler).toHaveBeenCalled(); }); + it("emits all pre events", () => { + const mockHandler = jest.fn(); + const compiled = compileToFunctions( + '
' + ); + const wrapper = mount(compiled, { + data: () => ({ + code: "test" + }), + stubs: { + Editor + }, + methods: { + eventHandler: mockHandler + } + }); + const $pre = wrapper.find("pre"); + + $pre.element.dispatchEvent(new Event("focus")); + $pre.element.dispatchEvent(new Event("blur")); + $pre.element.dispatchEvent(new Event("input")); + + expect(mockHandler).toHaveBeenCalledTimes(3); + }); + it("renders with null value", () => { const code = null; const wrapper = mount(Editor, {