Updated test to reflect code changes

This commit is contained in:
Jakob Schott
2025-05-19 23:20:18 +02:00
parent a8a8cf6c88
commit 8b56786be5
5 changed files with 9 additions and 22 deletions

View File

@@ -41,7 +41,7 @@ describe("Survey Builder", () => {
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
shuffleOption: "none",
required: true,
required: false,
});
expect(question.choices.length).toBe(3);
expect(question.id).toBeDefined();
@@ -141,7 +141,7 @@ describe("Survey Builder", () => {
inputType: "text",
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
required: true,
required: false,
charLimit: {
enabled: false,
},
@@ -204,7 +204,7 @@ describe("Survey Builder", () => {
range: 5,
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
required: true,
required: false,
isColorCodingEnabled: false,
});
expect(question.id).toBeDefined();
@@ -265,7 +265,7 @@ describe("Survey Builder", () => {
headline: { default: "NPS Question" },
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
required: true,
required: false,
isColorCodingEnabled: false,
});
expect(question.id).toBeDefined();
@@ -324,7 +324,7 @@ describe("Survey Builder", () => {
label: { default: "I agree to terms" },
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
required: true,
required: false,
});
expect(question.id).toBeDefined();
});
@@ -377,7 +377,7 @@ describe("Survey Builder", () => {
headline: { default: "CTA Question" },
buttonLabel: { default: "common.next" },
backButtonLabel: { default: "common.back" },
required: true,
required: false,
buttonExternal: false,
});
expect(question.id).toBeDefined();

View File

@@ -167,19 +167,6 @@ describe("NPSQuestion", () => {
expect(getUpdatedTtc).toHaveBeenCalled();
});
test("updates hover state when mouse moves over options", () => {
render(<NPSQuestion {...mockProps} />);
const option = screen.getByText("5").closest("label");
expect(option).toBeInTheDocument();
fireEvent.mouseOver(option!);
expect(option).toHaveClass("fb-bg-accent-bg");
fireEvent.mouseLeave(option!);
expect(option).not.toHaveClass("fb-bg-accent-bg");
});
test("supports keyboard navigation", () => {
render(<NPSQuestion {...mockProps} />);

View File

@@ -122,7 +122,7 @@ describe("OpenTextQuestion", () => {
test("renders textarea for long answers", () => {
render(<OpenTextQuestion {...defaultProps} question={{ ...defaultQuestion, longAnswer: true }} />);
expect(screen.getByRole("textbox")).toHaveAttribute("rows", "3");
expect(screen.getByRole("textbox")).toHaveAttribute("rows", "5");
});
test("displays character limit when configured", () => {

View File

@@ -171,7 +171,7 @@ describe("PictureSelectionQuestion", () => {
render(<PictureSelectionQuestion {...mockProps} />);
const images = screen.getAllByRole("img");
const label = images[0].closest("label");
const label = images[0].closest("button");
fireEvent.keyDown(label!, { key: " " });

View File

@@ -183,7 +183,7 @@ describe("StackedCard", () => {
test("card height is initial when offset is < 0 and not fullSizeCards", () => {
render(<StackedCard {...defaultProps} offset={-1} fullSizeCards={false} />);
const card = screen.getByTestId("questionCard-0");
expect(card).toHaveStyle("height: initial");
expect(card).toHaveStyle(`height: ${defaultProps.cardHeight}`);
});
test("card height is cardHeight when offset > 0 and not fullSizeCards", () => {