Align common_*
strings with Element X project in Localazy (#11434)
This commit is contained in:
parent
1a49a38f04
commit
c40141cc4f
132 changed files with 1491 additions and 1247 deletions
|
@ -28,6 +28,8 @@ import { stubClient } from "../../../test-utils";
|
|||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import { EchoChamber } from "../../../../src/stores/local-echo/EchoChamber";
|
||||
import { RoomNotifState } from "../../../../src/RoomNotifs";
|
||||
|
||||
jest.mock("../../../../src/customisations/helpers/UIComponents", () => ({
|
||||
shouldShowComponent: jest.fn(),
|
||||
|
@ -100,4 +102,15 @@ describe("RoomContextMenu", () => {
|
|||
expect(screen.getByText("Developer tools")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it("should render notification option for joined rooms", () => {
|
||||
const chamber = EchoChamber.forRoom(room);
|
||||
chamber.notificationVolume = RoomNotifState.Mute;
|
||||
jest.spyOn(room, "getMyMembership").mockReturnValue("join");
|
||||
renderComponent();
|
||||
|
||||
expect(
|
||||
screen.getByRole("menuitem", { name: "Notifications" }).querySelector(".mx_IconizedContextMenu_sublabel"),
|
||||
).toHaveTextContent("Mute");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ import encrypt from "matrix-encrypt-attachment";
|
|||
import { mocked } from "jest-mock";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
|
||||
import MImageBody from "../../../../src/components/views/messages/MImageBody";
|
||||
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
|
||||
|
@ -258,4 +259,29 @@ describe("<MImageBody/>", () => {
|
|||
// thumbnail with dimensions present
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should show banner on hover", async () => {
|
||||
const event = new MatrixEvent({
|
||||
room_id: "!room:server",
|
||||
sender: userId,
|
||||
type: EventType.RoomMessage,
|
||||
content: {
|
||||
body: "alt for a test image",
|
||||
info: {
|
||||
w: 40,
|
||||
h: 50,
|
||||
},
|
||||
url: "mxc://server/image",
|
||||
},
|
||||
});
|
||||
|
||||
const { container } = render(
|
||||
<MImageBody {...props} mxEvent={event} mediaEventHelper={new MediaEventHelper(event)} />,
|
||||
);
|
||||
|
||||
const img = container.querySelector(".mx_MImageBody_thumbnail")!;
|
||||
await userEvent.hover(img);
|
||||
|
||||
expect(container.querySelector(".mx_MImageBody_banner")).toHaveTextContent("...alt for a test image");
|
||||
});
|
||||
});
|
||||
|
|
35
test/components/views/rooms/PresenceLabel-test.tsx
Normal file
35
test/components/views/rooms/PresenceLabel-test.tsx
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2023 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 } from "@testing-library/react";
|
||||
|
||||
import PresenceLabel from "../../../../src/components/views/rooms/PresenceLabel";
|
||||
|
||||
describe("<PresenceLabel/>", () => {
|
||||
it("should render 'Offline' for presence=offline", () => {
|
||||
const { asFragment } = render(<PresenceLabel presenceState="offline" />);
|
||||
expect(asFragment()).toMatchInlineSnapshot(`
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_PresenceLabel"
|
||||
>
|
||||
Offline
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`);
|
||||
});
|
||||
});
|
|
@ -22,15 +22,36 @@ import React from "react";
|
|||
import AddExistingToSpaceDialog from "../../../../src/components/views/dialogs/AddExistingToSpaceDialog";
|
||||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import { mkSpace, stubClient } from "../../../test-utils";
|
||||
import { mkRoom, mkSpace, stubClient } from "../../../test-utils";
|
||||
|
||||
describe("<AddExistingToSpaceDialog />", () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(Element.prototype, "clientHeight", "get").mockReturnValue(600);
|
||||
});
|
||||
|
||||
it("looks as expected", () => {
|
||||
const client = stubClient();
|
||||
const dialog = renderAddExistingToSpaceDialog(client);
|
||||
expect(dialog.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should show 'no results' if appropriate", () => {
|
||||
const client = stubClient();
|
||||
const { getByText } = renderAddExistingToSpaceDialog(client);
|
||||
expect(getByText("No results")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should not show 'no results' if we have results to show", () => {
|
||||
const client = stubClient();
|
||||
mocked(client.getVisibleRooms).mockReturnValue([
|
||||
mkSpace(client, "!space2:example.com"),
|
||||
mkRoom(client, "!room2:example.com"),
|
||||
]);
|
||||
const { queryByText, getByText } = renderAddExistingToSpaceDialog(client);
|
||||
expect(queryByText("No results")).not.toBeInTheDocument();
|
||||
expect(getByText("!room2:example.com")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe("If the feature_dynamic_room_predecessors is not enabled", () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockReturnValue(false);
|
||||
|
|
|
@ -44,6 +44,11 @@ describe("QuickSettingsButton", () => {
|
|||
expect(getQuickSettingsButton()).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render the quick settings button in expanded mode", () => {
|
||||
const { asFragment } = render(<QuickSettingsButton isPanelCollapsed={false} />);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when the quick settings are open", () => {
|
||||
beforeEach(async () => {
|
||||
renderQuickSettingsButton();
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`QuickSettingsButton should render the quick settings button in expanded mode 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
aria-expanded="true"
|
||||
aria-label="Quick settings"
|
||||
class="mx_AccessibleButton mx_QuickSettingsButton expanded"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Settings
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
Loading…
Add table
Add a link
Reference in a new issue