|
|
@ -433,4 +433,52 @@ describe("QuestionSheet component", () => { |
|
|
expect(screen.queryByText("Antigua and Barbuda")).toBeNull(); |
|
|
expect(screen.queryByText("Antigua and Barbuda")).toBeNull(); |
|
|
expect(screen.queryByText("افغانستان")).toBeNull(); |
|
|
expect(screen.queryByText("افغانستان")).toBeNull(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("renders long question title with line-clamp-2 and flex-1 classes in sheet header", () => { |
|
|
|
|
|
const queryClient = new QueryClient({ |
|
|
|
|
|
defaultOptions: { queries: { retry: false } }, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const longTitle = |
|
|
|
|
|
"میزان پایبندی شما به مناسک و تکالیف شرعی و اعتقادات مذهبی در زندگی روزمره خانوادگی و اجتماعی"; |
|
|
|
|
|
|
|
|
|
|
|
const qLong = { |
|
|
|
|
|
id: "religious_commitment_details", |
|
|
|
|
|
title: longTitle, |
|
|
|
|
|
type: "dropdown", |
|
|
|
|
|
order: 1, |
|
|
|
|
|
required: true, |
|
|
|
|
|
isVisible: true, |
|
|
|
|
|
description: "", |
|
|
|
|
|
tooltip: "", |
|
|
|
|
|
extras: { placeHolder: "انتخاب کنید" }, |
|
|
|
|
|
options: [ |
|
|
|
|
|
{ id: "high", value: "high", label: "بسیار زیاد", order: 1 }, |
|
|
|
|
|
{ id: "medium", value: "medium", label: "متوسط", order: 2 }, |
|
|
|
|
|
], |
|
|
|
|
|
ui_config: {}, |
|
|
|
|
|
} as QuestionField; |
|
|
|
|
|
|
|
|
|
|
|
render( |
|
|
|
|
|
<QueryClientProvider client={queryClient}> |
|
|
|
|
|
<QuestionAnswersProvider slug="test" questions={[qLong]}> |
|
|
|
|
|
<QuestionSheet question={qLong} /> |
|
|
|
|
|
</QuestionAnswersProvider> |
|
|
|
|
|
</QueryClientProvider>, |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const trigger = screen.getByRole("button", { name: "انتخاب کنید" }); |
|
|
|
|
|
fireEvent.click(trigger); |
|
|
|
|
|
|
|
|
|
|
|
const dialog = screen.getByRole("dialog"); |
|
|
|
|
|
expect(dialog).toBeDefined(); |
|
|
|
|
|
|
|
|
|
|
|
const heading = dialog.querySelector("h3"); |
|
|
|
|
|
expect(heading).toBeDefined(); |
|
|
|
|
|
expect(heading?.textContent?.trim()).toBe(longTitle); |
|
|
|
|
|
expect(heading).toHaveClass("line-clamp-2"); |
|
|
|
|
|
expect(heading).toHaveClass("flex-1"); |
|
|
|
|
|
expect(heading).not.toHaveClass("truncate"); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|