Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework: Run i18n-mixin-to-localize codemod #18590

Merged
merged 7 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix EditorDiscussion test
  • Loading branch information
ockham committed Oct 10, 2017
commit 23bc4aa0bc84d13f65b0f6510eab978afe3765f2
11 changes: 7 additions & 4 deletions client/post-editor/editor-discussion/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @format
*/

import { get, pick } from 'lodash';
import { get, identity, pick } from 'lodash';
import { localize } from 'i18n-calypso';
import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -26,18 +26,19 @@ function statusToBoolean( status ) {
return 'open' === status;
}

export default localize(React.createClass({
displayName: 'EditorDiscussion',
export const EditorDiscussion = React.createClass( {

propTypes: {
isNew: PropTypes.bool,
post: PropTypes.object,
site: PropTypes.object,
translate: PropTypes.func.isRequired,
},

getDefaultProps: function() {
return {
isNew: false,
translate: identity,
};
},

Expand Down Expand Up @@ -130,4 +131,6 @@ export default localize(React.createClass({
</EditorFieldset>
);
},
}));
} );

export default localize( EditorDiscussion );
11 changes: 1 addition & 10 deletions client/post-editor/editor-discussion/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import { expect } from 'chai';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import ReactDom from 'react-dom';
import sinon from 'sinon';

/**
* Internal dependencies
*/
import EditorDiscussion from '../';
import { EditorDiscussion } from '../';
import { edit as editPost } from 'lib/posts/actions';

jest.mock( 'components/info-popover', () => require( 'components/empty-component' ) );
Expand All @@ -38,18 +37,10 @@ const DUMMY_SITE = {
};

describe( 'EditorDiscussion', function() {
before( function() {
EditorDiscussion.prototype.translate = sinon.stub().returnsArg( 0 );
} );

beforeEach( function() {
ReactDom.unmountComponentAtNode( document.body );
} );

after( function() {
delete EditorDiscussion.prototype.translate;
} );

describe( '#getDiscussionSetting()', function() {
it( 'should return an empty object if both post and site are unknown', function() {
var tree = TestUtils.renderIntoDocument( <EditorDiscussion /> );
Expand Down