Redesign room search interface (#12677)
* Extract SearchInfo interface and SearchScope enum Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix in-progress and update behaviour of RoomSearchView Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove search button from legacy header Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move search from aux panel to room summary card Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Wire up Cmd/Ctrl F for moved search field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use cpd space tokens Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove stale props Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix ctrl/cmd f search shortcut Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update Compound Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Revert the back button for now Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Cancel search on escape Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix missing X Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Extract SearchScope and SearchInfo into Searching Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch to icon button for cancel search Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * yarn.lock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * lint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update locators Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Revert screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update snapshots * Discard changes to package.json * i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Snapshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Handle narrow viewports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Revert copy Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
596ad38260
commit
2a26afe438
33 changed files with 675 additions and 499 deletions
51
test/components/views/elements/SearchWarning-test.tsx
Normal file
51
test/components/views/elements/SearchWarning-test.tsx
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2024 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
|
||||
import SdkConfig from "../../../../src/SdkConfig";
|
||||
import SearchWarning, { WarningKind } from "../../../../src/components/views/elements/SearchWarning";
|
||||
|
||||
describe("<SearchWarning />", () => {
|
||||
describe("with desktop builds available", () => {
|
||||
beforeEach(() => {
|
||||
SdkConfig.put({
|
||||
brand: "Element",
|
||||
desktop_builds: {
|
||||
available: true,
|
||||
logo: "https://logo",
|
||||
url: "https://url",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("renders with a logo by default", () => {
|
||||
const { asFragment, queryByRole } = render(
|
||||
<SearchWarning isRoomEncrypted={true} kind={WarningKind.Search} />,
|
||||
);
|
||||
expect(queryByRole("img")).toBeInTheDocument();
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders without a logo when showLogo=false", () => {
|
||||
const { asFragment, queryByRole } = render(
|
||||
<SearchWarning isRoomEncrypted={true} kind={WarningKind.Search} showLogo={false} />,
|
||||
);
|
||||
|
||||
expect(queryByRole("img")).not.toBeInTheDocument();
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,50 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<SearchWarning /> with desktop builds available renders with a logo by default 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SearchWarning"
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
src="https://logo"
|
||||
width="32px"
|
||||
/>
|
||||
<span>
|
||||
<span>
|
||||
Use the
|
||||
<a
|
||||
href="https://url"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Desktop app
|
||||
</a>
|
||||
to search encrypted messages
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<SearchWarning /> with desktop builds available renders without a logo when showLogo=false 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SearchWarning"
|
||||
>
|
||||
<span>
|
||||
<span>
|
||||
Use the
|
||||
<a
|
||||
href="https://url"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Desktop app
|
||||
</a>
|
||||
to search encrypted messages
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
|
@ -15,10 +15,11 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React from "react";
|
||||
import { render, fireEvent, screen } from "@testing-library/react";
|
||||
import { render, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { EventType, MatrixEvent, Room, MatrixClient, JoinRule } from "matrix-js-sdk/src/matrix";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
import { mocked, MockedObject } from "jest-mock";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import RoomSummaryCard from "../../../../src/components/views/right_panel/RoomSummaryCard";
|
||||
|
@ -37,6 +38,8 @@ import { _t } from "../../../../src/languageHandler";
|
|||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import { tagRoom } from "../../../../src/utils/room/tagRoom";
|
||||
import { DefaultTagID } from "../../../../src/stores/room-list/models";
|
||||
import { Action } from "../../../../src/dispatcher/actions";
|
||||
import RoomContext, { TimelineRenderingType } from "../../../../src/contexts/RoomContext";
|
||||
|
||||
jest.mock("../../../../src/utils/room/tagRoom");
|
||||
|
||||
|
@ -141,15 +144,82 @@ describe("<RoomSummaryCard />", () => {
|
|||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("opens the search", async () => {
|
||||
const onSearchClick = jest.fn();
|
||||
const { getByLabelText } = getComponent({
|
||||
onSearchClick,
|
||||
describe("search", () => {
|
||||
it("has the search field", async () => {
|
||||
const onSearchChange = jest.fn();
|
||||
const { getByPlaceholderText } = getComponent({
|
||||
onSearchChange,
|
||||
});
|
||||
expect(getByPlaceholderText("Search messages…")).toBeVisible();
|
||||
});
|
||||
|
||||
const searchBtn = getByLabelText(_t("action|search"));
|
||||
fireEvent.click(searchBtn);
|
||||
expect(onSearchClick).toHaveBeenCalled();
|
||||
it("should focus the search field if Action.FocusMessageSearch is fired", async () => {
|
||||
const onSearchChange = jest.fn();
|
||||
const { getByPlaceholderText } = getComponent({
|
||||
onSearchChange,
|
||||
});
|
||||
expect(getByPlaceholderText("Search messages…")).not.toHaveFocus();
|
||||
defaultDispatcher.fire(Action.FocusMessageSearch);
|
||||
await waitFor(() => {
|
||||
expect(getByPlaceholderText("Search messages…")).toHaveFocus();
|
||||
});
|
||||
});
|
||||
|
||||
it("should focus the search field if focusRoomSearch=true", () => {
|
||||
const onSearchChange = jest.fn();
|
||||
const { getByPlaceholderText } = getComponent({
|
||||
onSearchChange,
|
||||
focusRoomSearch: true,
|
||||
});
|
||||
expect(getByPlaceholderText("Search messages…")).toHaveFocus();
|
||||
});
|
||||
|
||||
it("should cancel search on escape", () => {
|
||||
const onSearchChange = jest.fn();
|
||||
const onSearchCancel = jest.fn();
|
||||
const { getByPlaceholderText } = getComponent({
|
||||
onSearchChange,
|
||||
onSearchCancel,
|
||||
focusRoomSearch: true,
|
||||
});
|
||||
expect(getByPlaceholderText("Search messages…")).toHaveFocus();
|
||||
fireEvent.keyDown(getByPlaceholderText("Search messages…"), { key: "Escape" });
|
||||
expect(onSearchCancel).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should empty search field when the timeline rendering type changes away", async () => {
|
||||
const onSearchChange = jest.fn();
|
||||
const { rerender } = render(
|
||||
<MatrixClientContext.Provider value={mockClient}>
|
||||
<RoomContext.Provider value={{ timelineRenderingType: TimelineRenderingType.Search } as any}>
|
||||
<RoomSummaryCard
|
||||
room={room}
|
||||
permalinkCreator={new RoomPermalinkCreator(room)}
|
||||
onClose={jest.fn()}
|
||||
onSearchChange={onSearchChange}
|
||||
focusRoomSearch={true}
|
||||
/>
|
||||
</RoomContext.Provider>
|
||||
</MatrixClientContext.Provider>,
|
||||
);
|
||||
|
||||
await userEvent.type(screen.getByPlaceholderText("Search messages…"), "test");
|
||||
expect(screen.getByPlaceholderText("Search messages…")).toHaveValue("test");
|
||||
|
||||
rerender(
|
||||
<MatrixClientContext.Provider value={mockClient}>
|
||||
<RoomContext.Provider value={{ timelineRenderingType: TimelineRenderingType.Room } as any}>
|
||||
<RoomSummaryCard
|
||||
room={room}
|
||||
permalinkCreator={new RoomPermalinkCreator(room)}
|
||||
onClose={jest.fn()}
|
||||
onSearchChange={onSearchChange}
|
||||
/>
|
||||
</RoomContext.Provider>
|
||||
</MatrixClientContext.Provider>,
|
||||
);
|
||||
expect(screen.getByPlaceholderText("Search messages…")).toHaveValue("");
|
||||
});
|
||||
});
|
||||
|
||||
it("opens room file panel on button click", () => {
|
||||
|
|
|
@ -13,16 +13,6 @@ exports[`<RoomSummaryCard /> has button to edit topic when expanded 1`] = `
|
|||
class="mx_Flex mx_RoomSummaryCard_header"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x);"
|
||||
>
|
||||
<button
|
||||
aria-label="Search"
|
||||
class="mx_RoomSummaryCard_searchBtn"
|
||||
data-testid="summary-search"
|
||||
>
|
||||
<div
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</button>
|
||||
<div
|
||||
aria-label="Close"
|
||||
class="mx_AccessibleButton mx_BaseCard_close"
|
||||
|
@ -443,16 +433,6 @@ exports[`<RoomSummaryCard /> renders the room summary 1`] = `
|
|||
class="mx_Flex mx_RoomSummaryCard_header"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x);"
|
||||
>
|
||||
<button
|
||||
aria-label="Search"
|
||||
class="mx_RoomSummaryCard_searchBtn"
|
||||
data-testid="summary-search"
|
||||
>
|
||||
<div
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</button>
|
||||
<div
|
||||
aria-label="Close"
|
||||
class="mx_AccessibleButton mx_BaseCard_close"
|
||||
|
@ -846,16 +826,6 @@ exports[`<RoomSummaryCard /> renders the room topic in the summary 1`] = `
|
|||
class="mx_Flex mx_RoomSummaryCard_header"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x);"
|
||||
>
|
||||
<button
|
||||
aria-label="Search"
|
||||
class="mx_RoomSummaryCard_searchBtn"
|
||||
data-testid="summary-search"
|
||||
>
|
||||
<div
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</button>
|
||||
<div
|
||||
aria-label="Close"
|
||||
class="mx_AccessibleButton mx_BaseCard_close"
|
||||
|
|
95
test/components/views/rooms/RoomSearchAuxPanel-test.tsx
Normal file
95
test/components/views/rooms/RoomSearchAuxPanel-test.tsx
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
Copyright 2024 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
|
||||
import RoomSearchAuxPanel from "../../../../src/components/views/rooms/RoomSearchAuxPanel";
|
||||
import { SearchScope } from "../../../../src/Searching";
|
||||
|
||||
describe("RoomSearchAuxPanel", () => {
|
||||
it("should render the count of results", () => {
|
||||
render(
|
||||
<RoomSearchAuxPanel
|
||||
searchInfo={{
|
||||
searchId: 1234,
|
||||
count: 5,
|
||||
term: "abcd",
|
||||
scope: SearchScope.Room,
|
||||
promise: new Promise(() => {}),
|
||||
}}
|
||||
isRoomEncrypted={false}
|
||||
onSearchScopeChange={jest.fn()}
|
||||
onCancelClick={jest.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("5 results found for", { exact: false })).toHaveTextContent(
|
||||
"5 results found for “abcd”",
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow the user to toggle to all rooms search", async () => {
|
||||
const onSearchScopeChange = jest.fn();
|
||||
|
||||
render(
|
||||
<RoomSearchAuxPanel
|
||||
isRoomEncrypted={false}
|
||||
onSearchScopeChange={onSearchScopeChange}
|
||||
onCancelClick={jest.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
screen.getByText("Search all rooms").click();
|
||||
expect(onSearchScopeChange).toHaveBeenCalledWith(SearchScope.All);
|
||||
});
|
||||
|
||||
it("should allow the user to toggle back to room-specific search", async () => {
|
||||
const onSearchScopeChange = jest.fn();
|
||||
|
||||
render(
|
||||
<RoomSearchAuxPanel
|
||||
searchInfo={{
|
||||
searchId: 1234,
|
||||
term: "abcd",
|
||||
scope: SearchScope.All,
|
||||
promise: new Promise(() => {}),
|
||||
}}
|
||||
isRoomEncrypted={false}
|
||||
onSearchScopeChange={onSearchScopeChange}
|
||||
onCancelClick={jest.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
screen.getByText("Search this room").click();
|
||||
expect(onSearchScopeChange).toHaveBeenCalledWith(SearchScope.Room);
|
||||
});
|
||||
|
||||
it("should allow the user to cancel a search", async () => {
|
||||
const onCancelClick = jest.fn();
|
||||
|
||||
render(
|
||||
<RoomSearchAuxPanel
|
||||
isRoomEncrypted={false}
|
||||
onSearchScopeChange={jest.fn()}
|
||||
onCancelClick={onCancelClick}
|
||||
/>,
|
||||
);
|
||||
|
||||
screen.getByLabelText("Cancel").click();
|
||||
expect(onCancelClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
Copyright 2022 Emmanuel Ezeka <eec.studies@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
|
||||
import SearchBar from "../../../../src/components/views/rooms/SearchBar";
|
||||
import { KeyBindingAction } from "../../../../src/accessibility/KeyboardShortcuts";
|
||||
import { SearchScope } from "../../../../src/Searching";
|
||||
|
||||
let mockCurrentEvent = KeyBindingAction.Enter;
|
||||
|
||||
const searchProps = {
|
||||
onCancelClick: jest.fn(),
|
||||
onSearch: jest.fn(),
|
||||
searchInProgress: false,
|
||||
isRoomEncrypted: false,
|
||||
};
|
||||
|
||||
jest.mock("../../../../src/KeyBindingsManager", () => ({
|
||||
__esModule: true,
|
||||
getKeyBindingsManager: jest.fn(() => ({ getAccessibilityAction: jest.fn(() => mockCurrentEvent) })),
|
||||
}));
|
||||
|
||||
describe("SearchBar", () => {
|
||||
afterEach(() => {
|
||||
searchProps.onCancelClick.mockClear();
|
||||
searchProps.onSearch.mockClear();
|
||||
});
|
||||
|
||||
it("must not search when input value is empty", () => {
|
||||
const { container } = render(<SearchBar {...searchProps} />);
|
||||
const roomButtons = container.querySelectorAll(".mx_SearchBar_button");
|
||||
const searchButton = container.querySelectorAll(".mx_SearchBar_searchButton");
|
||||
|
||||
expect(roomButtons.length).toEqual(2);
|
||||
|
||||
fireEvent.click(searchButton[0]);
|
||||
fireEvent.click(roomButtons[0]);
|
||||
fireEvent.click(roomButtons[1]);
|
||||
|
||||
expect(searchProps.onSearch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("must trigger onSearch when value is not empty", () => {
|
||||
const { container } = render(<SearchBar {...searchProps} />);
|
||||
const searchValue = "abcd";
|
||||
|
||||
const roomButtons = container.querySelectorAll(".mx_SearchBar_button");
|
||||
const searchButton = container.querySelectorAll(".mx_SearchBar_searchButton");
|
||||
const input = container.querySelector<HTMLInputElement>(".mx_SearchBar_input input");
|
||||
input!.value = searchValue;
|
||||
|
||||
expect(roomButtons.length).toEqual(2);
|
||||
|
||||
fireEvent.click(searchButton[0]);
|
||||
|
||||
expect(searchProps.onSearch).toHaveBeenCalledTimes(1);
|
||||
expect(searchProps.onSearch).toHaveBeenNthCalledWith(1, searchValue, SearchScope.Room);
|
||||
|
||||
fireEvent.click(roomButtons[0]);
|
||||
|
||||
expect(searchProps.onSearch).toHaveBeenCalledTimes(2);
|
||||
expect(searchProps.onSearch).toHaveBeenNthCalledWith(2, searchValue, SearchScope.Room);
|
||||
|
||||
fireEvent.click(roomButtons[1]);
|
||||
|
||||
expect(searchProps.onSearch).toHaveBeenCalledTimes(3);
|
||||
expect(searchProps.onSearch).toHaveBeenNthCalledWith(3, searchValue, SearchScope.All);
|
||||
});
|
||||
|
||||
it("cancel button and esc key should trigger onCancelClick", async () => {
|
||||
mockCurrentEvent = KeyBindingAction.Escape;
|
||||
const { container } = render(<SearchBar {...searchProps} />);
|
||||
const cancelButton = container.querySelector(".mx_SearchBar_cancel");
|
||||
const input = container.querySelector(".mx_SearchBar_input input");
|
||||
fireEvent.click(cancelButton!);
|
||||
expect(searchProps.onCancelClick).toHaveBeenCalledTimes(1);
|
||||
|
||||
fireEvent.focus(input!);
|
||||
fireEvent.keyDown(input!, { key: "Escape", code: "Escape", charCode: 27 });
|
||||
|
||||
expect(searchProps.onCancelClick).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue