From a82aac97b71ebc7ab00142d7d3f425e58ceae29c Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Fri, 17 Feb 2023 14:54:08 -0800 Subject: [PATCH] Convert c-display tests to tsx --- .../{c-display.spec.ts => c-display.spec.tsx} | 60 +++++++------------ 1 file changed, 21 insertions(+), 39 deletions(-) rename src/coalesce-vue-vuetify3/src/components/display/{c-display.spec.ts => c-display.spec.tsx} (68%) diff --git a/src/coalesce-vue-vuetify3/src/components/display/c-display.spec.ts b/src/coalesce-vue-vuetify3/src/components/display/c-display.spec.tsx similarity index 68% rename from src/coalesce-vue-vuetify3/src/components/display/c-display.spec.ts rename to src/coalesce-vue-vuetify3/src/components/display/c-display.spec.tsx index 0f76ac518..8589dad6b 100644 --- a/src/coalesce-vue-vuetify3/src/components/display/c-display.spec.ts +++ b/src/coalesce-vue-vuetify3/src/components/display/c-display.spec.tsx @@ -14,60 +14,52 @@ describe("CDisplay", () => { }); test(":model", () => { - const wrapper = mount(CDisplay, { - props: { model }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain("bob"); }); test(":model for=propString", () => { - const wrapper = mount(CDisplay, { - props: { model, for: "grade" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain("Freshman"); }); test(":model for=metaObject", () => { - const wrapper = mount(CDisplay, { - props: { model, for: model.$metadata.props.grade }, - }); + const wrapper = mount(() => ( + + )); expect(wrapper.text()).toContain("Freshman"); }); test(":model for=qualifiedString", () => { - const wrapper = mount(CDisplay, { - props: { model, for: "Student.grade" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain("Freshman"); }); test(":value date", () => { - const wrapper = mount(CDisplay, { - props: { value: new Date(1990, 0, 2, 3, 4, 5) }, - }); + const wrapper = mount(() => ( + + )); expect(wrapper.text()).toContain("1/2/1990 3:04:05 AM"); }); test(":modelValue date", () => { - const wrapper = mount(CDisplay, { - props: { - modelValue: new Date(1990, 0, 2, 3, 4, 5), - format: "yyyy-MM-dd hh:mm:ss a", - }, - }); + const wrapper = mount(() => ( + + )); expect(wrapper.text()).toContain("1990-01-02 03:04:05 AM"); }); test("password", async () => { - const wrapper = mount(CDisplay, { - props: { model, for: "password" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain("••••••••"); expect(wrapper.text()).not.toContain("secretValue"); @@ -79,9 +71,7 @@ describe("CDisplay", () => { }); test("email", async () => { - const wrapper = mount(CDisplay, { - props: { model, for: "email" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain(model.email); expect(wrapper.find("a[href]").attributes()["href"]).toEqual( @@ -90,9 +80,7 @@ describe("CDisplay", () => { }); test("phone", async () => { - const wrapper = mount(CDisplay, { - props: { model, for: "phone" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain(model.phone); expect(wrapper.find("a[href]").attributes()["href"]).toEqual( @@ -105,17 +93,13 @@ describe("CDisplay", () => { [false, "✗"], ])("boolean %s", async (value, display) => { model.isEnrolled = value; - const wrapper = mount(CDisplay, { - props: { model, for: "isEnrolled" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain(display); }); test("color", async () => { - const wrapper = mount(CDisplay, { - props: { model, for: "color" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain(model.color); expect( @@ -128,9 +112,7 @@ describe("CDisplay", () => { }); test("multiline", async () => { - const wrapper = mount(CDisplay, { - props: { model, for: "notes" }, - }); + const wrapper = mount(() => ); expect(wrapper.text()).toContain(model.notes); expect(wrapper.attributes()["style"]).toEqual("white-space: pre-wrap;");