Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: legend size, use offset height and width #4307

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Conversation

ckifer
Copy link
Member

@ckifer ckifer commented Mar 18, 2024

Description

Same PR as
#4272
but for 3.x

  • use offset height and width for legend bounding box to prevent scaling issues

Related Issue

#4246

Motivation and Context

#4246

How Has This Been Tested?

  • storybook visually
  • uni test

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or extended an existing story to show my changes

@@ -771,13 +790,13 @@ describe('<Legend />', () => {
animationDuration: 1500,
animationEasing: 'ease',
animationId: 0,
bottom: 5,
bottom: 65,
Copy link
Member Author

Choose a reason for hiding this comment

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

unsure why all of these changed to be honest...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it because the cleanup function from mockHTMLElementProperty is never called? Best to do that in afterEach. Check out the restoreGetBoundingClientRect and how it's used.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed, oops.

So in an afterEach doesn't work well unless we want to make the mock specific for offsetHeight and offsetWidth. I tried restoring the entire HTMLElement.prototype but that didn't seem to work.

I'm sure there's a better way but not enough time to get there at least atm :P

@ckifer
Copy link
Member Author

ckifer commented Mar 18, 2024

@zhonglin94 fyi

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.73%. Comparing base (408f050) to head (a75a81b).
Report is 3 commits behind head on 3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.x    #4307      +/-   ##
==========================================
+ Coverage   94.68%   94.73%   +0.04%     
==========================================
  Files          92       92              
  Lines       20114    20116       +2     
  Branches     2810     2809       -1     
==========================================
+ Hits        19045    19056      +11     
+ Misses       1063     1054       -9     
  Partials        6        6              

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

@@ -771,13 +790,13 @@ describe('<Legend />', () => {
animationDuration: 1500,
animationEasing: 'ease',
animationId: 0,
bottom: 5,
bottom: 65,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it because the cleanup function from mockHTMLElementProperty is never called? Best to do that in afterEach. Check out the restoreGetBoundingClientRect and how it's used.

@ckifer ckifer merged commit 9cc14a9 into 3.x Mar 20, 2024
11 checks passed
@ckifer ckifer deleted the fix/legend-size3.x branch March 20, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants