Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-component-tree",
"version": "0.1.0",
"version": "0.1.1",
"description": "Serialize and reproduce the state of an entire tree of React components",
"main": "src/main.js",
"repository": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"pretest": "jscs --esnext ./",
"test": "karma start --single-run",
"coveralls": "cat tests/coverage/*/lcov.info | node_modules/coveralls/bin/coveralls.js",
"build": "webpack -p"
"build": "webpack -p",
"prepublish": "npm run build"
}
}
2 changes: 1 addition & 1 deletion src/load-child-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var React = require('react'),
class LoadChildComponent extends React.Component {
loadChild(childName, a, b, c, d, e, f) {
return loadChild.loadChild(
this.constructor.children, childName, a, b, c, d, e, f);
this.children, childName, a, b, c, d, e, f);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/load-child-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ var loadChild = require('./load-child.js');
module.exports = {
loadChild: function(childName, a, b, c, d, e, f) {
return loadChild.loadChild(
this.constructor.children, childName, a, b, c, d, e, f);
this.children, childName, a, b, c, d, e, f);
}
};
9 changes: 6 additions & 3 deletions tests/load-child-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ var _ = require('lodash'),

describe('Load child component', function() {
var fakeReactElement = {},
children = {},
myComponent;

class MyComponent extends LoadChildComponent {
constructor(props) {
super(props);
this.children = children;
}
render() {
return React.DOM.span();
}
}

MyComponent.children = {};

beforeEach(function() {
sinon.stub(loadChild, 'loadChild').returns(fakeReactElement);

Expand All @@ -30,7 +33,7 @@ describe('Load child component', function() {
myComponent.loadChild('myChild', 5, 10, true);

var args = loadChild.loadChild.lastCall.args;
expect(args[0]).to.equal(MyComponent.children);
expect(args[0]).to.equal(children);
expect(args[1]).to.equal('myChild');
expect(args[2]).to.equal(5);
expect(args[3]).to.equal(10);
Expand Down
8 changes: 3 additions & 5 deletions tests/load-child-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ var _ = require('lodash'),

describe('Load child mixin', function() {
var fakeReactElement = {},
children = {},
myComponent;

var MyComponent = React.createClass({
mixins: [LoadChildMixin],

statics: {
children: {}
},
children: children,

render: function() {
return React.DOM.span();
Expand All @@ -34,7 +32,7 @@ describe('Load child mixin', function() {
myComponent.loadChild('myChild', 5, 10, true);

var args = loadChild.loadChild.lastCall.args;
expect(args[0]).to.equal(MyComponent.children);
expect(args[0]).to.equal(children);
expect(args[1]).to.equal('myChild');
expect(args[2]).to.equal(5);
expect(args[3]).to.equal(10);
Expand Down