Skip to content

Commit

Permalink
Pull log text if ConsoleLogCard starts expanded. (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrown5 authored Mar 8, 2024
1 parent 2afb476 commit 6c0d11f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,20 @@ describe("ConsoleLogCard", () => {
expect(getByText(/This is a step/));
expect(findByText(/Hello, world!/));
});

it("calls handleMoreConsoleClick on load was card isExpanded set", async () => {
console.log = jest.fn();
render(<ConsoleLogCard {...DefaultTestProps} isExpanded={true} />);
expect(console.log).toHaveBeenCalledWith(
"handleMoreConsoleClick triggered"
);
});

it("does not call handleMoreConsoleClick on load was card isExpanded set", async () => {
console.log = jest.fn();
render(<ConsoleLogCard {...DefaultTestProps} />);
expect(console.log).not.toHaveBeenCalledWith(
"handleMoreConsoleClick triggered"
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ export class ConsoleLogCard extends React.Component<
this.props.handleStepToggle(event, this.props.step.id);
}

componentDidMount(): void {
if (this.props.isExpanded) {
// If we start expanded then request logs.
this.props.handleMoreConsoleClick(
this.props.step.id,
this.props.stepBuffer.startByte
);
}
}

getTruncatedLogWarning() {
if (this.props.stepBuffer.lines && this.props.stepBuffer.startByte > 0) {
return (
Expand Down

0 comments on commit 6c0d11f

Please sign in to comment.