Keep catalog copy on a selected method card, and only offer See all when the deck is longer than the compact seven.
This commit is contained in:
1 parent
46656f52d3
commit
59f76c5b7d
6 files changed
+55
-6
No files matched your search
@@ -192,6 +192,55 @@ describe("CardStack Component", () => {
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("selected compact card keeps catalog copy and hides the alternative", () => {
|
||||
render(
|
||||
<CardStack
|
||||
cards={[
|
||||
{
|
||||
id: "1",
|
||||
label: "Option A",
|
||||
supportText: "Catalog copy",
|
||||
compactSupportText: "Fits a worker co-op",
|
||||
recommended: true,
|
||||
alternative: { id: "2", label: "Option B" },
|
||||
},
|
||||
]}
|
||||
selectedIds={["1"]}
|
||||
layout="singleStack"
|
||||
alternativePrefix="Another way communities do this:"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Option A: Catalog copy" }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.queryByText(/Fits a worker co-op/)).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Option B" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("unselected compact card shows the why line", () => {
|
||||
render(
|
||||
<CardStack
|
||||
cards={[
|
||||
{
|
||||
id: "1",
|
||||
label: "Option A",
|
||||
supportText: "Catalog copy",
|
||||
compactSupportText: "Fits a worker co-op",
|
||||
recommended: true,
|
||||
},
|
||||
]}
|
||||
layout="singleStack"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Option A: Fits a worker co-op" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("compact alternative row opens the named card", () => {
|
||||
const onAlternativeSelect = vi.fn();
|
||||
render(
|
||||
|
||||
Reference in new issue
Block a user