From 69aff7b55187baab42cfb95acabd7dc293f8f98a Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Sun, 5 Oct 2025 07:45:09 +0200 Subject: [PATCH 1/3] fix interesction error tests to work with new omega errors setup --- .../OmegaForm/IntersectionError.test.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts b/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts index fd44470928..c8b026e966 100644 --- a/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts +++ b/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts @@ -33,11 +33,11 @@ const mockComponents = { `, props: ["form", "name", "field", "label", "type", "options"], inheritAttrs: false - }, - OmegaErrors: { - template: `
{{ JSON.stringify(errors) }}
`, - props: ["errors", "generalErrors", "showErrors"] } + // OmegaErrors: { + // template: `
{{ JSON.stringify(errors) }}
`, + // props: ["errors", "generalErrors", "showErrors"] + // } } describe("OmegaForm Intersection/Union", () => { @@ -116,8 +116,8 @@ describe("OmegaForm Intersection/Union", () => { }, { global: { stubs: { - CustomInput: mockComponents.CustomInput, - OmegaErrorsInternal: mockComponents.OmegaErrors + CustomInput: mockComponents.CustomInput + // OmegaErrorsInternal: mockComponents.OmegaErrors } } }) @@ -157,7 +157,7 @@ describe("OmegaForm Intersection/Union", () => { await wrapper.vm.$nextTick() // Verify error exists for alpha field - const errorDiv = wrapper.find(".mock-omega-errors") + const errorDiv = wrapper.find(".error-alert") expect(errorDiv.exists()).toBe(true) expect(errorDiv.text()).toContain("alpha") @@ -165,8 +165,8 @@ describe("OmegaForm Intersection/Union", () => { await selectInput.setValue("beta") await wrapper.vm.$nextTick() - const errorDivAfter = wrapper.find(".mock-omega-errors") - expect(errorDivAfter.text()).not.toContain("alpha") + const errorDivAfter = wrapper.find(".error-alert") + expect(errorDivAfter.exists()).toBe(false) }) it("clears form values when switching union types and handles submission", async () => { From 5c6a39a97f448bd18542d8afefb9e79001a2f60d Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Sun, 5 Oct 2025 07:47:42 +0200 Subject: [PATCH 2/3] instead, refactor OmegaErrors again to work with error mocks --- .../OmegaForm/IntersectionError.test.ts | 18 +++++------ .../OmegaForm/OmegaErrorsInternal.vue | 30 ++++--------------- .../src/components/OmegaForm/useOmegaForm.ts | 27 ++++++++++++++--- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts b/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts index c8b026e966..fd44470928 100644 --- a/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts +++ b/packages/vue-components/__tests__/OmegaForm/IntersectionError.test.ts @@ -33,11 +33,11 @@ const mockComponents = { `, props: ["form", "name", "field", "label", "type", "options"], inheritAttrs: false + }, + OmegaErrors: { + template: `
{{ JSON.stringify(errors) }}
`, + props: ["errors", "generalErrors", "showErrors"] } - // OmegaErrors: { - // template: `
{{ JSON.stringify(errors) }}
`, - // props: ["errors", "generalErrors", "showErrors"] - // } } describe("OmegaForm Intersection/Union", () => { @@ -116,8 +116,8 @@ describe("OmegaForm Intersection/Union", () => { }, { global: { stubs: { - CustomInput: mockComponents.CustomInput - // OmegaErrorsInternal: mockComponents.OmegaErrors + CustomInput: mockComponents.CustomInput, + OmegaErrorsInternal: mockComponents.OmegaErrors } } }) @@ -157,7 +157,7 @@ describe("OmegaForm Intersection/Union", () => { await wrapper.vm.$nextTick() // Verify error exists for alpha field - const errorDiv = wrapper.find(".error-alert") + const errorDiv = wrapper.find(".mock-omega-errors") expect(errorDiv.exists()).toBe(true) expect(errorDiv.text()).toContain("alpha") @@ -165,8 +165,8 @@ describe("OmegaForm Intersection/Union", () => { await selectInput.setValue("beta") await wrapper.vm.$nextTick() - const errorDivAfter = wrapper.find(".error-alert") - expect(errorDivAfter.exists()).toBe(false) + const errorDivAfter = wrapper.find(".mock-omega-errors") + expect(errorDivAfter.text()).not.toContain("alpha") }) it("clears form values when switching union types and handles submission", async () => { diff --git a/packages/vue-components/src/components/OmegaForm/OmegaErrorsInternal.vue b/packages/vue-components/src/components/OmegaForm/OmegaErrorsInternal.vue index 4ee8cab994..2ed81f2233 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaErrorsInternal.vue +++ b/packages/vue-components/src/components/OmegaForm/OmegaErrorsInternal.vue @@ -74,45 +74,27 @@