-
Notifications
You must be signed in to change notification settings - Fork 282
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
Migrate away from reactCreateClass #955
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@julien: this one is ready for review now. |
I'm working on https://issues.liferay.com/browse/IFI-409 and wasn't entirely confident that the Karma tests exercising the related components were actually running. Switching to the karma-verbose-reporter enables you to see what tests are being executed: https://gist.github.com/wincent/55910d693db6d3d72b171406460398de For example, here I can see the richcombo-bridge.jsx tests (corresponding to the first component that I'm porting) running: ``` - RichComboBridge : * should create a rich combo and invoke its initialization methods : ok * should render just the menu button when not expanded : ok * should show a dropdown with the action buttons when expanded : 2 skipped * should execute the onClick method with the item value when clicking on an item : skipped ```
Test run output (same before and after): ``` - MenuButtonBridge : * should create a menu button : ok * should render just the menuButton button when not expanded : ok * should show a dropdown with the menu items that have a valid group when expanded : skipped * should execute the onClick or command methods of the menu items when clicked : skipped ``` Sorry for the whitespace changes in this diff; my editor applied a lot of these automatically. To see the change without whitespace, look at the diff with the `-b` switch to `git`. Related: https://issues.liferay.com/browse/IFI-409
Test output: ``` - ButtonBridge : * should name buttons based on their input params : ok * should create a button with a command in its definition : ok * should create a button with an onClick handler in its definition : ok * should prevent button definitions from overriding existing buttons : ok * should render the button icon with css class or style if it exists in ckeditor : ok ``` Just like the previous commit. Only difference is the `_handleClick` callback needs to access `this` but it is not autobound by default, so turn it into an arrow function member on the instance. Related: https://issues.liferay.com/browse/IFI-409
This is much like the preceding commits in this PR, but not we had to move the `getInitialState()` logic into the constructor to avoid this warning: ``` Warning: getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead? ``` Test output: ``` - RichComboBridge : * should create a rich combo and invoke its initialization methods : ok * should render just the menu button when not expanded : ok * should show a dropdown with the action buttons when expanded : 2 skipped * should execute the onClick method with the item value when clicking on an item : skipped ``` Related: https://issues.liferay.com/browse/IFI-409
Test output: ``` - PanelMenuButtonBridge : * should create a panel menu button : ok * should render just the menu button when not expanded : ok * should show a dropdown with the panel css class and panel contents when expanded : skipped ``` Related: https://issues.liferay.com/browse/IFI-409
Rebased on top of current "2.x-develop". |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For: https://issues.liferay.com/browse/IFI-409
This PR ports us away from the four places where we're using
createReactClass
.