Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/fix/17686
Conflicts: src/components/views/elements/MiniAvatarUploader.tsx src/components/views/spaces/SpaceSettingsVisibilityTab.tsx src/i18n/strings/en_EN.json src/settings/handlers/RoomSettingsHandler.ts src/stores/SpaceStore.tsx
This commit is contained in:
commit
dcb9b9b777
153 changed files with 3535 additions and 1153 deletions
|
@ -22,8 +22,10 @@ import sdk from "../../../skinned-sdk";
|
|||
import { mkEvent, mkStubRoom } from "../../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import * as languageHandler from "../../../../src/languageHandler";
|
||||
import * as TestUtils from "../../../test-utils";
|
||||
|
||||
const TextualBody = sdk.getComponent("views.messages.TextualBody");
|
||||
const _TextualBody = sdk.getComponent("views.messages.TextualBody");
|
||||
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
|
@ -305,10 +307,9 @@ describe("<TextualBody />", () => {
|
|||
const wrapper = mount(<TextualBody mxEvent={ev} showUrlPreview={true} onHeightChanged={() => {}} />);
|
||||
expect(wrapper.text()).toBe(ev.getContent().body);
|
||||
|
||||
let widgets = wrapper.find("LinkPreviewWidget");
|
||||
// at this point we should have exactly one widget
|
||||
expect(widgets.length).toBe(1);
|
||||
expect(widgets.at(0).prop("link")).toBe("https://matrix.org/");
|
||||
let widgets = wrapper.find("LinkPreviewGroup");
|
||||
// at this point we should have exactly one link
|
||||
expect(widgets.at(0).prop("links")).toEqual(["https://matrix.org/"]);
|
||||
|
||||
// simulate an event edit and check the transition from the old URL preview to the new one
|
||||
const ev2 = mkEvent({
|
||||
|
@ -333,11 +334,9 @@ describe("<TextualBody />", () => {
|
|||
|
||||
// XXX: this is to give TextualBody enough time for state to settle
|
||||
wrapper.setState({}, () => {
|
||||
widgets = wrapper.find("LinkPreviewWidget");
|
||||
// at this point we should have exactly two widgets (not the matrix.org one anymore)
|
||||
expect(widgets.length).toBe(2);
|
||||
expect(widgets.at(0).prop("link")).toBe("https://vector.im/");
|
||||
expect(widgets.at(1).prop("link")).toBe("https://riot.im/");
|
||||
widgets = wrapper.find("LinkPreviewGroup");
|
||||
// at this point we should have exactly two links (not the matrix.org one anymore)
|
||||
expect(widgets.at(0).prop("links")).toEqual(["https://vector.im/", "https://riot.im/"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -572,11 +572,11 @@ uploads_path: "{{SYNAPSE_ROOT}}uploads"
|
|||
## Captcha ##
|
||||
# See docs/CAPTCHA_SETUP for full details of configuring this.
|
||||
|
||||
# This Home Server's ReCAPTCHA public key.
|
||||
# This homeserver's ReCAPTCHA public key.
|
||||
#
|
||||
#recaptcha_public_key: "YOUR_PUBLIC_KEY"
|
||||
|
||||
# This Home Server's ReCAPTCHA private key.
|
||||
# This homeserver's ReCAPTCHA private key.
|
||||
#
|
||||
#recaptcha_private_key: "YOUR_PRIVATE_KEY"
|
||||
|
||||
|
@ -685,7 +685,7 @@ registration_shared_secret: "{{REGISTRATION_SHARED_SECRET}}"
|
|||
# The list of identity servers trusted to verify third party
|
||||
# identifiers by this server.
|
||||
#
|
||||
# Also defines the ID server which will be called when an account is
|
||||
# Also defines the identity server which will be called when an account is
|
||||
# deactivated (one will be picked arbitrarily).
|
||||
#
|
||||
#trusted_third_party_id_servers:
|
||||
|
@ -889,7 +889,7 @@ email:
|
|||
smtp_user: "exampleusername"
|
||||
smtp_pass: "examplepassword"
|
||||
require_transport_security: False
|
||||
notif_from: "Your Friendly %(app)s Home Server <noreply@example.com>"
|
||||
notif_from: "Your Friendly %(app)s homeserver <noreply@example.com>"
|
||||
app_name: Matrix
|
||||
# if template_dir is unset, uses the example templates that are part of
|
||||
# the Synapse distribution.
|
||||
|
|
35
test/utils/AnimationUtils-test.ts
Normal file
35
test/utils/AnimationUtils-test.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2021 Šimon Brandner <simon.bra.ag@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 { lerp } from "../../src/utils/AnimationUtils";
|
||||
|
||||
describe("lerp", () => {
|
||||
it("correctly interpolates", () => {
|
||||
expect(lerp(0, 100, 0.5)).toBe(50);
|
||||
expect(lerp(50, 100, 0.5)).toBe(75);
|
||||
expect(lerp(0, 1, 0.1)).toBe(0.1);
|
||||
});
|
||||
|
||||
it("clamps the interpolant", () => {
|
||||
expect(lerp(0, 100, 50)).toBe(100);
|
||||
expect(lerp(0, 100, -50)).toBe(0);
|
||||
});
|
||||
|
||||
it("handles negative numbers", () => {
|
||||
expect(lerp(-100, 0, 0.5)).toBe(-50);
|
||||
expect(lerp(100, -100, 0.5)).toBe(0);
|
||||
});
|
||||
});
|
65
test/utils/FixedRollingArray-test.ts
Normal file
65
test/utils/FixedRollingArray-test.ts
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Copyright 2021 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 { FixedRollingArray } from "../../src/utils/FixedRollingArray";
|
||||
|
||||
describe('FixedRollingArray', () => {
|
||||
it('should seed the array with the given value', () => {
|
||||
const seed = "test";
|
||||
const width = 24;
|
||||
const array = new FixedRollingArray(width, seed);
|
||||
|
||||
expect(array.value.length).toBe(width);
|
||||
expect(array.value.every(v => v === seed)).toBe(true);
|
||||
});
|
||||
|
||||
it('should insert at the correct end', () => {
|
||||
const seed = "test";
|
||||
const value = "changed";
|
||||
const width = 24;
|
||||
const array = new FixedRollingArray(width, seed);
|
||||
array.pushValue(value);
|
||||
|
||||
expect(array.value.length).toBe(width);
|
||||
expect(array.value[0]).toBe(value);
|
||||
});
|
||||
|
||||
it('should roll over', () => {
|
||||
const seed = -1;
|
||||
const width = 24;
|
||||
const array = new FixedRollingArray(width, seed);
|
||||
|
||||
const maxValue = width * 2;
|
||||
const minValue = width; // because we're forcing a rollover
|
||||
for (let i = 0; i <= maxValue; i++) {
|
||||
array.pushValue(i);
|
||||
}
|
||||
|
||||
expect(array.value.length).toBe(width);
|
||||
|
||||
for (let i = 1; i < width; i++) {
|
||||
const current = array.value[i];
|
||||
const previous = array.value[i - 1];
|
||||
expect(previous - current).toBe(1);
|
||||
|
||||
if (i === 1) {
|
||||
expect(previous).toBe(maxValue);
|
||||
} else if (i === width) {
|
||||
expect(current).toBe(minValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue