Skip to content

Commit 041725a

Browse files
glebezdanez
authored andcommitted
update fixtures, clean up lint errors, update default handlers
1 parent db13009 commit 041725a

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed

src/Documentation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ class Documentation {
7070

7171
if (this._props.size > 0) {
7272
obj.props = {};
73-
for (var [name, descriptor] of this._props) {
74-
obj.props[name] = descriptor;
73+
for (var [propName, propDescriptor] of this._props) {
74+
obj.props[propName] = propDescriptor;
7575
}
7676
}
7777

7878
if (this._context.size > 0) {
7979
obj.context = {};
80-
for (var [name, descriptor] of this._context) {
81-
obj.context[name] = descriptor;
80+
for (var [contextName, contextDescriptor] of this._context) {
81+
obj.context[contextName] = contextDescriptor;
8282
}
8383
}
8484

8585
if (this._childContext.size > 0) {
8686
obj.childContext = {};
87-
for (var [name, descriptor] of this._childContext) {
88-
obj.childContext[name] = descriptor;
87+
for (var [childContextName, childContextDescriptor] of this._childContext) {
88+
obj.childContext[childContextName] = childContextDescriptor;
8989
}
9090
}
9191

src/__tests__/__snapshots__/main-test.js.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ Object {
102102

103103
exports[`main fixtures processes component "component_5.js" without errors 1`] = `
104104
Object {
105+
"childContext": Object {
106+
"color": Object {
107+
"required": false,
108+
"type": Object {
109+
"name": "string",
110+
},
111+
},
112+
},
113+
"context": Object {
114+
"config": Object {
115+
"required": false,
116+
"type": Object {
117+
"name": "object",
118+
},
119+
},
120+
},
105121
"description": "",
106122
"displayName": "Button",
107123
"methods": Array [],
@@ -137,6 +153,22 @@ Object {
137153

138154
exports[`main fixtures processes component "component_6.js" without errors 1`] = `
139155
Object {
156+
"childContext": Object {
157+
"color": Object {
158+
"required": false,
159+
"type": Object {
160+
"name": "string",
161+
},
162+
},
163+
},
164+
"context": Object {
165+
"config": Object {
166+
"required": false,
167+
"type": Object {
168+
"name": "object",
169+
},
170+
},
171+
},
140172
"description": "",
141173
"displayName": "Button",
142174
"methods": Array [],

src/__tests__/fixtures/component_5.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ Button.propTypes = {
1515
style: React.PropTypes.object,
1616
};
1717

18+
Button.childContextTypes = {
19+
color: React.PropTypes.string,
20+
};
21+
22+
Button.contextTypes = {
23+
config: React.PropTypes.object,
24+
};
25+
1826
export default Button;

src/__tests__/fixtures/component_6.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@ Button.propTypes = {
1616
style: PropTypes.object,
1717
};
1818

19+
Button.childContextTypes = {
20+
color: PropTypes.string,
21+
};
22+
23+
Button.contextTypes = {
24+
config: PropTypes.object,
25+
};
1926
export default Button;

src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import * as utils from './utils';
1818
var defaultResolver = resolver.findExportedComponentDefinition;
1919
var defaultHandlers = [
2020
handlers.propTypeHandler,
21+
handlers.contextTypeHandler,
22+
handlers.childContextTypeHandler,
2123
handlers.propTypeCompositionHandler,
2224
handlers.propDocBlockHandler,
2325
handlers.flowTypeHandler,

0 commit comments

Comments
 (0)