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

feat: getTech now accepts TitleCase or camelCase #4010

Merged
merged 3 commits into from
Feb 2, 2017

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Feb 1, 2017

Description

getTech now works with TitleCase and camelCase tech names

Fixes #3986

Specific Changes proposed

  • 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_

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
  • Reviewed by Two Core Contributors

* 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]);
Copy link
Member

Choose a reason for hiding this comment

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

does assign handle undefineds?

Copy link
Contributor Author

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

Copy link
Contributor Author

@brandonocasey brandonocasey Feb 1, 2017

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);
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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)

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@brandonocasey brandonocasey force-pushed the feat/title-case-get-tech branch from dabd942 to ebd909e Compare February 1, 2017 21:29
Copy link
Member

@misteroneill misteroneill left a 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.

@brandonocasey brandonocasey force-pushed the feat/title-case-get-tech branch from ebd909e to 0049ea2 Compare February 2, 2017 17:51
@brandonocasey brandonocasey merged commit a8f2e43 into master Feb 2, 2017
@gkatsev gkatsev deleted the feat/title-case-get-tech branch February 2, 2017 19:41
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.

Make TechOrder accept camelCase and TitleCase tech names
3 participants