Skip to content

test(frontend): add unit test coverage for calculateTotalTranslate3d#6403

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
PG1204:test/calculateTotalTranslate3d
Jul 15, 2026
Merged

test(frontend): add unit test coverage for calculateTotalTranslate3d#6403
aglinxinyuan merged 2 commits into
apache:mainfrom
PG1204:test/calculateTotalTranslate3d

Conversation

@PG1204

@PG1204 PG1204 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Adds unit test coverage for the calculateTotalTranslate3d function in frontend/src/app/common/util/panel-dock.ts, which was previously untested. This is a pure function that parses one or more CSS translate3d(...) fragments from a string and returns the component-wise sum of their x/y/z offsets.

A new spec file, frontend/src/app/common/util/panel-dock.spec.ts, was created following the testing style of size-formatter.util.spec.ts. It covers:

  • Parsing a single translate3d(...) fragment
  • Summing multiple concatenated fragments component-wise
  • Decimal pixel values
  • Negative pixel values
  • Returning [0, 0, 0] when no translate3d(...) pattern is present
  • A fragment missing px units, which does not match the parser and contributes [0, 0, 0]

Any related issues, documentation, discussions?

Closes #6255

How was this PR tested?

Added 6 unit tests in the new spec file, all passing via ng test:
cd frontend && npx ng test --watch=false --include='**/panel-dock.spec.ts'
src/app/common/util/panel-dock.spec.ts (6 tests) 3ms
Test Files - 1, passed (1)
Tests - 6, passed (6)

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@PG1204

PG1204 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @aglinxinyuan

@github-actions github-actions Bot requested a review from aglinxinyuan July 14, 2026 05:13
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.81%. Comparing base (0485d02) to head (59551ab).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6403      +/-   ##
============================================
- Coverage     69.83%   69.81%   -0.02%     
  Complexity     3380     3380              
============================================
  Files          1142     1142              
  Lines         44838    44838              
  Branches       4949     4949              
============================================
- Hits          31311    31303       -8     
- Misses        11869    11875       +6     
- Partials       1658     1660       +2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 0485d02
agent-service 76.76% <ø> (ø) Carriedforward from 0485d02
amber 66.65% <ø> (ø) Carriedforward from 0485d02
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from 0485d02
config-service 52.30% <ø> (ø) Carriedforward from 0485d02
file-service 63.97% <ø> (ø) Carriedforward from 0485d02
frontend 68.14% <ø> (-0.04%) ⬇️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 0485d02
pyamber 91.18% <ø> (ø) Carriedforward from 0485d02
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 0485d02

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aglinxinyuan aglinxinyuan requested a review from Copilot July 15, 2026 00:44

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds frontend unit tests to cover the existing calculateTotalTranslate3d utility (a pure parsing/summing helper) without changing production behavior.

Changes:

  • Introduced a new spec file to test parsing/summing behavior for translate3d(...) fragments.
  • Added coverage for decimals, negatives, multiple fragments, and “no match” / “invalid fragment” cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Merged via the queue into apache:main with commit 36b3687 Jul 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for calculateTotalTranslate3d

4 participants