Skip to content

Commit

Permalink
Fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown committed Nov 8, 2019
1 parent c05d09b commit dcc98dd
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/babel-plugin-emotion/src/index.js
Expand Up @@ -148,6 +148,7 @@ export default function(babel: *) {
export: string,
cssExport: string | null
}> = [{ specifier: '@emotion/core', export: 'jsx', cssExport: 'css' }]
state.jsxCoreImport = jsxCoreImports[0]
Object.keys(state.opts.importMap || {}).forEach(specifierName => {
let value = state.opts.importMap[specifierName]
let transformers = {}
Expand Down
@@ -0,0 +1,3 @@
import * as React from 'react'

const Component = props => <div css={[{ color: 'green' }]} {...props} />
@@ -1,5 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`@emotion/babel-preset-css-prop array-css-prop 1`] = `
"import * as React from 'react'
const Component = props => <div css={[{ color: 'green' }]} {...props} />
↓ ↓ ↓ ↓ ↓ ↓
import { css as _css } from \\"@emotion/core\\";
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from 'react';
import { jsx as ___EmotionJSX } from \\"@emotion/core\\";
const Component = props => ___EmotionJSX(\\"div\\", _extends({
css:
/*#__PURE__*/
_css([{
color: 'green'
}], \\";label:Component;\\" + (process.env.NODE_ENV === \\"production\\" ? \\"\\" : \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFycmF5LWNzcy1wcm9wLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVnQyIsImZpbGUiOiJhcnJheS1jc3MtcHJvcC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuXG5jb25zdCBDb21wb25lbnQgPSBwcm9wcyA9PiA8ZGl2IGNzcz17W3sgY29sb3I6ICdncmVlbicgfV19IHsuLi5wcm9wc30gLz5cbiJdfQ== */\\"))
}, props));"
`;

exports[`@emotion/babel-preset-css-prop index 1`] = `
"import * as React from 'react'
Expand Down
@@ -1,5 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`options are used array-css-prop 1`] = `
"import * as React from 'react'
const Component = props => <div css={[{ color: 'green' }]} {...props} />
↓ ↓ ↓ ↓ ↓ ↓
import { css as _css } from \\"@emotion/core\\";
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from 'react';
import { jsx as ___EmotionJSX } from \\"@emotion/core\\";
const Component = props => ___EmotionJSX(\\"div\\", _extends({
css:
/*#__PURE__*/
_css([{
color: 'green'
}], \\";label:__fixtures__--array-css-prop--Component;\\")
}, props));"
`;

exports[`options are used index 1`] = `
"import * as React from 'react'
Expand Down

0 comments on commit dcc98dd

Please sign in to comment.