Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,11 @@ describe("<ContactGroupComponent />", () => {
});
});

// Debugging issue on CI.
cy.window().then((value) => cy.task("log", `window: ${value}`));
cy.document().then((value) => cy.task("log", `document: ${value}`));
cy.get("#firstName_1");
/*
In case the component is scrolled down, make sure to scroll up so the "First name" input is
visible, since the "safe focusing" would skip focusing it in that case.
*/
cy.scrollTo("top");

cy.focused().should("have.id", "firstName_1");
cy.get(fieldSelector).shadow().find("input").clear(); // emits false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { describe, it, expect, afterAll, vi } from "vitest";
import { DOMWrapper, mount } from "@vue/test-utils";
import { describe, it, expect, afterEach } from "vitest";
import { DOMWrapper, mount, VueWrapper } from "@vue/test-utils";
import DateInputComponent from "@/components/forms/DateInputComponent/index.vue";
import { isMinimumYearsAgo } from "@/helpers/validators/GlobalValidators";

describe("Date Input Component", () => {
afterAll(() => {
vi.clearAllTimers();
let globalWrapper: VueWrapper;

afterEach(() => {
if (globalWrapper) {
globalWrapper.unmount();
}
});

const id = "my-date";
Expand All @@ -31,6 +35,7 @@ describe("Date Input Component", () => {
masked: () => {},
},
});
globalWrapper = wrapper;

expect(wrapper.find(`#${id}`).exists()).toBe(true);
});
Expand All @@ -47,7 +52,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
attachTo: document.body,
});
globalWrapper = wrapper;

const yearWrapper = wrapper.find<HTMLInputElement>(`#${id}Year`);
await setInputValue(yearWrapper, "2001");
Expand All @@ -69,7 +76,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
attachTo: document.body,
});
globalWrapper = wrapper;

await wrapper.find(`#${id}Year`).trigger("input");
await wrapper.find(`#${id}Year`).trigger("blur");
Expand All @@ -92,7 +101,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
attachTo: document.body,
});
globalWrapper = wrapper;

const currentYear = new Date().getFullYear();
const currentYearMinus5 = currentYear - 5;
Expand Down Expand Up @@ -121,7 +132,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
attachTo: document.body,
});
globalWrapper = wrapper;

const inputWrapper = wrapper.find<HTMLInputElement>(`#${id}Year`);
await setInputValue(inputWrapper, "1");
Expand Down Expand Up @@ -153,7 +166,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
attachTo: document.body,
});
globalWrapper = wrapper;

const inputWrapper = wrapper.find<HTMLInputElement>(`#${id}Year`);
await inputWrapper.trigger("input");
Expand Down