jest.autoMockOff(); import { renameUnsafeAllowUndoRedoButtonsProp } from '../migrates/rename-unsafe-allowUndoRedoButtons-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', [ renameUnsafeAllowUndoRedoButtonsProp, ]); describe('Rename UNSAFE_allowUndoRedoButtons to allowUndoRedoButtons', () => { defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- 'rename nothing if UNSAFE_allowUndoRedoButtons prop not set', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- 'rename nothing if boolean prop', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- 'rename nothing if UNSAFE_allowUndoRedoButtons not found', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- ` import React from 'react'; import { Editor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- 'rename UNSAFE_allowUndoRedoButtons to allowUndoRedoButtons and do not change other options', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; import { Editor as AKEditor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- ` import React from 'react'; import { Editor as AKEditor } from '@atlaskit/editor-core'; export default () => ( ); `, // ----- 'rename UNSAFE_allowUndoRedoButtons to allowUndoRedoButtons when Editor is renamed', ); defineInlineTest( { default: transformer, parser: 'tsx' }, {}, ` import React from 'react'; const Editor = (props) => {
{props.children}
}; export default () => ( ); `, // ----- ` import React from 'react'; const Editor = (props) => {
{props.children}
}; export default () => ( ); `, // ----- 'rename nothing if UNSAFE_allowUndoRedoButtons for Editor is not from @atlaskit/editor-core', ); });