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

Automatically populate data properties with passed parameters when onMount() isn't defined #132

Merged

Conversation

mrigsby
Copy link
Contributor

@mrigsby mrigsby commented Oct 25, 2023

Building on box products' love of conventions, if onMount() does not exist, we check that each parameter is a string, boolean, numeric, date, array, or struct and if they are we populate the component using scope population instead of setters.

#131

Copy link
Collaborator

@grantcopley grantcopley left a comment

Choose a reason for hiding this comment

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

@mrigsby Looks good! Would you be up for adding two tests for this commit, one that asserts the MissingOnMount exception and one that asserts that the data properties are actually set? If so, you can run the tests under http://localhost:60299/tests/ and the test needs to be added to test-harness/tests/specs/CBWIRESpec.cfc. You will see numerous examples and it's pretty straightforward integration testing. And if not, no worries, I can add it but it will probably be later this week.

@mrigsby
Copy link
Contributor Author

mrigsby commented Oct 25, 2023

Absolutely! Can do. I don't do enough testing... I gotta work on that!

@mrigsby
Copy link
Contributor Author

mrigsby commented Oct 25, 2023

I created a few tests, more than two. In the process of testing I figured out that isStruct() returns true for a CFML component so I added the check for isObject() as well as isCustomFunction() while I was at it.

@grantcopley grantcopley changed the title Modify handling of missing onMount function Automatically populate data properties with passed parameters when onMount() isn't defined Oct 25, 2023
Copy link
Collaborator

@grantcopley grantcopley left a comment

Choose a reason for hiding this comment

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

Great work @mrigsby ! Merging 🚀

Thank you!

@grantcopley grantcopley merged commit 26a9332 into coldbox-modules:development Oct 25, 2023
3 of 4 checks passed
@mrigsby
Copy link
Contributor Author

mrigsby commented Oct 25, 2023

@grantcopley No problem at all. Thank you for all your hard work on cbwire, it's great. Glad I can contribute.

@grantcopley
Copy link
Collaborator

@mrigsby Released in CBWIRE 3.2. https://www.ortussolutions.com/blog/cbwire-32-released

Thank you for your contributions!

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.

2 participants