You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "mengw15 (via GitHub)" <gi...@apache.org> on 2026/08/06 23:48:24 UTC

[PR] test(frontend): cover LeftPanelComponent template tab rendering and interactions [texera]

mengw15 opened a new pull request, #7367:
URL: https://github.com/apache/texera/pull/7367

   ### What changes were proposed in this PR?
   
   Extends `LeftPanelComponent`'s spec to render the panel's tab lists and exercise
   their bindings. The class file is already at 100%, but the existing tests call
   the handlers directly and never render/click the tabs, so
   `left-panel.component.html` sat at ~41%.
   
   9 added tests render both the collapsed dock and the expanded panel, then drive
   each interactive element via `fixture.debugElement.query(By.css(...))` +
   `.triggerEventHandler(...)`:
   
   - Collapsed dock (`#docked-buttons`): clicking a tab re-opens that frame; only the enabled tabs render (disabled ones are omitted); the `width && !isDocked` minus button collapses the panel.
   - Expanded dock (`#dock`): clicking a tab switches frames; the `isDocked` minus collapses.
   - Return bar (`#return-button`): the reset button re-docks to the return position; its minus collapses.
   - Container events: the three menu lists' `(cdkDropListDropped)` reorder `order`, and the left container's `(cdkDragStarted)` / `(nzResize)` update the docked/size state.
   
   This lifts `left-panel.component.html` from ~41% to **100%** (statements and
   branches); the class stays at 100%.
   
   **Determinism (per the issue's constraint):** no `vi.useFakeTimers()` — the
   `setTimeout` `ngAfterViewInit` queues never runs in a synchronous test body, and
   layering fake timers over zone.js's patched timers is Node-version dependent. No
   `getBoundingClientRect`/offset assertions either — the tests assert the rendered
   tabs and the active-frame/width state, not measured heights. Tabs are located by
   the CDK `cdk-drag` class (the `nz-tooltip` attribute is consumed by the directive
   and not present in the DOM). No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7363
   
   ### How was this PR tested?
   
   Extended unit tests, run locally in `frontend/`:
   
   ```
   ng test --watch=false --include src/app/workspace/component/left-panel/left-panel.component.spec.ts
   # Test Files 1 passed (1) | Tests 28 passed (28)   — 3 consecutive runs, 0 flakes
   # left-panel.component.html: ~41% -> 100% (statements & branches)
   prettier --write <spec>   # unchanged
   eslint  <spec>            # clean
   ```
   
   The failure path was verified by deliberately breaking a new assertion and
   confirming the suite exits non-zero. (Locally on Node 26 the component's
   `localStorage` reads need `NODE_OPTIONS=--localstorage-file=...`; CI runs Node 24
   where jsdom's `localStorage` is present, so no polyfill is added to the spec.)
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover LeftPanelComponent template tab rendering and interactions [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7367:
URL: https://github.com/apache/texera/pull/7367#issuecomment-5210215875

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7367?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 83.78%. Comparing base ([`cc83087`](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`58b6b2d`](https://app.codecov.io/gh/apache/texera/commit/58b6b2de8ba92fb07379b70aac977e1d0c589168?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #7367      +/-   ##
   ============================================
   + Coverage     83.72%   83.78%   +0.06%     
     Complexity     4137     4137              
   ============================================
     Files          1169     1169              
     Lines         46520    46520              
     Branches       5179     5179              
   ============================================
   + Hits          38947    38979      +32     
   + Misses         5860     5828      -32     
     Partials       1713     1713              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.65% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.66% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.72% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.97% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.05% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.87% <ø> (+0.15%)` | :arrow_up: | |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.89% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.36% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.31% <ø> (ø)` | | Carriedforward from [cc83087](https://app.codecov.io/gh/apache/texera/commit/cc8308740361324f7f129657dad6dc395abeeb1c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7367?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover LeftPanelComponent template tab rendering and interactions [texera]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7367:
URL: https://github.com/apache/texera/pull/7367#discussion_r3732535285


##########
frontend/src/app/workspace/component/left-panel/left-panel.component.spec.ts:
##########
@@ -315,6 +317,141 @@ describe("LeftPanelComponent", () => {
     freshFixture.destroy();
   });
 
+  // ── Rendered template: tab lists + their (click)/event bindings ──
+  describe("template tab rendering & interactions", () => {
+    // Draggable tabs render with the CDK `cdk-drag` class; the collapse "minus"
+    // button does not. Enabled tabs render in `order` sequence, so the frame's
+    // list position is its index among the currently-enabled frames.
+    const tabForFrame = (containerId: string, frame: number): DebugElement | undefined => {
+      const tabs = fixture.debugElement.queryAll(By.css(`#${containerId} li[nz-menu-item].cdk-drag`));
+      const pos = component.order.filter(i => component.items[i].enabled).indexOf(frame);
+      return pos >= 0 ? tabs[pos] : undefined;
+    };
+    const minusOf = (containerId: string): DebugElement | null =>
+      fixture.debugElement.query(By.css(`#${containerId} li[nz-menu-item]:not(.cdk-drag)`));
+
+    it("clicking a tab in the collapsed dock opens that frame", () => {
+      // default state is collapsed (width 0) -> #docked-buttons shows the enabled tabs
+      const versionsTab = tabForFrame("docked-buttons", 2);
+      expect(versionsTab).toBeTruthy();
+
+      versionsTab!.triggerEventHandler("click", null);
+
+      expect(component.currentIndex).toBe(2);
+      expect(component.width).toBe(230); // collapsed -> re-opened
+    });

Review Comment:
   These assertions assume the panel starts collapsed (width = 0), but the component constructor opens a frame by default and leaves `width` at `MIN_PANEL_WIDTH` (230). Without explicitly collapsing + running change detection, `#docked-buttons` won’t render the draggable tabs (`*ngIf="... && !width"`), so this test will be brittle/incorrect.
   
   This issue also appears on line 344 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover LeftPanelComponent template tab rendering and interactions [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #7367:
URL: https://github.com/apache/texera/pull/7367


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover LeftPanelComponent template tab rendering and interactions [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7367:
URL: https://github.com/apache/texera/pull/7367#issuecomment-5210123280

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - **Contributors with relevant context:** `@aglinxinyuan`
     You can notify them by mentioning `@aglinxinyuan` in a comment.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org