import { transformSync } from '@babel/core' ; import babelPlugin from '../../index' ; const transform = ( code ) => { return transformSync ( code , { configFile : false , babelrc : false , plugins : [ babelPlugin ] , } ) ?. code ; } ; describe ( 'local jsx namespace' , ( ) => { it ( 'should transform css prop using jsx import source' , ( ) => { const actual = transform ( `
      /** @jsxImportSource @compiled/react */

      <div css={{ color: 'red' }}>hello</div>;
    ` ) ; expect ( actual ) . toMatchInlineSnapshot ( `
      "/* File generated by @compiled/babel-plugin v0.0.0 */

      import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
      const _ = \\"._syaz5scu{color:red}\\";

      /** @jsxImportSource @compiled/react */
      <CC>
          <CS>{[_]}</CS>
          {<div className={ax([\\"_syaz5scu\\"])}>hello</div>}
        </CC>;"
    ` ) ; } ) ; it ( 'should transform css prop using jsx pragma' , ( ) => { const actual = transform ( `
      /** @jsxRuntime classic */
      /** @jsx jsx */
      import { jsx } from '@compiled/react';

      <div css={{ color: 'red' }}>hello</div>;
    ` ) ; expect ( actual ) . toMatchInlineSnapshot ( `
      "/* File generated by @compiled/babel-plugin v0.0.0 */

      import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";

      /** @jsxRuntime classic */

      /** @jsx jsx */
      import { jsx } from '@compiled/react';
      const _ = \\"._syaz5scu{color:red}\\";
      <CC>
          <CS>{[_]}</CS>
          {<div className={ax([\\"_syaz5scu\\"])}>hello</div>}
        </CC>;"
    ` ) ; } ) ; } ) ;