From d2ad3f7a6297cdee1dd3ca150bbe82fcacbb6ec4 Mon Sep 17 00:00:00 2001 From: Dushusir <1414556676@qq.com> Date: Sat, 7 Dec 2024 14:31:33 +0800 Subject: [PATCH] fix(filter): test with dirty range --- packages/sheets-filter-ui/package.json | 1 + .../commands/__tests__/sheets-filter.command.spec.ts | 5 +++-- .../operations/__tests__/sheets-filter.operation.spec.ts | 2 ++ .../src/controllers/__tests__/sheets-filter.menu.spec.ts | 2 ++ .../services/__tests__/sheets-filter-panel.service.spec.ts | 2 ++ pnpm-lock.yaml | 3 +++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/sheets-filter-ui/package.json b/packages/sheets-filter-ui/package.json index b9fec912fdd..383526ba044 100644 --- a/packages/sheets-filter-ui/package.json +++ b/packages/sheets-filter-ui/package.json @@ -68,6 +68,7 @@ "dependencies": { "@univerjs/core": "workspace:*", "@univerjs/design": "workspace:*", + "@univerjs/engine-formula": "workspace:*", "@univerjs/engine-render": "workspace:*", "@univerjs/icons": "^0.2.10", "@univerjs/rpc": "workspace:*", diff --git a/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts b/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts index cd7ee5d4d46..de2ee90581a 100644 --- a/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts +++ b/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts @@ -19,11 +19,12 @@ import type { ISetRangeValuesCommandParams } from '@univerjs/sheets'; import type { FilterModel, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter'; import type { ISetSheetsFilterCriteriaCommandParams } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js'; import { AuthzIoLocalService, IAuthzIoService, ICommandService, Inject, Injector, IUniverInstanceService, LocaleType, Plugin, RANGE_TYPE, RedoCommand, UndoCommand, Univer, UniverInstanceType } from '@univerjs/core'; +import { ActiveDirtyManagerService, IActiveDirtyManagerService } from '@univerjs/engine-formula'; import { RangeProtectionRuleModel, RefRangeService, SetRangeValuesCommand, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets'; import { SetSheetsFilterRangeMutation, SheetsFilterService, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter'; + import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand, SmartToggleSheetsFilterCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js'; import { IMessageService } from '@univerjs/ui'; - import { MockMessageService } from '@univerjs/ui/services/message/__testing__/mock-message.service.js'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; @@ -100,6 +101,7 @@ function createFilterCommandTestBed() { [WorksheetProtectionRuleModel], [RangeProtectionRuleModel], [IMessageService, { useClass: MockMessageService }], + [IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }], ] as Dependency[]).forEach((d) => this._injector.add(d)); this._injector.get(SheetInterceptorService); @@ -149,7 +151,6 @@ describe('test sheets filter commands', () => { }); afterEach(() => { - univer.dispose(); }); function select(range: IRange) { diff --git a/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts b/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts index 5774226ef02..55019f8a530 100644 --- a/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts +++ b/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts @@ -18,6 +18,7 @@ import type { Dependency, IOperation, IWorkbookData, Workbook } from '@univerjs/ import type { ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter'; import type { IEditorBridgeServiceVisibleParam } from '@univerjs/sheets-ui'; import { CommandType, ICommandService, IContextService, Inject, Injector, LocaleService, LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core'; +import { ActiveDirtyManagerService, IActiveDirtyManagerService } from '@univerjs/engine-formula'; import { RefRangeService, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets'; import { SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -78,6 +79,7 @@ function createFilterOperationTestBed() { [SheetsFilterPanelService], [RefRangeService], [SheetsSelectionsService], + [IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }], ] as Dependency[]).forEach((d) => this._injector.add(d)); } } diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts index aae41c58d90..b30c7e4b4fd 100644 --- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts +++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts @@ -17,6 +17,7 @@ import type { IWorkbookData, Workbook } from '@univerjs/core'; import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter'; import { AuthzIoLocalService, DisposableCollection, IAuthzIoService, ICommandService, Inject, Injector, LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core'; +import { ActiveDirtyManagerService, IActiveDirtyManagerService } from '@univerjs/engine-formula'; import { ExclusiveRangeService, IExclusiveRangeService, RangeProtectionRuleModel, RefRangeService, SetWorksheetActiveOperation, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets'; import { RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter'; import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SmartToggleSheetsFilterCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js'; @@ -77,6 +78,7 @@ function createSheetsFilterMenuTestBed() { injector.add([SheetInterceptorService]); injector.add([RangeProtectionRuleModel]); injector.add([IExclusiveRangeService, { useClass: ExclusiveRangeService, deps: [SheetsSelectionsService] }]); + injector.add([IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }]); const commandService = injector.get(ICommandService); [ diff --git a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts index 520ccc1258f..0228d3d5022 100644 --- a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts +++ b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts @@ -20,6 +20,7 @@ import type { IOpenFilterPanelOperationParams } from '../../commands/operations/ import type { IFilterConditionFormParams } from '../../models/conditions'; import type { IFilterByValueWithTreeItem } from '../sheets-filter-panel.service'; import { CommandType, ICommandService, Inject, Injector, LocaleService, Plugin, Univer, UniverInstanceType } from '@univerjs/core'; +import { ActiveDirtyManagerService, IActiveDirtyManagerService } from '@univerjs/engine-formula'; import { RefRangeService, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets'; import { CustomFilterOperator, SheetsFilterService, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter'; import { SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js'; @@ -94,6 +95,7 @@ function createSheetsFilterPanelServiceTestBed(workbookData: IWorkbookData) { [SheetsSelectionsService], [SheetInterceptorService], [SheetsFilterPanelService], + [IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }], ] as Dependency[]).forEach((d) => this._injector.add(d)); } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5bfd60ff2fc..a77642e9d89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2379,6 +2379,9 @@ importers: '@univerjs/design': specifier: workspace:* version: link:../design + '@univerjs/engine-formula': + specifier: workspace:* + version: link:../engine-formula '@univerjs/engine-render': specifier: workspace:* version: link:../engine-render