-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support module #422 * chore: update version * test: change test files * chore: file lint * chore: code lint * chore: updaate version 1.0.0 Co-authored-by: boiawang <zhengwang.z@alibaba-inc.com>
- Loading branch information
Showing
4 changed files
with
67 additions
and
24 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
packages/babel-plugin-transform-jsx-stylesheet/src/__tests__/module.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import syntaxJSX from 'babel-plugin-syntax-jsx'; | ||
import { transform } from 'babel-core'; | ||
import jSXStylePlugin from '../index'; | ||
|
||
export default function getTransformCode(code, opts) { | ||
return transform(code, { | ||
plugins: [ | ||
[jSXStylePlugin, opts], | ||
syntaxJSX | ||
] | ||
}).code; | ||
} | ||
|
||
describe('css module', () => { | ||
it('should transform css module', () => { | ||
expect(getTransformCode(` | ||
import { createElement, render } from 'rax'; | ||
import styles from './app.css'; | ||
render(<div className={styles.header} />); | ||
`)).toBe(` | ||
import { createElement, render } from 'rax'; | ||
import styles from './app.css'; | ||
render(<div style={styles.header} />);`); | ||
}); | ||
}); |
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