Skip to content

Commit

Permalink
Communication: Fix scrolling error for long messages (#9997)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaRangger authored Dec 14, 2024
1 parent fafe68c commit 0c8eefe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
}
}
this.elementsAtScrollPosition = visibleMessages;
if (this.elementsAtScrollPosition && this.canStartSaving) {
if (this.elementsAtScrollPosition && this.elementsAtScrollPosition.length > 0 && this.canStartSaving) {
this.saveScrollPosition(this.elementsAtScrollPosition[0].post.id!);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,14 @@ examples.forEach((activeConversation) => {
expect(inlineInput).toBeTruthy(); // Check if the inline input component is present
}));
}

it('should scroll to bottom and set canStartSaving to true when lastScrollPosition is falsy', async () => {
const scrollToBottomSpy = jest.spyOn(component, 'scrollToBottomOfMessages');

await component.goToLastSelectedElement(0, false);

expect(scrollToBottomSpy).toHaveBeenCalledOnce();
expect(component.canStartSaving).toBeTrue();
});
});
});

0 comments on commit 0c8eefe

Please sign in to comment.