react-class
Advanced tools
@@ -44,2 +44,46 @@ 'use strict'; | ||
| t.true(bound() === obj, 'bound'); | ||
| }); | ||
| (0, _ava2.default)('autoBind filter works', function (t) { | ||
| var MyClass = function () { | ||
| function MyClass() { | ||
| _classCallCheck(this, MyClass); | ||
| this.name = 'myclass'; | ||
| } | ||
| _createClass(MyClass, [{ | ||
| key: 'returnThis', | ||
| value: function returnThis() { | ||
| return this || 0; | ||
| } | ||
| }, { | ||
| key: 'notBound', | ||
| value: function notBound() { | ||
| return this || 1; | ||
| } | ||
| }, { | ||
| key: 'setState', | ||
| value: function setState() {} | ||
| }]); | ||
| return MyClass; | ||
| }(); | ||
| var obj = new MyClass(); | ||
| var unbound = (0, _autoBind2.default)(obj, { notBound: true }).notBound; | ||
| t.is(unbound(), 1, 'unbound'); | ||
| var boundObj = (0, _autoBind2.default)(obj, function (name) { | ||
| return name !== 'notBound'; | ||
| }); | ||
| var returnThisBound = boundObj.returnThis; | ||
| var notBound = boundObj.notBound; | ||
| t.is(returnThisBound(), boundObj, 'returnThisBound'); | ||
| t.is(notBound(), 1, 'notBound'); | ||
| }); |
+1
-3
@@ -33,4 +33,2 @@ "use strict"; | ||
| exports.autoBind = autoBind; | ||
| exports.Component = ReactClass; | ||
| module.exports = ReactClass; | ||
| exports.Component = ReactClass; |
+1
-1
| { | ||
| "name": "react-class", | ||
| "version": "3.2.0", | ||
| "version": "3.2.2", | ||
| "description": "A carefully crafted base class for all your React components ", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
+1
-1
@@ -43,3 +43,3 @@ # react-class | ||
| ```jsx | ||
| import 'react-class/autoBind' | ||
| import autoBind from 'react-class/autoBind' | ||
@@ -46,0 +46,0 @@ // or |
20236
4.79%445
7.75%