Skip to content

Commit e3d2122

Browse files
hemahgMikeEdgar
authored andcommitted
fix message table stories
Signed-off-by: hemahg <hhg@redhat.com>
1 parent 97a875a commit e3d2122

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ui/components/MessagesTable/MessagesTable.stories.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
onSearch: fn(),
1515
onSelectMessage: fn(),
1616
onDeselectMessage: fn(),
17+
filterLimit: 50,
1718
},
1819
render: (props) => <MessagesTable {...props} messages={sampleData(props)} />,
1920
} as Meta<typeof MessagesTable>;
@@ -25,13 +26,17 @@ export const Example: Story = {
2526
const canvas = within(canvasElement);
2627
const messages = sampleData(args);
2728

29+
expect(messages.length).toBeGreaterThan(0);
2830
const rows = await canvas.findAllByRole("row");
2931

3032
const targetRow = rows.find((r) =>
3133
r.textContent?.includes("this-is-a-very-long-key"),
3234
);
33-
expect(targetRow).toBeDefined();
34-
await userEvent.click(targetRow!);
35+
36+
if (!targetRow) {
37+
throw new Error(`Target row not found. Available rows: ${rows.length}`);
38+
}
39+
await userEvent.click(targetRow);
3540
await expect(args.onSelectMessage).toHaveBeenCalledWith(messages[1]);
3641

3742
const search = await canvas.findByDisplayValue(/messages=latest/i);
@@ -55,13 +60,16 @@ export const Example: Story = {
5560
export const SearchWithMatches: Story = {
5661
args: {
5762
filterQuery: "foo",
63+
filterWhere: "value",
5864
},
5965
play: async ({ canvasElement }) => {
6066
const canvas = within(canvasElement);
61-
const marks = canvasElement.querySelectorAll("mark");
62-
expect(marks.length).toBeGreaterThan(0);
67+
68+
const highlighted = await canvas.findAllByText(/foo/i);
69+
expect(highlighted.length).toBeGreaterThan(0);
6370
},
6471
};
72+
6573
export const SearchWithoutMatches: Story = {
6674
args: {
6775
filterQuery: "lorem dolor",

0 commit comments

Comments
 (0)