Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Oct 22, 2024
1 parent f1c93c6 commit a500b17
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NodeAnimator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ export default class NodeAnimator extends React.Component<IProps> {
// start from startStyle 1: 0 is the one we gave it
// to start with, so now we animate 1 etc.
for (let i = 1; i < startStyles.length; ++i) {
this.applyStyles(domNode as HTMLElement, startStyles[i]);
this.applyStyles(domNode, startStyles[i]);
}

// and then we animate to the resting state
window.setTimeout(() => {
this.applyStyles(domNode as HTMLElement, restingStyle);
this.applyStyles(domNode, restingStyle);
}, 0);
}
if (domNode) {
Expand Down
25 changes: 25 additions & 0 deletions test/unit-tests/components/structures/TimelinePanel-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { mkThread } from "../../../test-utils/threads";
import { createMessageEventContent } from "../../../test-utils/events";
import SettingsStore from "../../../../src/settings/SettingsStore";
import ScrollPanel from "../../../../src/components/structures/ScrollPanel";
import defaultDispatcher from "../../../../src/dispatcher/dispatcher";
import { Action } from "../../../../src/dispatcher/actions";

// ScrollPanel calls this, but jsdom doesn't mock it for us
HTMLDivElement.prototype.scrollBy = () => {};
Expand Down Expand Up @@ -1002,4 +1004,27 @@ describe("TimelinePanel", () => {
await waitFor(() => expect(screen.queryByRole("progressbar")).toBeNull());
await waitFor(() => expect(container.querySelector(".mx_RoomView_MessageList")).not.toBeEmptyDOMElement());
});

it("should dump debug logs on Action.DumpDebugLogs", async () => {
const spy = jest.spyOn(console, "debug");

const [, room, events] = setupTestData();
const eventsPage2 = events.slice(1, 2);

// Start with only page 2 of the main events in the window
const [, timelineSet] = mkTimeline(room, eventsPage2);
room.getTimelineSets = jest.fn().mockReturnValue([timelineSet]);

await withScrollPanelMountSpy(async () => {
const { container } = render(<TimelinePanel {...getProps(room, events)} timelineSet={timelineSet} />);

await waitFor(() => expectEvents(container, [events[1]]));
});

defaultDispatcher.fire(Action.DumpDebugLogs);

await waitFor(() =>
expect(spy).toHaveBeenCalledWith(expect.stringContaining("TimelinePanel(Room): Debugging info for roomId")),
);
});
});

0 comments on commit a500b17

Please sign in to comment.