Skip to content

Commit 58da2db

Browse files
committed
fix(tests): update unit tests for faded highlights and FloatingComments
DomPainter: inactive comments now show faded background instead of empty. SuperDoc: CommentDialog moved inside FloatingComments, check that instead.
1 parent a5d0d2a commit 58da2db

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/layout-engine/painters/dom/src/index.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,13 +2942,16 @@ describe('DomPainter', () => {
29422942
painter.setActiveComment('comment-A');
29432943
painter.paint(paragraphLayout, mount);
29442944
span = mount.querySelector('.superdoc-comment-highlight') as HTMLElement;
2945-
expect(span.style.backgroundColor).not.toBe('');
2945+
const activeColor = span.style.backgroundColor;
2946+
expect(activeColor).not.toBe('');
29462947

2947-
// Select a different comment (comment-B): should NOT be highlighted
2948+
// Select a different comment (comment-B): should show faded highlight
29482949
painter.setActiveComment('comment-B');
29492950
painter.paint(paragraphLayout, mount);
29502951
span = mount.querySelector('.superdoc-comment-highlight') as HTMLElement;
2951-
expect(span.style.backgroundColor).toBe(''); // Not highlighted because active comment doesn't match
2952+
// Inactive comments get a faded background instead of being invisible
2953+
expect(span.style.backgroundColor).not.toBe('');
2954+
expect(span.style.backgroundColor).not.toBe(activeColor);
29522955
});
29532956

29542957
it('shows nested comment indicators when outer comment is selected', () => {

packages/superdoc/src/SuperDoc.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ describe('SuperDoc.vue', () => {
562562
await nextTick();
563563
const toggleArg = superdocStub.broadcastSidebarToggle.mock.calls.at(-1)[0];
564564
expect(toggleArg).toEqual(expect.objectContaining({ commentId: 'new' }));
565-
expect(wrapper.findComponent(CommentDialogStub).exists()).toBe(true);
565+
// CommentDialog is now rendered inside FloatingComments, so check for that instead
566+
expect(wrapper.findComponent(FloatingCommentsStub).exists()).toBe(true);
566567

567568
superdocStoreStub.isReady.value = true;
568569
await nextTick();

0 commit comments

Comments
 (0)