Skip to content

Commit a7135c1

Browse files
committed
chore: add test for preview empty state
1 parent 0087073 commit a7135c1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/client/Preview.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
cleanup,
3+
findByTestId,
34
getByLabelText,
45
queryAllByLabelText,
56
render,
@@ -68,6 +69,13 @@ describe("Preview - Rendering", () => {
6869
cleanup();
6970
});
7071

72+
it("should render the empty state when no parameters are present", async () => {
73+
const page = render(<TestApp parameters={[]} />);
74+
75+
expect(findByTestId(page.container, "preview-empty-state"));
76+
77+
})
78+
7179
it("should render the default example as expected", async () => {
7280
const page = render(<TestApp parameters={defaultExampleParameters} />);
7381

@@ -86,7 +94,7 @@ describe("Preview - Rendering", () => {
8694
page.container,
8795
"How do you want to format the options of the next parameter?Immutable",
8896
);
89-
expect(formTypeSelects).length(4);
97+
expect(formTypeSelects).toHaveLength(4);
9098

9199
expect(formTypeSelects[0].innerText).toBe("Radio Selector");
92100

src/client/Preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export const Preview: FC<PreviewProps> = ({
235235

236236
const PreviewEmptyState = () => {
237237
return (
238-
<div className="flex flex-col items-center justify-center gap-3">
238+
<div className="flex flex-col items-center justify-center gap-3" data-testid="preview-empty-state">
239239
<div className="flex items-center justify-center rounded-[6px] bg-highlight-sky p-2">
240240
<ActivityIcon className="text-content-invert" width={24} height={24} />
241241
</div>

0 commit comments

Comments
 (0)