1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Finish LogSearch tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-01-26 10:30:29 -05:00
parent b4612200f0
commit d56dbc2342

View File

@ -100,4 +100,47 @@ describe("LogSearch tests", () => {
userEvent.click(await screen.findByText("keyboard_arrow_up")); userEvent.click(await screen.findByText("keyboard_arrow_up"));
expect(scrollToOverlay).toBeCalled(); expect(scrollToOverlay).toBeCalled();
}); });
it("should scroll to new active overlay when clicking the next button", async () => {
const scrollToOverlay = jest.fn();
const model = getOnePodViewModel("foobar", {
getLogsWithoutTimestamps: () => [
"hello",
"world",
],
});
render(
<LogSearch
model={model}
scrollToOverlay={scrollToOverlay}
/>,
);
userEvent.click(await screen.findByPlaceholderText("Search..."));
userEvent.keyboard("o");
userEvent.click(await screen.findByText("keyboard_arrow_down"));
expect(scrollToOverlay).toBeCalled();
});
it("next and previous should be disabled initially", async () => {
const scrollToOverlay = jest.fn();
const model = getOnePodViewModel("foobar", {
getLogsWithoutTimestamps: () => [
"hello",
"world",
],
});
render(
<LogSearch
model={model}
scrollToOverlay={scrollToOverlay}
/>,
);
userEvent.click(await screen.findByText("keyboard_arrow_down"));
userEvent.click(await screen.findByText("keyboard_arrow_up"));
expect(scrollToOverlay).not.toBeCalled();
});
}); });