Skip to content

Commit

Permalink
fix for issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
madushan1000 committed Nov 3, 2016
1 parent 93447ab commit 3662969
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default function ({types: t}) {
if(!isReactComponentClass(path)) {
return;
}
if(!path.node.id){
return;
}
const className = path.node.id.name;

if(!isExported(path, className, t)){
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/case9/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, {component} from 'react';

export default function Modal (component) {
return class extends component {
constructor (...args) {
super(...args) ;
}

render() {
return <div></div>;
}

}
}
48 changes: 48 additions & 0 deletions test/fixtures/case9/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.default = Modal;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function Modal(component) {
return function (_component) {
_inherits(_class, _component);

function _class() {
var _ref;

_classCallCheck(this, _class);

for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

return _possibleConstructorReturn(this, (_ref = _class.__proto__ || Object.getPrototypeOf(_class)).call.apply(_ref, [this].concat(args)));
}

_createClass(_class, [{
key: 'render',
value: function render() {
return _react2.default.createElement('div', null);
}
}]);

return _class;
}(component);
}

0 comments on commit 3662969

Please sign in to comment.