You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-31 13:44:28 +03:00
Migrate more strings to translation keys (#11694)
This commit is contained in:
committed by
GitHub
parent
677854d318
commit
e1cfde0c6e
@ -339,13 +339,13 @@ describe("Login", function () {
|
||||
it("should display an error when homeserver fails liveliness check", async () => {
|
||||
fetchMock.resetBehavior();
|
||||
fetchMock.get("https://matrix.org/_matrix/client/versions", {
|
||||
status: 400,
|
||||
status: 0,
|
||||
});
|
||||
getComponent();
|
||||
await waitForElementToBeRemoved(() => screen.queryAllByLabelText("Loading…"));
|
||||
|
||||
// error displayed
|
||||
expect(screen.getByText("Your test-brand is misconfigured")).toBeInTheDocument();
|
||||
expect(screen.getByText("Cannot reach homeserver")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should reset liveliness error when server config changes", async () => {
|
||||
@ -363,14 +363,14 @@ describe("Login", function () {
|
||||
await waitForElementToBeRemoved(() => screen.queryAllByLabelText("Loading…"));
|
||||
|
||||
// error displayed
|
||||
expect(screen.getByText("Your test-brand is misconfigured")).toBeInTheDocument();
|
||||
expect(screen.getByText("Cannot reach homeserver")).toBeInTheDocument();
|
||||
|
||||
rerender(getRawComponent("https://server2"));
|
||||
|
||||
await waitForElementToBeRemoved(() => screen.queryAllByLabelText("Loading…"));
|
||||
|
||||
// error cleared
|
||||
expect(screen.queryByText("Your test-brand is misconfigured")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Cannot reach homeserver")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe("OIDC native flow", () => {
|
||||
|
@ -11,7 +11,7 @@ exports[`<DialogSidebar /> renders sidebar correctly with beacons 1`] = `
|
||||
<h4
|
||||
class="mx_Heading_h4"
|
||||
>
|
||||
View List
|
||||
View list
|
||||
</h4>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_DialogSidebar_closeButton"
|
||||
@ -115,7 +115,7 @@ exports[`<DialogSidebar /> renders sidebar correctly without beacons 1`] = `
|
||||
<h4
|
||||
class="mx_Heading_h4"
|
||||
>
|
||||
View List
|
||||
View list
|
||||
</h4>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_DialogSidebar_closeButton"
|
||||
|
@ -15,32 +15,38 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { determineAvatarPosition, readReceiptTooltip } from "../../../../src/components/views/rooms/ReadReceiptGroup";
|
||||
import * as languageHandler from "../../../../src/languageHandler";
|
||||
|
||||
describe("ReadReceiptGroup", () => {
|
||||
describe("TooltipText", () => {
|
||||
it("returns '...and more' with hasMore", () => {
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve"], true)).toEqual(
|
||||
"Alice, Bob, Charlie, Dan, Eve and more",
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve", "Fox"], 5)).toEqual(
|
||||
"Alice, Bob, Charlie, Dan, Eve and one other",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan"], true)).toEqual(
|
||||
"Alice, Bob, Charlie, Dan and more",
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve", "Fox"], 4)).toEqual(
|
||||
"Alice, Bob, Charlie, Dan and 2 others",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie"], true)).toEqual("Alice, Bob, Charlie and more");
|
||||
expect(readReceiptTooltip(["Alice", "Bob"], true)).toEqual("Alice, Bob and more");
|
||||
expect(readReceiptTooltip(["Alice"], true)).toEqual("Alice and more");
|
||||
expect(readReceiptTooltip([], false)).toBeUndefined();
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan"], 3)).toEqual(
|
||||
"Alice, Bob, Charlie and one other",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve", "Fox"], 2)).toEqual(
|
||||
"Alice, Bob and 4 others",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve", "Fox"], 1)).toEqual(
|
||||
"Alice and 5 others",
|
||||
);
|
||||
expect(readReceiptTooltip([], 1)).toBe("");
|
||||
});
|
||||
it("returns a pretty list without hasMore", () => {
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve"], false)).toEqual(
|
||||
jest.spyOn(languageHandler, "getUserLanguage").mockReturnValue("en-GB");
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve"], 5)).toEqual(
|
||||
"Alice, Bob, Charlie, Dan and Eve",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan"], false)).toEqual(
|
||||
"Alice, Bob, Charlie and Dan",
|
||||
);
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie"], false)).toEqual("Alice, Bob and Charlie");
|
||||
expect(readReceiptTooltip(["Alice", "Bob"], false)).toEqual("Alice and Bob");
|
||||
expect(readReceiptTooltip(["Alice"], false)).toEqual("Alice");
|
||||
expect(readReceiptTooltip([], false)).toBeUndefined();
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan"], 4)).toEqual("Alice, Bob, Charlie and Dan");
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie"], 5)).toEqual("Alice, Bob and Charlie");
|
||||
expect(readReceiptTooltip(["Alice", "Bob"], 5)).toEqual("Alice and Bob");
|
||||
expect(readReceiptTooltip(["Alice"], 5)).toEqual("Alice");
|
||||
expect(readReceiptTooltip([], 5)).toBe("");
|
||||
});
|
||||
});
|
||||
describe("AvatarPosition", () => {
|
||||
|
@ -211,7 +211,7 @@ describe("languageHandler JSX", function () {
|
||||
const basicString = "common|rooms";
|
||||
const selfClosingTagSub = "Accept <policyLink /> to continue:" as TranslationKey;
|
||||
const textInTagSub = "<a>Upgrade</a> to your own domain" as TranslationKey;
|
||||
const plurals = "and %(count)s others...";
|
||||
const plurals = "common|and_n_others";
|
||||
const variableSub = "slash_command|ignore_dialog_description";
|
||||
|
||||
type TestCase = [
|
||||
|
@ -82,7 +82,7 @@ describe("AutoDiscoveryUtils", () => {
|
||||
},
|
||||
};
|
||||
expect(() => AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult)).toThrow(
|
||||
"GenericFailure",
|
||||
"Unexpected error resolving identity server configuration",
|
||||
);
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
@ -96,7 +96,7 @@ describe("AutoDiscoveryUtils", () => {
|
||||
},
|
||||
};
|
||||
expect(() => AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult)).toThrow(
|
||||
"Unexpected error resolving homeserver configuration",
|
||||
"Homeserver URL does not appear to be a valid Matrix homeserver",
|
||||
);
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
@ -122,7 +122,7 @@ describe("AutoDiscoveryUtils", () => {
|
||||
},
|
||||
};
|
||||
expect(() => AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult)).toThrow(
|
||||
"Unexpected error resolving homeserver configuration",
|
||||
"Homeserver URL does not appear to be a valid Matrix homeserver",
|
||||
);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user