-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(emotion): Port label tests and fix label generation (#245)
Apologies for the large PR. This PR addresses a number of issues with label generation when attempting to find a label for `[Local]`. All behaviour and code generation has been tested between the original babel implementation and this plugin for consistency. ## Added - All of the relevant fixtures from `@emotion` have been ported to this repository, which exposed a number of label issues. - Source: https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin/__tests__/css-macro/__fixtures__ - Lives under `fixture/labels/emotion-js` - All fixtures brought over contain links to their original implementation, but have been extended in some cases (mainly the class based tests). ## Changed - Moved `label` related tests under a `label` folder in fixtures. - New structure: `fixture/labels/*` ## Fixed - Spaces in names now collapsed to singular hyphens. - Labels that are unable to find a context emit an empty string instead of `[Local]` - The following fixes have been made to align with the current `@emotion/babel-plugin` behaviour: - Functions on classes now emit their class name as the label. - Calls outside of an assignment (i.e. global scoped called to `css()` do not emit a label. - Keys on objects are now used as labels instead of the parent variable assignment. (Fixes #180) - Functions that return calls to `css` now use the function name as the label. (Fixes #180) - Named function expressions on variable assignments now use the correct label. - String keys on objects now generate the expected label. - Class methods use the class name for the label. (Upstream behaviour, weirdly). - Class members use the member name for the label. - Computed properties should not generate a label.
- Loading branch information
Showing
113 changed files
with
757 additions
and
93 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
Oops, something went wrong.