-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
feat: getTech now accepts TitleCase
or camelCase
#4010
Conversation
* update techOptions to look for `TitleCase`/`camelCase` options * remove all possible `toTitleCase` calls from player.js * remove deprecated usage of Tech as Component * add a unit test to verify that registerTech works * change defaultTech_ to defaultTechOrder_
@@ -840,6 +843,8 @@ class Player extends Component { | |||
techOptions[props.getterName] = this[props.privateName]; | |||
}); | |||
|
|||
assign(techOptions, this.options_[titleTechName]); |
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.
does assign
handle undefineds?
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.
Going to add some unit tests to assign to find out, will open another PR with those
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.
See #4014 for tests, seems that undefined
/null
/empty
will do nothing to an existing object
// Support old behavior of techs being registered as components. | ||
// Remove once that deprecated behavior is removed. | ||
if (!TechComponent) { | ||
TechComponent = Component.getComponent(techName); |
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.
I guess we should throw an error in this case?
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.
I will improve the error handing here
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.
I don't know if we show check getComponent
at all. I think we should just throw an error if TechComponent
/TechClass
does not exist. We could check getComponent
here but I think that we should be able to have a Tech and a Component with the same name (as weird as that would be)
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, I meant to just throw if TechClass
isn't available. We shouldn't try to call getComponent
anymore.
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.
Done
dabd942
to
ebd909e
Compare
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.
This looks good to me.
ebd909e
to
0049ea2
Compare
Description
getTech
now works withTitleCase
andcamelCase
tech namesFixes #3986
Specific Changes proposed
TitleCase
/camelCase
optionstoTitleCase
calls from player.jsRequirements Checklist