Skip to content

Commit 17f7376

Browse files
committed
Merge branch 'wincent-arrow-functions'
2 parents 57eb46d + 174a263 commit 17f7376

15 files changed

+83
-83
lines changed

src/__tests__/main-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ var source = [
3434
'module.exports = Component;'
3535
].join('\n');
3636

37-
describe('main', function() {
37+
describe('main', () => {
3838
var utils;
3939
var docgen;
4040

41-
beforeEach(function() {
41+
beforeEach(() => {
4242
utils = require('../../tests/utils');
4343
docgen = require('../main');
4444
});
4545

46-
it('parses with default resolver/handlers', function() {
46+
it('parses with default resolver/handlers', () => {
4747
var docs = docgen.parse(source);
4848
expect(docs).toEqual({
4949
description: 'Example component description',
@@ -63,7 +63,7 @@ describe('main', function() {
6363
});
6464
});
6565

66-
it('parses with custom handlers', function() {
66+
it('parses with custom handlers', () => {
6767
var docs = docgen.parse(source, null, [
6868
docgen.handlers.componentDocblockHandler,
6969
]);

src/__tests__/parse-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
jest.autoMockOff();
1414

15-
describe('parse', function() {
15+
describe('parse', () => {
1616
var utils;
1717
var parse;
1818

19-
beforeEach(function() {
19+
beforeEach(() => {
2020
utils = require('../../tests/utils');
2121
parse = require('../parse');
2222
});
@@ -25,7 +25,7 @@ describe('parse', function() {
2525
return utils.parse(source).get('body', 0, 'expression');
2626
}
2727

28-
it('allows custom component definition resolvers', function() {
28+
it('allows custom component definition resolvers', () => {
2929
var path = pathFromSource('({foo: "bar"})');
3030
var resolver = jest.genMockFunction().mockReturnValue(path);
3131
var handler = jest.genMockFunction();
@@ -35,7 +35,7 @@ describe('parse', function() {
3535
expect(handler.mock.calls[0][1]).toBe(path);
3636
});
3737

38-
it('errors if component definition is not found', function() {
38+
it('errors if component definition is not found', () => {
3939
var resolver = jest.genMockFunction();
4040
expect(function() {
4141
parse('', resolver);

src/handlers/__tests__/componentDocblockHandler-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
jest.autoMockOff();
1414
jest.mock('../../Documentation');
1515

16-
describe('componentDocblockHandler', function() {
16+
describe('componentDocblockHandler', () => {
1717
var utils;
1818
var documentation;
1919
var componentDocblockHandler;
@@ -31,13 +31,13 @@ describe('componentDocblockHandler', function() {
3131
);
3232
}
3333

34-
beforeEach(function() {
34+
beforeEach(() => {
3535
utils = require('../../../tests/utils');
3636
documentation = new (require('../../Documentation'));
3737
componentDocblockHandler = require('../componentDocblockHandler');
3838
});
3939

40-
it('finds docblocks for component definitions', function() {
40+
it('finds docblocks for component definitions', () => {
4141
var definition = parse([
4242
'/**',
4343
' * Component description',
@@ -49,7 +49,7 @@ describe('componentDocblockHandler', function() {
4949
expect(documentation.description).toBe('Component description');
5050
});
5151

52-
it('ignores other types of comments', function() {
52+
it('ignores other types of comments', () => {
5353
var definition = parse([
5454
'/*',
5555
' * This is not a docblock',
@@ -69,7 +69,7 @@ describe('componentDocblockHandler', function() {
6969
expect(documentation.description).toBe('');
7070
});
7171

72-
it('only considers the docblock directly above the definition', function() {
72+
it('only considers the docblock directly above the definition', () => {
7373
var definition = parse([
7474
'/**',
7575
' * This is the wrong docblock',

src/handlers/__tests__/defaultPropsHandler-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
jest.autoMockOff();
1414
jest.mock('../../Documentation');
1515

16-
describe('defaultPropsHandler', function() {
16+
describe('defaultPropsHandler', () => {
1717
var utils;
1818
var documentation;
1919
var defaultValueHandler;
@@ -22,13 +22,13 @@ describe('defaultPropsHandler', function() {
2222
return utils.parse(src).get('body', 0, 'expression');
2323
}
2424

25-
beforeEach(function() {
25+
beforeEach(() => {
2626
utils = require('../../../tests/utils');
2727
documentation = new (require('../../Documentation'));
2828
defaultPropsHandler = require('../defaultPropsHandler');
2929
});
3030

31-
it ('should find prop default values that are literals', function() {
31+
it ('should find prop default values that are literals', () => {
3232
var definition = parse([
3333
'({',
3434
' getDefaultProps: function() {',

src/handlers/__tests__/propDocblockHandler-test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
jest.autoMockOff();
1414
jest.mock('../../Documentation');
1515

16-
describe('propDocblockHandler', function() {
16+
describe('propDocblockHandler', () => {
1717
var utils;
1818
var documentation;
1919
var propDocblockHandler;
2020

21-
beforeEach(function() {
21+
beforeEach(() => {
2222
utils = require('../../../tests/utils');
2323
documentation = new (require('../../Documentation'));
2424
propDocblockHandler = require('../propDocblockHandler');
@@ -33,7 +33,7 @@ describe('propDocblockHandler', function() {
3333
);
3434
}
3535

36-
it('finds docblocks for prop types', function() {
36+
it('finds docblocks for prop types', () => {
3737
var definition = parse([
3838
'({',
3939
' propTypes: {',
@@ -61,7 +61,7 @@ describe('propDocblockHandler', function() {
6161
});
6262
});
6363

64-
it('can handle multline comments', function() {
64+
it('can handle multline comments', () => {
6565
var definition = parse([
6666
'({',
6767
' propTypes: {',
@@ -85,7 +85,7 @@ describe('propDocblockHandler', function() {
8585
});
8686
});
8787

88-
it('ignores non-docblock comments', function() {
88+
it('ignores non-docblock comments', () => {
8989
var definition = parse([
9090
'({',
9191
' propTypes: {',
@@ -115,7 +115,7 @@ describe('propDocblockHandler', function() {
115115
});
116116
});
117117

118-
it('only considers the comment with the property below it', function() {
118+
it('only considers the comment with the property below it', () => {
119119
var definition = parse([
120120
'({',
121121
' propTypes: {',
@@ -139,7 +139,7 @@ describe('propDocblockHandler', function() {
139139
});
140140
});
141141

142-
it('understands and ignores the spread operator', function() {
142+
it('understands and ignores the spread operator', () => {
143143
var definition = parse([
144144
'({',
145145
' propTypes: {',
@@ -160,7 +160,7 @@ describe('propDocblockHandler', function() {
160160
});
161161
});
162162

163-
it('resolves variables', function() {
163+
it('resolves variables', () => {
164164
var definition = parse([
165165
'var Props = {',
166166
' /**',
@@ -181,7 +181,7 @@ describe('propDocblockHandler', function() {
181181
});
182182
});
183183

184-
it('does not error if propTypes cannot be found', function() {
184+
it('does not error if propTypes cannot be found', () => {
185185
var definition = parse([
186186
'({',
187187
' fooBar: 42',

src/handlers/__tests__/propTypeHandler-test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
jest.autoMockOff();
1414
jest.mock('../../Documentation');
1515

16-
describe('propTypeHandler', function() {
16+
describe('propTypeHandler', () => {
1717
var utils;
1818
var getPropTypeMock;
1919
var documentation;
2020
var propTypeHandler;
2121

22-
beforeEach(function() {
22+
beforeEach(() => {
2323
utils = require('../../../tests/utils');
2424
getPropTypeMock = jest.genMockFunction().mockImplementation(() => ({}));
2525
jest.setMock('../../utils/getPropType', getPropTypeMock);
@@ -38,7 +38,7 @@ describe('propTypeHandler', function() {
3838
);
3939
}
4040

41-
it('passes the correct argument to getPropType', function() {
41+
it('passes the correct argument to getPropType', () => {
4242
var definition = parse(
4343
'({propTypes: {foo: PropTypes.bool, abc: PropTypes.xyz}})'
4444
);
@@ -52,7 +52,7 @@ describe('propTypeHandler', function() {
5252
expect(getPropTypeMock).toBeCalledWith(xyzPath);
5353
});
5454

55-
it('finds definitions via React.PropTypes', function() {
55+
it('finds definitions via React.PropTypes', () => {
5656
var definition = parse([
5757
'({',
5858
' propTypes: {',
@@ -76,7 +76,7 @@ describe('propTypeHandler', function() {
7676
});
7777
});
7878

79-
it('finds definitions via the ReactPropTypes module', function() {
79+
it('finds definitions via the ReactPropTypes module', () => {
8080
var definition = parse([
8181
'({',
8282
' propTypes: {',
@@ -95,7 +95,7 @@ describe('propTypeHandler', function() {
9595
});
9696
});
9797

98-
it('detects whether a prop is required', function() {
98+
it('detects whether a prop is required', () => {
9999
var definition = parse([
100100
'({',
101101
' propTypes: {',
@@ -119,7 +119,7 @@ describe('propTypeHandler', function() {
119119
});
120120
});
121121

122-
it('only considers definitions from React or ReactPropTypes', function() {
122+
it('only considers definitions from React or ReactPropTypes', () => {
123123
var definition = parse([
124124
'({',
125125
' propTypes: {',
@@ -145,7 +145,7 @@ describe('propTypeHandler', function() {
145145
});
146146
});
147147

148-
it('understands the spread operator', function() {
148+
it('understands the spread operator', () => {
149149
var definition = parse([
150150
'var Foo = require("Foo.react");',
151151
'var props = {bar: PropTypes.bool};',
@@ -172,7 +172,7 @@ describe('propTypeHandler', function() {
172172
});
173173
});
174174

175-
it('resolves variables', function() {
175+
it('resolves variables', () => {
176176
var definition = parse([
177177
'var props = {bar: PropTypes.bool};',
178178
'({',
@@ -189,7 +189,7 @@ describe('propTypeHandler', function() {
189189
});
190190
});
191191

192-
it('does not error if propTypes cannot be found', function() {
192+
it('does not error if propTypes cannot be found', () => {
193193
var definition = parse([
194194
'({',
195195
' fooBar: 42',

src/resolver/__tests__/findAllReactCreateClassCalls-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
jest.autoMockOff();
1414

15-
describe('React documentation parser', function() {
15+
describe('React documentation parser', () => {
1616
var findAllReactCreateClassCalls;
1717
var recast;
1818

@@ -23,13 +23,13 @@ describe('React documentation parser', function() {
2323
);
2424
}
2525

26-
beforeEach(function() {
26+
beforeEach(() => {
2727
findAllReactCreateClassCalls = require('../findAllReactCreateClassCalls');
2828
recast = require('recast');
2929
});
3030

3131

32-
it('finds React.createClass', function() {
32+
it('finds React.createClass', () => {
3333
var source = [
3434
'var React = require("React");',
3535
'var Component = React.createClass({});',
@@ -43,7 +43,7 @@ describe('React documentation parser', function() {
4343
expect(result[0].node.type).toBe('ObjectExpression');
4444
});
4545

46-
it('finds React.createClass, independent of the var name', function() {
46+
it('finds React.createClass, independent of the var name', () => {
4747
var source = [
4848
'var R = require("React");',
4949
'var Component = R.createClass({});',
@@ -55,7 +55,7 @@ describe('React documentation parser', function() {
5555
expect(result.length).toBe(1);
5656
});
5757

58-
it('does not process X.createClass of other modules', function() {
58+
it('does not process X.createClass of other modules', () => {
5959
var source = [
6060
'var R = require("NoReact");',
6161
'var Component = R.createClass({});',
@@ -67,7 +67,7 @@ describe('React documentation parser', function() {
6767
expect(result.length).toBe(0);
6868
});
6969

70-
it('finds assignments to exports', function() {
70+
it('finds assignments to exports', () => {
7171
var source = [
7272
'var R = require("React");',
7373
'var Component = R.createClass({});',
@@ -80,7 +80,7 @@ describe('React documentation parser', function() {
8080
expect(result.length).toBe(1);
8181
});
8282

83-
it('accepts multiple definitions', function() {
83+
it('accepts multiple definitions', () => {
8484
var source = [
8585
'var R = require("React");',
8686
'var ComponentA = R.createClass({});',

0 commit comments

Comments
 (0)