* Improve coverage * Add view model unit tests to improve coverage * Extract initial pure EventTile derived state helpers * Extract EventTile derived state helpers * Extract EventTile class state derivation * Extract EventTile line class derivation * Extract EventTile sender profile state * Extract EventTile avatar member selection * Extract EventTile avatar clickability state * Extract EventTile sender profile mode * Extract EventTile action bar visibility * Extract EventTile timestamp visibility * Extract EventTile timestamp selection * Extract EventTile timestamp display state * Extract ReplyChain timestamp visibility * Extract EventTile footer display state * Fix sonar issue
This commit is contained in:
@@ -65,6 +65,18 @@ describe("AudioPlayerViewModel", () => {
|
||||
expect(playback.skipTo).toHaveBeenCalledWith(10 + 5); // 5 seconds forward
|
||||
});
|
||||
|
||||
it("does not stop propagation for unhandled key down events", () => {
|
||||
const vm = new AudioPlayerViewModel({ playback, mediaName: "mediaName" });
|
||||
const event = new KeyboardEvent("keydown", { key: "a" });
|
||||
const stopPropagationSpy = jest.spyOn(event, "stopPropagation");
|
||||
|
||||
vm.onKeyDown(event as unknown as ReactKeyboardEvent<HTMLDivElement>);
|
||||
|
||||
expect(stopPropagationSpy).not.toHaveBeenCalled();
|
||||
expect(playback.toggle).not.toHaveBeenCalled();
|
||||
expect(playback.skipTo).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should update snapshot when setProps is called with new mediaName", () => {
|
||||
const vm = new AudioPlayerViewModel({ playback, mediaName: "oldName" });
|
||||
expect(vm.getSnapshot().mediaName).toBe("oldName");
|
||||
|
||||
Reference in New Issue
Block a user