Fix wrong room topic tooltip position (#10667)
* Fix wrong room topic tooltip position * Update snapshots * Fix tests
This commit is contained in:
committed by
GitHub
parent
93b4ee654b
commit
1efa82917a
@@ -52,24 +52,27 @@ describe("PosthogAnalytics", () => {
|
||||
beforeEach(() => {
|
||||
fakePosthog = getFakePosthog();
|
||||
|
||||
window.crypto = {
|
||||
subtle: {
|
||||
digest: async (_: AlgorithmIdentifier, encodedMessage: BufferSource) => {
|
||||
const message = new TextDecoder().decode(encodedMessage);
|
||||
const hexHash = shaHashes[message];
|
||||
const bytes: number[] = [];
|
||||
for (let c = 0; c < hexHash.length; c += 2) {
|
||||
bytes.push(parseInt(hexHash.slice(c, c + 2), 16));
|
||||
}
|
||||
return bytes as unknown as ArrayBuffer;
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: {
|
||||
subtle: {
|
||||
digest: async (_: AlgorithmIdentifier, encodedMessage: BufferSource) => {
|
||||
const message = new TextDecoder().decode(encodedMessage);
|
||||
const hexHash = shaHashes[message];
|
||||
const bytes: number[] = [];
|
||||
for (let c = 0; c < hexHash.length; c += 2) {
|
||||
bytes.push(parseInt(hexHash.slice(c, c + 2), 16));
|
||||
}
|
||||
return bytes;
|
||||
},
|
||||
},
|
||||
} as unknown as SubtleCrypto,
|
||||
} as unknown as Crypto;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// @ts-ignore
|
||||
window.crypto = null;
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: null,
|
||||
});
|
||||
SdkConfig.unset(); // we touch the config, so clean up
|
||||
});
|
||||
|
||||
|
||||
@@ -55,14 +55,11 @@ exports[`RoomView for a local room in state CREATING should match the snapshot 1
|
||||
<div
|
||||
class="mx_RoomHeader_topic mx_RoomTopic"
|
||||
dir="auto"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -149,14 +146,11 @@ exports[`RoomView for a local room in state ERROR should match the snapshot 1`]
|
||||
<div
|
||||
class="mx_RoomHeader_topic mx_RoomTopic"
|
||||
dir="auto"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -339,14 +333,11 @@ exports[`RoomView for a local room in state NEW should match the snapshot 1`] =
|
||||
<div
|
||||
class="mx_RoomHeader_topic mx_RoomTopic"
|
||||
dir="auto"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -606,14 +597,11 @@ exports[`RoomView for a local room in state NEW that is encrypted should match t
|
||||
<div
|
||||
class="mx_RoomHeader_topic mx_RoomTopic"
|
||||
dir="auto"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -75,13 +75,13 @@ describe("MegolmExportEncryption", function () {
|
||||
let MegolmExportEncryption: typeof MegolmExportEncryptionExport;
|
||||
|
||||
beforeEach(() => {
|
||||
window.crypto = {
|
||||
getRandomValues,
|
||||
randomUUID: jest.fn().mockReturnValue("not-random-uuid"),
|
||||
subtle: webCrypto.subtle,
|
||||
};
|
||||
// @ts-ignore for some reason including it in the object above gets ignored
|
||||
window.crypto.subtle = webCrypto.subtle;
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: {
|
||||
getRandomValues,
|
||||
randomUUID: jest.fn().mockReturnValue("not-random-uuid"),
|
||||
subtle: webCrypto.subtle,
|
||||
},
|
||||
});
|
||||
MegolmExportEncryption = require("../../src/utils/MegolmExportEncryption");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user