-
Notifications
You must be signed in to change notification settings - Fork 85
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: inflate functions passed to __callXXXFunction methods #5080
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, also tested that it works with the IT added to the Flow component 👍
Added one small comment regarding a new test.
Also target labels for cherry-picking should be set.
expect(config.tooltip.formatter).to.be.a('function'); | ||
expect(config.tooltip).to.not.have.property('_fn_formatter'); | ||
}); | ||
|
||
it('should not try to inflate if a non-object value is passed', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious how it is actually testing that, I guess by checking that there are no errors? Should we reflect that in the test name or in a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored the test to spy on Object.entries
. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so sure about it, since it relies on implementation details of the function, which can change. I don't have any better suggestions for improving the test procedure, apart from just adding a clarifying comment to your original version.
If we want to go with the spy, it should be reset afterwards since it is applied on a global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you are right about the spy usage. Restored the previous version and added a comment about the test.
Also removed the fixture, since it's not needed for that portion of the tests.
This reverts commit 3572b6f.
SonarCloud Quality Gate failed.
|
…5086) Co-authored-by: Diego Cardoso <[email protected]>
…P: 23.3) (#5085) Co-authored-by: Diego Cardoso <[email protected]>
This ticket/PR has been released with Vaadin 24.0.0.alpha6 and is also targeting the upcoming stable 24.0.0 version. |
Description
Make the objects passed to the
__callXXXFunction
method go through the same "inflate" process done with the configuration object sent from the server. That is needed because objects containing properties with the_fn_
format might be passed to these functions.Some refactoring done in the process:
__inflateFunctions
method to a helper file to make it easier to be used by both instance and static methodsinflateFunctions
to make the logic to be performed only on plain objects (avoiding primitives/null
/undefined
and HighCharts instances that may contain circular reference)Part of vaadin/flow-components#3867
Type of change