mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/
mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts
And a couple of gitignore tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { render } from "jest-matrix-react";
|
||||
import { type IPublicRoomsChunkRoom } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { PublicRoomResultDetails } from "../../../../../../src/components/views/dialogs/spotlight/PublicRoomResultDetails";
|
||||
|
||||
describe("PublicRoomResultDetails", () => {
|
||||
it("renders", () => {
|
||||
const { asFragment } = render(
|
||||
<PublicRoomResultDetails
|
||||
room={{
|
||||
room_id: "room-id",
|
||||
name: "hello?",
|
||||
canonical_alias: "canonical-alias",
|
||||
world_readable: true,
|
||||
guest_can_join: false,
|
||||
num_joined_members: 666,
|
||||
}}
|
||||
labelId="label-id"
|
||||
descriptionId="description-id"
|
||||
detailsId="details-id"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ canonical_alias: "canonical-alias" },
|
||||
{ aliases: ["alias-from-aliases"] },
|
||||
{ name: "name over alias", canonical_alias: "canonical-alias" },
|
||||
{
|
||||
name: "with an overly long name that will be truncated for sure, you can't say anything about it",
|
||||
topic: "with a topic!",
|
||||
},
|
||||
{ topic: "Very long topic " + new Array(1337).join("a") },
|
||||
])("Public room results", (partialPublicRoomChunk: Partial<IPublicRoomsChunkRoom>) => {
|
||||
const roomChunk: IPublicRoomsChunkRoom = {
|
||||
room_id: "room-id",
|
||||
world_readable: true,
|
||||
guest_can_join: false,
|
||||
num_joined_members: 666,
|
||||
...partialPublicRoomChunk,
|
||||
};
|
||||
|
||||
const { asFragment } = render(
|
||||
<PublicRoomResultDetails
|
||||
room={roomChunk}
|
||||
labelId="label-id"
|
||||
descriptionId="description-id"
|
||||
detailsId="details-id"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 Mikhail Aheichyk
|
||||
Copyright 2023 Nordeck IT + Consulting GmbH.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { render, screen, type RenderResult } from "jest-matrix-react";
|
||||
import { mocked } from "jest-mock";
|
||||
import { Room, type MatrixClient, PendingEventOrdering } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { RoomResultContextMenus } from "../../../../../../src/components/views/dialogs/spotlight/RoomResultContextMenus";
|
||||
import { filterConsole, stubClient } from "../../../../../test-utils";
|
||||
import { shouldShowComponent } from "../../../../../../src/customisations/helpers/UIComponents";
|
||||
import { UIComponent } from "../../../../../../src/settings/UIFeature";
|
||||
|
||||
jest.mock("../../../../../../src/customisations/helpers/UIComponents", () => ({
|
||||
shouldShowComponent: jest.fn(),
|
||||
}));
|
||||
|
||||
describe("RoomResultContextMenus", () => {
|
||||
let client: MatrixClient;
|
||||
let room: Room;
|
||||
|
||||
const renderRoomResultContextMenus = (): RenderResult => {
|
||||
return render(<RoomResultContextMenus room={room} />);
|
||||
};
|
||||
|
||||
filterConsole(
|
||||
// irrelevant for this test
|
||||
"Room !1:example.org does not have an m.room.create event",
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
client = stubClient();
|
||||
room = new Room("!1:example.org", client, "@alice:example.org", {
|
||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not render the room options context menu when UIComponent customisations disable room options", () => {
|
||||
mocked(shouldShowComponent).mockReturnValue(false);
|
||||
renderRoomResultContextMenus();
|
||||
expect(shouldShowComponent).toHaveBeenCalledWith(UIComponent.RoomOptionsMenu);
|
||||
expect(screen.queryByRole("button", { name: "Room options" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the room options context menu when UIComponent customisations enable room options", () => {
|
||||
mocked(shouldShowComponent).mockReturnValue(true);
|
||||
renderRoomResultContextMenus();
|
||||
expect(shouldShowComponent).toHaveBeenCalledWith(UIComponent.RoomOptionsMenu);
|
||||
expect(screen.queryByRole("button", { name: "Room options" })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`PublicRoomResultDetails Public room results 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
canonical-alias
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
canonical-alias
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`PublicRoomResultDetails Public room results 2`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
alias-from-aliases
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
room-id
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`PublicRoomResultDetails Public room results 3`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
name over alias
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
canonical-alias
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`PublicRoomResultDetails Public room results 4`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
with an overly long name that will be truncated for sure, you can't say anything...
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
room-id
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
·
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomTopic"
|
||||
>
|
||||
with a topic!
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`PublicRoomResultDetails Public room results 5`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
Unnamed Room
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
room-id
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
·
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomTopic"
|
||||
>
|
||||
Very long topic aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`PublicRoomResultDetails renders 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDetails"
|
||||
>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomHeader"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomName"
|
||||
id="label-id"
|
||||
>
|
||||
hello?
|
||||
</span>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomAlias"
|
||||
id="description-id"
|
||||
>
|
||||
canonical-alias
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="mx_SpotlightDialog_result_publicRoomDescription"
|
||||
id="details-id"
|
||||
>
|
||||
<span
|
||||
class="mx_SpotlightDialog_result_publicRoomMemberCount"
|
||||
>
|
||||
666 Members
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
Reference in New Issue
Block a user