mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-04 10:30:00 -06:00
Updated test to reflect code changes
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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} />);
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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: " " });
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user