diff --git a/__test__/array-merge.test.ts b/__test__/array-merge.test.ts index e8e0321..b92f5f7 100644 --- a/__test__/array-merge.test.ts +++ b/__test__/array-merge.test.ts @@ -1,10 +1,7 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should execute array merge on class, style, directive properties", () => { - function inserted(el: any) { - el.focus(); - } let vd1: VNodeData = { class: ["a", { b: true, c: false }], style: ["display:block;", { color: "red", fontSize: "16px" }], @@ -12,7 +9,6 @@ it("should execute array merge on class, style, directive properties", () => { let vd2: VNodeData = { class: ["d", { e: true, f: false }], style: "position:absolute;", - directives: [{ focus: { inserted } }], }; let actual = mergeData(vd1, vd2); @@ -23,7 +19,6 @@ it("should execute array merge on class, style, directive properties", () => { "display:block;", { color: "red", fontSize: "16px" }, ], - directives: [{ focus: { inserted } }], }; // Check values recursively diff --git a/__test__/handler-merge.test.ts b/__test__/handler-merge.test.ts index 9133f41..7ac0f29 100644 --- a/__test__/handler-merge.test.ts +++ b/__test__/handler-merge.test.ts @@ -1,4 +1,4 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should not mutate original object (issue #2)", () => { @@ -53,7 +53,7 @@ it("should set single handlers and concat multi", () => { it("should call the right-most argument first", () => { let first = 0; - let factory = n => () => { + let factory = (n: number) => () => { if (!first) { first = n; } @@ -67,6 +67,10 @@ it("should call the right-most argument first", () => { ); expect(Array.isArray(actual.on.click)).toBe(true); + if (!Array.isArray(actual.on.click)) { + throw new TypeError(); + } + for (const fn of actual.on.click) { fn(); } diff --git a/__test__/kitchen-sink.test.ts b/__test__/kitchen-sink.test.ts index 0d10f2f..05cf94d 100644 --- a/__test__/kitchen-sink.test.ts +++ b/__test__/kitchen-sink.test.ts @@ -1,4 +1,4 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should handle multiple arguments", () => { @@ -28,8 +28,8 @@ it("should handle multiple arguments", () => { }); it("should work like in the example", () => { - let onClick1 = e => alert("💥"); - let onClick2 = e => alert("👍"); + let onClick1 = () => alert("💥"); + let onClick2 = () => alert("👍"); let componentData: VNodeData = { staticClass: "fn-component", // concatenates all static classes diff --git a/__test__/nullable-objects.test.ts b/__test__/nullable-objects.test.ts index e565dcb..23fe909 100644 --- a/__test__/nullable-objects.test.ts +++ b/__test__/nullable-objects.test.ts @@ -1,4 +1,4 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should handle nested nullable objects as initial state", () => { diff --git a/__test__/reassign.test.ts b/__test__/reassign.test.ts index f2d37e6..8492e48 100644 --- a/__test__/reassign.test.ts +++ b/__test__/reassign.test.ts @@ -1,4 +1,4 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should reassign primitives", () => { diff --git a/__test__/string-concat.test.ts b/__test__/string-concat.test.ts index 57f959e..5ca347a 100644 --- a/__test__/string-concat.test.ts +++ b/__test__/string-concat.test.ts @@ -1,4 +1,4 @@ -import { VNodeData, VNodeDirective } from "vue"; +import { VNodeData } from "vue"; import { mergeData } from "../src/index"; it("should concatenate strings", () => {