jest.autoMockOff(); import { removeConfigPanelWidthProp } from '../migrates/remove-config-panel-width-prop'; import { createTransformer } from '../utils'; // This stays as require() since changing to import will trigger a linter error // Ignored via go/ees005 // eslint-disable-next-line import/no-commonjs const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest; const transformer = createTransformer('@atlaskit/editor-core', [removeConfigPanelWidthProp]); describe('Remove ContextPanel "width" prop', () => { defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { ContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- ` import React from 'react'; import { ContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- 'remove if width prop is set', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { ContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- ` import React from 'react'; import { ContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- 'remove nothing if width prop not set', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { ContextPanel as AKContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- ` import React from 'react'; import { ContextPanel as AKContextPanel } from '@atlaskit/editor-core'; export default () => ( Hi ); `, // ----- 'remove width prop when ContextPanel is renamed', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; const ContextPanel = (props) => {
{props.children}
}; export default () => ( Hi ); `, // ----- ` import React from 'react'; const ContextPanel = (props) => {
{props.children}
}; export default () => ( Hi ); `, // ----- 'only remove width for ContextPanel from @atlaskit/editor-core', ); });