Skip to content

Commit

Permalink
Test: Add test which verifies wheter JSX pragma detects WP global
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 28, 2019
1 parent a5a5b48 commit d4bc06b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/babel-plugin-import-jsx-pragma/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ describe( 'babel-plugin-import-jsx-pragma', () => {

expect( string ).toBe( 'import { createElement } from "@wordpress/element";\nlet foo = <bar />;' );
} );

it( 'does nothing if there scope variable already defined when using custom options', () => {
const original = 'const { createElement } = wp.element;\nlet foo = <bar />;';
const string = getTransformedCode( original, {
scopeVariable: 'createElement',
source: '@wordpress/element',
isDefault: false,
} );

expect( string ).toBe( original );
} );
} );

0 comments on commit d4bc06b

Please sign in to comment.