Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheets-thread-comment-ui): add comment tooltip (#7666)

wpxp1234562a4d565373d1
diff --git a/packages/sheets-thread-comment-ui/src/menu/__tests__/menu.spec.ts b/packages/sheets-thread-comment-ui/src/menu/__tests__/menu.spec.ts
index fda4332713..c61df6f10d 100644
--- a/packages/sheets-thread-comment-ui/src/menu/__tests__/menu.spec.ts
+++ b/packages/sheets-thread-comment-ui/src/menu/__tests__/menu.spec.ts
@@ -25,7 +25,7 @@ import {
import { RangeProtectionRuleModel, SheetsSelectionsService, WorksheetProtectionRuleModel } from '@univerjs/sheets';
import { BehaviorSubject, of, Subject } from 'rxjs';
import { describe, expect, it } from 'vitest';
-import { drawingCommentMenuFactory } from '../menu';
+import { drawingCommentMenuFactory, threadCommentMenuFactory } from '../menu';
describe('drawingCommentMenuFactory', () => {
it('stays enabled for a focused drawing until comment permission is denied', () => {
@@ -76,3 +76,26 @@ describe('drawingCommentMenuFactory', () => {
injector.dispose();
});
});
+
+describe('thread comment menu', () => {
+ it('shows the add comment label in its tooltip', () => {
+ const service = {
+ currentUser$: of(null),
+ focused$: of(null),
+ getCurrentTypeOfUnit$: () => of(null),
+ subscribeContextValue$: () => of(false),
+ };
+ const accessor = new Injector([
+ [IContextService, { useValue: service }],
+ [IUniverInstanceService, { useValue: service }],
+ [UserManagerService, { useValue: service }],
+ ]);
+
+ expect(threadCommentMenuFactory(accessor)).toMatchObject({
+ title: 'sheets-thread-comment-ui.menu.addComment',
+ tooltip: 'sheets-thread-comment-ui.menu.addComment',
+ });
+
+ accessor.dispose();
+ });
+});
diff --git a/packages/sheets-thread-comment-ui/src/menu/menu.ts b/packages/sheets-thread-comment-ui/src/menu/menu.ts
index 6f3369c605..df60bd4036 100644
--- a/packages/sheets-thread-comment-ui/src/menu/menu.ts
+++ b/packages/sheets-thread-comment-ui/src/menu/menu.ts
@@ -54,6 +54,7 @@ export const threadCommentMenuFactory = (accessor: IAccessor) => {
type: MenuItemType.BUTTON,
icon: 'InsertCommentDoubleIcon',
title: 'sheets-thread-comment-ui.menu.addComment',
+ tooltip: 'sheets-thread-comment-ui.menu.addComment',
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
disabled$: getCurrentRangeDisable$(accessor, {
workbookTypes: [WorkbookCommentPermission],