summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/.gitkeep0
-rw-r--r--lib/TextareaAutosize.js25
-rw-r--r--lib/__tests__/Rating-test.js30
-rw-r--r--lib/index.js12
4 files changed, 24 insertions, 43 deletions
diff --git a/lib/.gitkeep b/lib/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/.gitkeep
diff --git a/lib/TextareaAutosize.js b/lib/TextareaAutosize.js
index f4ab8ff..07d447b 100644
--- a/lib/TextareaAutosize.js
+++ b/lib/TextareaAutosize.js
@@ -1,38 +1,41 @@
'use strict';
-const React = require('react'),
- autosize = require('autosize');
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-const TextareaAutosize = React.createClass({
+var React = require('react'),
+ autosize = require('autosize');
+
+var TextareaAutosize = React.createClass({
+ displayName: 'TextareaAutosize',
propTypes: {
onResize: React.PropTypes.func
},
- getDefaultProps() {
+ getDefaultProps: function getDefaultProps() {
return {
rows: 1
};
},
- componentDidMount() {
+ componentDidMount: function componentDidMount() {
autosize(this.refs.textarea.getDOMNode());
if (this.props.onResize) {
this.refs.textarea.getDOMNode().addEventListener('autosize:resized', this.props.onResize);
}
},
- componentWillUnmount() {
+ componentWillUnmount: function componentWillUnmount() {
if (this.props.onResize) {
this.refs.textarea.getDOMNode().removeEventListener('autosize:resized');
}
},
- render() {
- return (
- <textarea {...this.props} ref='textarea'>
- {this.props.children}
- </textarea>
+ render: function render() {
+ return React.createElement(
+ 'textarea',
+ _extends({}, this.props, { ref: 'textarea' }),
+ this.props.children
);
}
diff --git a/lib/__tests__/Rating-test.js b/lib/__tests__/Rating-test.js
deleted file mode 100644
index 75734cc..0000000
--- a/lib/__tests__/Rating-test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-var React = require('react/addons');
-var TestUtils = React.addons.TestUtils;
-var expect = require('expect');
-var {Rating, RatingIcon} = require('../');
-
-describe('Rating', function() {
-
- it('should render 5 RatingIcons as default', function() {
- var ratingWrapper = TestUtils.renderIntoDocument(
- <div>
- <Rating onRate={() => {}} />
- </div>
- );
-
- var ratingIcons = TestUtils.scryRenderedComponentsWithType(ratingWrapper, RatingIcon);
- expect(ratingIcons.length).toBe(5, 'Rating is not rendering 5 icons as default');
- });
-
- it('should render 3 RatingIcons', function() {
- var ratingWrapper = TestUtils.renderIntoDocument(
- <div>
- <Rating onRate={() => {}} maxRating={3} />
- </div>
- );
-
- var ratingIcons = TestUtils.scryRenderedComponentsWithType(ratingWrapper, RatingIcon);
- expect(ratingIcons.length).toBe(3, 'Rating is not renderin 3 icons');
- });
-
-});
diff --git a/lib/index.js b/lib/index.js
index 8051157..61cd41f 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,3 +1,11 @@
-import TextareaAutosize from './TextareaAutosize.js';
+'use strict';
-export { TextareaAutosize }; \ No newline at end of file
+exports.__esModule = true;
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+var _TextareaAutosizeJs = require('./TextareaAutosize.js');
+
+var _TextareaAutosizeJs2 = _interopRequireDefault(_TextareaAutosizeJs);
+
+exports.TextareaAutosize = _TextareaAutosizeJs2['default']; \ No newline at end of file