From d07d960f0fc0948c6b099dcdeb521f806b374dbe Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 20 Feb 2019 12:52:55 +0100 Subject: [PATCH] Add failing tests for inner scope variable defined verification --- packages/babel-plugin-import-jsx-pragma/test/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-import-jsx-pragma/test/index.js b/packages/babel-plugin-import-jsx-pragma/test/index.js index cc84cabbc9bfab..d70cf2313c540a 100644 --- a/packages/babel-plugin-import-jsx-pragma/test/index.js +++ b/packages/babel-plugin-import-jsx-pragma/test/index.js @@ -71,7 +71,7 @@ describe( 'babel-plugin-import-jsx-pragma', () => { expect( string ).toBe( 'import { createElement } from "@wordpress/element";\n' + original ); } ); - it( 'does nothing if the scope variable is already defined when using custom options', () => { + it( 'does nothing if the outer scope variable is already defined when using custom options', () => { const original = 'const {\n createElement\n} = wp.element;\nlet foo = ;'; const string = getTransformedCode( original, { scopeVariable: 'createElement', @@ -79,4 +79,13 @@ describe( 'babel-plugin-import-jsx-pragma', () => { expect( string ).toBe( original ); } ); + + it( 'does nothing if the inner scope variable is already defined when using custom options', () => { + const original = '(function () {\n const {\n createElement\n } = wp.element;\n let foo = ;\n})();'; + const string = getTransformedCode( original, { + scopeVariable: 'createElement', + } ); + + expect( string ).toBe( original ); + } ); } );