Fix timeline position when moving to a room and coming back (#12055)

* Force `initialEventId` in `RoomView`

* Remove Force `initialEventId` in `RoomView`

* Add e2e tests to verify we memorize the timeline position

* Fill `viewRoomOpts` in `viewRoom`

* Reset jest mock in sliding sync test

* Add comments
This commit is contained in:
Florian Duros 2023-12-19 14:21:44 +01:00 committed by GitHub
parent 537b4a1971
commit 3acd648ed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 34 deletions

View file

@ -585,10 +585,4 @@ describe("RoomView", () => {
expect(dis.dispatch).toHaveBeenCalledWith({ action: "cancel_ask_to_join", roomId: room.roomId });
});
});
it("fires Action.RoomLoaded", async () => {
jest.spyOn(dis, "dispatch");
await mountRoomView();
expect(dis.dispatch).toHaveBeenCalledWith({ action: Action.RoomLoaded });
});
});

View file

@ -134,11 +134,6 @@ describe("RoomViewStore", function () {
await untilDispatch(Action.CancelAskToJoin, dis);
};
const dispatchRoomLoaded = async () => {
dis.dispatch({ action: Action.RoomLoaded });
await untilDispatch(Action.RoomLoaded, dis);
};
let roomViewStore: RoomViewStore;
let slidingSyncManager: SlidingSyncManager;
let dis: MatrixDispatcher;
@ -425,6 +420,10 @@ describe("RoomViewStore", function () {
});
});
afterEach(() => {
jest.spyOn(SettingsStore, "getValue").mockReset();
});
it("subscribes to the room", async () => {
const setRoomVisible = jest
.spyOn(slidingSyncManager, "setRoomVisible")
@ -598,7 +597,10 @@ describe("RoomViewStore", function () {
opts.buttons = buttons;
}
});
await dispatchRoomLoaded();
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
await untilDispatch(Action.ViewRoom, dis);
expect(roomViewStore.getViewRoomOpts()).toEqual({ buttons });
});
});