diff --git a/vendor/fbtransform/transforms/__tests__/react-displayName-test.js b/vendor/fbtransform/transforms/__tests__/react-displayName-test.js index 6cdb1d4d6d..648e41f59e 100644 --- a/vendor/fbtransform/transforms/__tests__/react-displayName-test.js +++ b/vendor/fbtransform/transforms/__tests__/react-displayName-test.js @@ -1,5 +1,17 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright 2013-2014 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * * @emails jeffmo@fb.com */ diff --git a/vendor/fbtransform/transforms/__tests__/reactDisplayName-test.js b/vendor/fbtransform/transforms/__tests__/reactDisplayName-test.js deleted file mode 100644 index f833f268e8..0000000000 --- a/vendor/fbtransform/transforms/__tests__/reactDisplayName-test.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @emails javascript@lists.facebook.com - */ -"use strict"; - -require('mock-modules').autoMockOff(); - -var transformAll = require('../../syntax.js').transformAll; - -function transform(source) { - return transformAll(source, {}, ['allocate']); -} - -describe('react displayName jsx', function() { - - it('should only inject displayName if missing', function() { - var code = [ - '/** @jsx React.DOM */', - '"use strict";', - 'var Whateva = React.createClass({', - ' displayName: \'Whateva\',', - ' render: function() {', - ' return
...whateva.
;', - ' }', - '});' - ].join('\n'); - - var result = [ - '/** @jsx React.DOM */', - '"use strict";', - 'var Whateva = React.createClass({', - ' displayName: \'Whateva\',', - ' render: function() {', - ' return React.DOM.div({className: "whateva"}, "...whateva.");', - ' }', - '});' - ].join('\n'); - - expect(transform(code).code).toEqual(result); - }); - - it('should inject displayName in simple assignment', () => { - var code = [ - '/** @jsx React.DOM */', - 'var Component = React.createClass({', - ' render: function() {', - ' return
;', - ' }', - '});' - ].join('\n'); - - var result = [ - '/** @jsx React.DOM */', - 'var Component = React.createClass({displayName: \'Component\',', - ' render: function() {', - ' return React.DOM.div(null);', - ' }', - '});' - ].join('\n'); - - expect(transform(code).code).toEqual(result); - }); - - it('should inject displayName in simple assignment without var', () => { - var code = [ - '/** @jsx React.DOM */', - 'var Component;', - 'Component = React.createClass({', - ' render: function() {', - ' return
;', - ' }', - '});' - ].join('\n'); - - var result = [ - '/** @jsx React.DOM */', - 'var Component;', - 'Component = React.createClass({displayName: \'Component\',', - ' render: function() {', - ' return React.DOM.div(null);', - ' }', - '});' - ].join('\n'); - - expect(transform(code).code).toEqual(result); - }); - - it('should inject displayName in property assignment', () => { - var code = [ - '/** @jsx React.DOM */', - 'exports.Component = React.createClass({', - ' render: function() {', - ' return
;', - ' }', - '});' - ].join('\n'); - - var result = [ - '/** @jsx React.DOM */', - 'exports.Component = React.createClass({displayName: \'Component\',', - ' render: function() {', - ' return React.DOM.div(null);', - ' }', - '});' - ].join('\n'); - - expect(transform(code).code).toEqual(result); - }); - - it('should inject displayName in object declaration', () => { - var code = [ - '/** @jsx React.DOM */', - 'exports = {', - ' Component: React.createClass({', - ' render: function() {', - ' return
;', - ' }', - ' })', - '};' - ].join('\n'); - - var result = [ - '/** @jsx React.DOM */', - 'exports = {', - ' Component: React.createClass({displayName: \'Component\',', - ' render: function() {', - ' return React.DOM.div(null);', - ' }', - ' })', - '};' - ].join('\n'); - - expect(transform(code).code).toEqual(result); - }); - -});