This is an automated email from the ASF dual-hosted git repository.

Yicong-Huang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/main by this push:
     new 06831ff568 chore(frontend): re-enable 6 admin/left-panel component 
specs (#4897)
06831ff568 is described below

commit 06831ff568edba9649990e8726abdbd305486868
Author: Yicong Huang <[email protected]>
AuthorDate: Sun May 3 23:39:08 2026 -0700

    chore(frontend): re-enable 6 admin/left-panel component specs (#4897)
    
    ### What changes were proposed in this PR?
    
    Drop 6 spec files from the exclusion lists and migrate their TestBed
    setups to the standalone-component shape — `declarations: [Comp]`
    becomes `imports: [Comp]`. The components are already standalone
    post-#4873.
    
    Specs re-enabled:
    
    - `dashboard/admin/execution`
    - `dashboard/admin/settings`
    - `dashboard/admin/user`
    - `workspace/left-panel/left-panel` (also drops a `fakeAsync`
    `beforeEach` wrapper that needed an outer ProxyZone; the body only used
    `tick()` cosmetically)
    - `workspace/left-panel/operator-menu/operator-label`
    - `workspace/left-panel/operator-menu/operator-menu`
    
    Also stubs `document.queryCommandSupported` in `jsdom-svg-polyfill.ts`
    so specs that pull monaco in indirectly don't crash at module-load time.
    
    ### Specs that did NOT make it into this PR
    
    The remaining excluded entries now fall into two clearly-labeled
    buckets, captured inline in the exclude list:
    
    **Placeholder specs (body entirely commented out — need real test cases
    written):**
    - `common/formly/preset-wrapper`
    - `common/service/user/config/user-config`
    - `workspace/left-panel/settings`
    - `workspace/menu/menu`
    - `workspace/workspace.component`
    - `workspace/service/preset/preset.service`
    
    **Blocked on jsdom limitations (belong under Vitest browser mode
    #4866):**
    - `code-editor-dialog/code-debugger`, `code-editor` — monaco CSS +
    `queryCommandSupported`
    - `codearea-custom-template` — monaco CSS
    - `left-panel/time-travel`, `versions-list` — `monaco-breakpoints`
    imports a `.css` file Vitest can't transform
    - `property-editor/operator-property-edit-frame` — formly+nz fetches
    `snippets-o` icon over HTTP
    - `workflow-editor/workflow-editor` — jointjs paper math needs real
    `getScreenCTM`
    - `dashboard/dashboard.component` — `<asl-google-signin-button>`
    dereferences fields a minimal `SocialAuthService` mock doesn't provide
    - `user-project-list-item`, `user-workflow-list-item`,
    `user-workflow.component` — templates rooted at `<nz-list-item>` need a
    `<nz-list>` host wrapper
    
    ### Any related issues, documentation, discussions?
    
    A slice of #4880 — closes the standalone-migration sweep portion of that
    effort.
    
    ### How was this PR tested?
    
    `yarn ng test --watch=false` locally:
    
    ```
    Test Files  52 passed | 3 skipped (55)
         Tests  227 passed | 8 skipped | 2 todo (237)
    ```
    
    Up from 46 / 216 on main.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 4.7 (1M context)
    
    Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
 frontend/angular.json                              |  6 ---
 .../execution/admin-execution.component.spec.ts    | 11 ++---
 .../settings/admin-settings.component.spec.ts      |  3 +-
 .../admin/user/admin-user.component.spec.ts        | 11 ++---
 .../left-panel/left-panel.component.spec.ts        |  9 ++--
 .../operator-label.component.spec.ts               | 11 ++---
 .../operator-menu/operator-menu.component.spec.ts  | 18 +++++---
 frontend/src/jsdom-svg-polyfill.ts                 | 10 ++++
 frontend/src/tsconfig.spec.json                    | 53 ++++++++++------------
 9 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/frontend/angular.json b/frontend/angular.json
index e81e41bdcf..6e840bdb52 100644
--- a/frontend/angular.json
+++ b/frontend/angular.json
@@ -97,9 +97,6 @@
               "**/drag-drop.service.spec.ts",
               
"**/app/common/formly/preset-wrapper/preset-wrapper.component.spec.ts",
               "**/app/common/service/user/config/user-config.service.spec.ts",
-              
"**/app/dashboard/component/admin/execution/admin-execution.component.spec.ts",
-              
"**/app/dashboard/component/admin/settings/admin-settings.component.spec.ts",
-              
"**/app/dashboard/component/admin/user/admin-user.component.spec.ts",
               "**/app/dashboard/component/dashboard.component.spec.ts",
               
"**/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts",
               
"**/app/dashboard/component/user/user-workflow/user-workflow-list-item/user-workflow-list-item.component.spec.ts",
@@ -107,9 +104,6 @@
               
"**/app/workspace/component/code-editor-dialog/code-debugger.component.spec.ts",
               
"**/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts",
               
"**/app/workspace/component/codearea-custom-template/codearea-custom-template.component.spec.ts",
-              
"**/app/workspace/component/left-panel/left-panel.component.spec.ts",
-              
"**/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts",
-              
"**/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts",
               
"**/app/workspace/component/left-panel/settings/settings.component.spec.ts",
               
"**/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts",
               
"**/app/workspace/component/left-panel/versions-list/versions-list.component.spec.ts",
diff --git 
a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
 
b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
index eb6994c76c..466d0a3db0 100644
--- 
a/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
+++ 
b/frontend/src/app/dashboard/component/admin/execution/admin-execution.component.spec.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { ComponentFixture, inject, TestBed, waitForAsync } from 
"@angular/core/testing";
+import { ComponentFixture, inject, TestBed } from "@angular/core/testing";
 import { AdminExecutionComponent } from "./admin-execution.component";
 import { AdminExecutionService } from 
"../../../service/admin/execution/admin-execution.service";
 import { HttpClientTestingModule, HttpTestingController } from 
"@angular/common/http/testing";
@@ -29,13 +29,12 @@ describe("AdminDashboardComponent", () => {
   let component: AdminExecutionComponent;
   let fixture: ComponentFixture<AdminExecutionComponent>;
 
-  beforeEach(waitForAsync(() => {
-    TestBed.configureTestingModule({
-      declarations: [AdminExecutionComponent],
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
       providers: [AdminExecutionService, ...commonTestProviders],
-      imports: [HttpClientTestingModule, NzDropDownModule, NzModalModule],
+      imports: [AdminExecutionComponent, HttpClientTestingModule, 
NzDropDownModule, NzModalModule],
     }).compileComponents();
-  }));
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(AdminExecutionComponent);
diff --git 
a/frontend/src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts
 
b/frontend/src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts
index 4804afbfdf..ab4744d3cb 100644
--- 
a/frontend/src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts
+++ 
b/frontend/src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts
@@ -28,8 +28,7 @@ describe("AdminSettingsComponent", () => {
 
   beforeEach(async () => {
     await TestBed.configureTestingModule({
-      declarations: [AdminSettingsComponent],
-      imports: [HttpClientTestingModule, NzCardModule],
+      imports: [AdminSettingsComponent, HttpClientTestingModule, NzCardModule],
     }).compileComponents();
   });
 
diff --git 
a/frontend/src/app/dashboard/component/admin/user/admin-user.component.spec.ts 
b/frontend/src/app/dashboard/component/admin/user/admin-user.component.spec.ts
index b689959723..cbdd262cb4 100644
--- 
a/frontend/src/app/dashboard/component/admin/user/admin-user.component.spec.ts
+++ 
b/frontend/src/app/dashboard/component/admin/user/admin-user.component.spec.ts
@@ -18,7 +18,7 @@
  */
 
 import { NO_ERRORS_SCHEMA } from "@angular/core";
-import { ComponentFixture, inject, TestBed, waitForAsync } from 
"@angular/core/testing";
+import { ComponentFixture, inject, TestBed } from "@angular/core/testing";
 import { AdminUserComponent } from "./admin-user.component";
 import { UserService } from "../../../../common/service/user/user.service";
 import { StubUserService } from 
"../../../../common/service/user/stub-user.service";
@@ -33,14 +33,13 @@ describe("AdminUserComponent", () => {
   let component: AdminUserComponent;
   let fixture: ComponentFixture<AdminUserComponent>;
 
-  beforeEach(waitForAsync(() => {
-    TestBed.configureTestingModule({
-      declarations: [AdminUserComponent],
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
       providers: [{ provide: UserService, useClass: StubUserService }, 
AdminUserService, ...commonTestProviders],
-      imports: [FormsModule, HttpClientTestingModule, NzDropDownModule, 
NzModalModule],
+      imports: [AdminUserComponent, FormsModule, HttpClientTestingModule, 
NzDropDownModule, NzModalModule],
       schemas: [NO_ERRORS_SCHEMA],
     }).compileComponents();
-  }));
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(AdminUserComponent);
diff --git 
a/frontend/src/app/workspace/component/left-panel/left-panel.component.spec.ts 
b/frontend/src/app/workspace/component/left-panel/left-panel.component.spec.ts
index 8f49fae005..4de5d4ab01 100644
--- 
a/frontend/src/app/workspace/component/left-panel/left-panel.component.spec.ts
+++ 
b/frontend/src/app/workspace/component/left-panel/left-panel.component.spec.ts
@@ -43,7 +43,7 @@ describe("LeftPanelComponent", () => {
     });
 
     await TestBed.configureTestingModule({
-      imports: [HttpClientTestingModule, RouterTestingModule.withRoutes([])],
+      imports: [LeftPanelComponent, HttpClientTestingModule, 
RouterTestingModule.withRoutes([])],
       providers: [
         {
           provide: OperatorMetadataService,
@@ -51,19 +51,16 @@ describe("LeftPanelComponent", () => {
         },
         ...commonTestProviders,
       ],
-      declarations: [LeftPanelComponent],
       schemas: [NO_ERRORS_SCHEMA],
     }).compileComponents();
   });
 
-  beforeEach(fakeAsync(() => {
+  beforeEach(() => {
     fixture = TestBed.createComponent(LeftPanelComponent);
     component = fixture.componentInstance;
     workflowActionService = TestBed.inject(WorkflowActionService);
     fixture.detectChanges();
-    tick();
-    fixture.detectChanges();
-  }));
+  });
 
   it("should create", () => {
     expect(component).toBeTruthy();
diff --git 
a/frontend/src/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts
 
b/frontend/src/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts
index 585e2fc5df..2cef5f1d20 100644
--- 
a/frontend/src/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts
+++ 
b/frontend/src/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts
@@ -20,7 +20,7 @@
 import { WorkflowUtilService } from 
"../../../../service/workflow-graph/util/workflow-util.service";
 import { JointUIService } from "../../../../service/joint-ui/joint-ui.service";
 import { DragDropService } from 
"../../../../service/drag-drop/drag-drop.service";
-import { ComponentFixture, TestBed, waitForAsync } from 
"@angular/core/testing";
+import { ComponentFixture, TestBed } from "@angular/core/testing";
 import { OperatorLabelComponent } from "./operator-label.component";
 import { OperatorMetadataService } from 
"../../../../service/operator-metadata/operator-metadata.service";
 import { StubOperatorMetadataService } from 
"../../../../service/operator-metadata/stub-operator-metadata.service";
@@ -36,10 +36,9 @@ describe("OperatorLabelComponent", () => {
   let component: OperatorLabelComponent;
   let fixture: ComponentFixture<OperatorLabelComponent>;
 
-  beforeEach(waitForAsync(() => {
-    TestBed.configureTestingModule({
-      declarations: [OperatorLabelComponent],
-      imports: [RouterTestingModule.withRoutes([])],
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      imports: [OperatorLabelComponent, RouterTestingModule.withRoutes([])],
       providers: [
         DragDropService,
         JointUIService,
@@ -53,7 +52,7 @@ describe("OperatorLabelComponent", () => {
         ...commonTestProviders,
       ],
     }).compileComponents();
-  }));
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(OperatorLabelComponent);
diff --git 
a/frontend/src/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts
 
b/frontend/src/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts
index f6682aed4d..da753b0b2b 100644
--- 
a/frontend/src/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts
+++ 
b/frontend/src/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts
@@ -20,7 +20,7 @@
 import { mockScanSourceSchema } from 
"../../../service/operator-metadata/mock-operator-metadata.data";
 import { UndoRedoService } from "../../../service/undo-redo/undo-redo.service";
 import { DragDropService } from "../../../service/drag-drop/drag-drop.service";
-import { ComponentFixture, TestBed, waitForAsync } from 
"@angular/core/testing";
+import { ComponentFixture, TestBed } from "@angular/core/testing";
 import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
 import { OperatorMenuComponent } from "./operator-menu.component";
 import { OperatorLabelComponent } from 
"./operator-label/operator-label.component";
@@ -39,15 +39,14 @@ describe("OperatorPanelComponent", () => {
   let component: OperatorMenuComponent;
   let fixture: ComponentFixture<OperatorMenuComponent>;
 
-  beforeEach(waitForAsync(() => {
+  beforeEach(async () => {
     TestBed.overrideComponent(OperatorMenuComponent, {
       set: {
         template: "",
       },
     });
 
-    TestBed.configureTestingModule({
-      declarations: [OperatorMenuComponent, OperatorLabelComponent],
+    await TestBed.configureTestingModule({
       providers: [
         {
           provide: OperatorMetadataService,
@@ -60,10 +59,17 @@ describe("OperatorPanelComponent", () => {
         JointUIService,
         ...commonTestProviders,
       ],
-      imports: [NzDropDownModule, NzCollapseModule, BrowserAnimationsModule, 
RouterTestingModule.withRoutes([])],
+      imports: [
+        OperatorMenuComponent,
+        OperatorLabelComponent,
+        NzDropDownModule,
+        NzCollapseModule,
+        BrowserAnimationsModule,
+        RouterTestingModule.withRoutes([]),
+      ],
       schemas: [NO_ERRORS_SCHEMA],
     }).compileComponents();
-  }));
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(OperatorMenuComponent);
diff --git a/frontend/src/jsdom-svg-polyfill.ts 
b/frontend/src/jsdom-svg-polyfill.ts
index e037b49459..1bc9a65170 100644
--- a/frontend/src/jsdom-svg-polyfill.ts
+++ b/frontend/src/jsdom-svg-polyfill.ts
@@ -95,6 +95,16 @@ if (SVG_ELEMENT_GLOBAL?.prototype) {
   if (typeof proto.getBBox !== "function") proto.getBBox = fakeRect as AnyFn;
 }
 
+/**
+ * jsdom doesn't implement the legacy `document.queryCommandSupported`,
+ * which monaco-editor probes during initialization. Without it the
+ * editor's setup throws even when no spec actually exercises monaco.
+ */
+const docProto = (globalThis as unknown as { Document?: { prototype: 
Record<string, AnyFn> } }).Document?.prototype;
+if (docProto && typeof docProto.queryCommandSupported !== "function") {
+  docProto.queryCommandSupported = (() => false) as AnyFn;
+}
+
 /**
  * y-websocket schedules a reconnect timer the moment a service that uses
  * collaborative editing is constructed. When that timer fires AFTER vitest
diff --git a/frontend/src/tsconfig.spec.json b/frontend/src/tsconfig.spec.json
index ec826d6ad4..c0d4dddbb1 100644
--- a/frontend/src/tsconfig.spec.json
+++ b/frontend/src/tsconfig.spec.json
@@ -16,42 +16,39 @@
     // these tests assert on. Real fix is Vitest browser mode (#4866).
     "**/drag-drop.service.spec.ts",
 
-    // Component / service specs whose TestBed setups still need to be
-    // adapted to the standalone-component world. The migration sweep
-    // (PR #4862 + PR #4873) made the runtime resolution succeed, but
-    // each TestBed configures `declarations: [...]` plus selective
-    // module imports — that combo no longer matches what the new
-    // builder expects from a standalone-component graph. Tracked as
-    // follow-ups under #4861.
+    // Specs whose body is entirely commented out / placeholder — these
+    // need real test cases written before they can be re-enabled.
     "**/app/common/formly/preset-wrapper/preset-wrapper.component.spec.ts",
-    // user-config.service.spec.ts has its real cases commented out and only
-    // reflective placeholder comments remain — keep it excluded until the
-    // tests are actually rewritten.
     "**/app/common/service/user/config/user-config.service.spec.ts",
-    
"**/app/dashboard/component/admin/execution/admin-execution.component.spec.ts",
-    
"**/app/dashboard/component/admin/settings/admin-settings.component.spec.ts",
-    "**/app/dashboard/component/admin/user/admin-user.component.spec.ts",
-    "**/app/dashboard/component/dashboard.component.spec.ts",
-    
"**/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts",
-    
"**/app/dashboard/component/user/user-workflow/user-workflow-list-item/user-workflow-list-item.component.spec.ts",
-    
"**/app/dashboard/component/user/user-workflow/user-workflow.component.spec.ts",
-    // monaco-editor + jsdom: missing CSS parser, queryCommandSupported, 
ProxyZone for nested fakeAsync.
+    
"**/app/workspace/component/left-panel/settings/settings.component.spec.ts",
+    "**/app/workspace/component/menu/menu.component.spec.ts",
+    "**/app/workspace/component/workspace.component.spec.ts",
+    "**/app/workspace/service/preset/preset.service.spec.ts",
+
+    // Specs that compile but fail at runtime against jsdom's gaps:
+    // monaco-editor needs CSS parsing + queryCommandSupported, jointjs
+    // needs real getScreenCTM, formly+nz fetches icons over HTTP. These
+    // belong under Vitest browser mode (#4866) and aren't an Angular
+    // standalone-migration issue any more.
     
"**/app/workspace/component/code-editor-dialog/code-debugger.component.spec.ts",
     
"**/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts",
-    // monaco-editor CSS parsing fails under jsdom.
     
"**/app/workspace/component/codearea-custom-template/codearea-custom-template.component.spec.ts",
-    "**/app/workspace/component/left-panel/left-panel.component.spec.ts",
-    
"**/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts",
-    
"**/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts",
-    
"**/app/workspace/component/left-panel/settings/settings.component.spec.ts",
+    // time-travel & versions-list pull in `monaco-breakpoints` whose entry 
imports a `.css`
+    // file at runtime; Vitest can't transform that asset and crashes during 
module load.
     
"**/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts",
     
"**/app/workspace/component/left-panel/versions-list/versions-list.component.spec.ts",
-    "**/app/workspace/component/menu/menu.component.spec.ts",
-    // formly + nz registers `snippets-o` icon dynamically over HTTP, which 
jsdom rejects.
     
"**/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.spec.ts",
-    // jointjs paper math relies on real getScreenCTM, which jsdom returns as 
null.
     
"**/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts",
-    "**/app/workspace/component/workspace.component.spec.ts",
-    "**/app/workspace/service/preset/preset.service.spec.ts"
+
+    // Component templates rooted at <nz-list-item>: outside an <nz-list>
+    // host these throw `No provider found for NzListComponent`. Need a
+    // wrapper TestHostComponent that mounts them inside <nz-list>.
+    
"**/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts",
+    
"**/app/dashboard/component/user/user-workflow/user-workflow-list-item/user-workflow-list-item.component.spec.ts",
+    // user-workflow embeds the list-item above, cascading the same NzList 
host issue.
+    
"**/app/dashboard/component/user/user-workflow/user-workflow.component.spec.ts",
+    // Dashboard renders <asl-google-signin-button> which dereferences fields 
on the
+    // SocialAuthService stub that our minimal mock doesn't provide.
+    "**/app/dashboard/component/dashboard.component.spec.ts"
   ]
 }

Reply via email to