You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
RTE drafts (#12674)
* Add drafts to the RTE and tests * test drafts in threads * lint * Add unit test. * Fix test failure * Remove unused import * Clean up wysiwyg drafts and add test. * Fix typo * Add timeout to allow for wasm loading. --------- Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
This commit is contained in:
@ -624,6 +624,18 @@ describe("<MatrixChat />", () => {
|
||||
expect(localStorage.getItem(`mx_cider_state_${unknownRoomId}`)).toBeNull();
|
||||
});
|
||||
|
||||
it("should clean up wysiwyg drafts", async () => {
|
||||
Date.now = jest.fn(() => timestamp);
|
||||
localStorage.setItem(`mx_wysiwyg_state_${roomId}`, "fake_content");
|
||||
localStorage.setItem(`mx_wysiwyg_state_${unknownRoomId}`, "fake_content");
|
||||
await getComponentAndWaitForReady();
|
||||
mockClient.emit(ClientEvent.Sync, SyncState.Syncing, SyncState.Syncing);
|
||||
// let things settle
|
||||
await flushPromises();
|
||||
expect(localStorage.getItem(`mx_wysiwyg_state_${roomId}`)).not.toBeNull();
|
||||
expect(localStorage.getItem(`mx_wysiwyg_state_${unknownRoomId}`)).toBeNull();
|
||||
});
|
||||
|
||||
it("should not clean up drafts before expiry", async () => {
|
||||
// Set the last cleanup to the recent past
|
||||
localStorage.setItem(`mx_cider_state_${unknownRoomId}`, "fake_content");
|
||||
|
Reference in New Issue
Block a user