Skip to content

Commit 35babf2

Browse files
committed
Add regression test for #266
1 parent c1e0f07 commit 35babf2

File tree

2 files changed

+322
-0
lines changed

2 files changed

+322
-0
lines changed

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

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,258 @@ Object {
358358
},
359359
}
360360
`;
361+
362+
exports[`main fixtures processes component "component_13.js" without errors 1`] = `
363+
Object {
364+
"description": "",
365+
"displayName": "Foo",
366+
"methods": Array [],
367+
"props": Object {
368+
"RootComponent": Object {
369+
"description": "",
370+
"flowType": Object {
371+
"name": "ReactElementType",
372+
"raw": "React.ElementType",
373+
},
374+
"required": false,
375+
},
376+
"align": Object {
377+
"description": "",
378+
"flowType": Object {
379+
"elements": Array [
380+
Object {
381+
"name": "literal",
382+
"value": "\\"left\\"",
383+
},
384+
Object {
385+
"name": "literal",
386+
"value": "\\"center\\"",
387+
},
388+
Object {
389+
"name": "literal",
390+
"value": "\\"right\\"",
391+
},
392+
Object {
393+
"name": "literal",
394+
"value": "\\"justify\\"",
395+
},
396+
],
397+
"name": "union",
398+
"raw": "\\"left\\" | \\"center\\" | \\"right\\" | \\"justify\\"",
399+
},
400+
"required": false,
401+
},
402+
"capitalize": Object {
403+
"description": "",
404+
"flowType": Object {
405+
"name": "boolean",
406+
},
407+
"required": false,
408+
},
409+
"center": Object {
410+
"description": "",
411+
"flowType": Object {
412+
"name": "boolean",
413+
},
414+
"required": false,
415+
},
416+
"children": Object {
417+
"description": "",
418+
"flowType": Object {
419+
"name": "ReactNode",
420+
"raw": "React.Node",
421+
},
422+
"required": false,
423+
},
424+
"className": Object {
425+
"description": "",
426+
"flowType": Object {
427+
"name": "string",
428+
},
429+
"required": false,
430+
},
431+
"color": Object {
432+
"description": "",
433+
"flowType": Object {
434+
"name": "string",
435+
},
436+
"required": false,
437+
},
438+
"justify": Object {
439+
"description": "",
440+
"flowType": Object {
441+
"name": "boolean",
442+
},
443+
"required": false,
444+
},
445+
"leading": Object {
446+
"description": "",
447+
"flowType": Object {
448+
"elements": Array [
449+
Object {
450+
"name": "literal",
451+
"value": "\\"none\\"",
452+
},
453+
Object {
454+
"name": "literal",
455+
"value": "\\"tight\\"",
456+
},
457+
Object {
458+
"name": "literal",
459+
"value": "\\"normal\\"",
460+
},
461+
Object {
462+
"name": "literal",
463+
"value": "\\"loose\\"",
464+
},
465+
],
466+
"name": "union",
467+
"raw": "\\"none\\" | \\"tight\\" | \\"normal\\" | \\"loose\\"",
468+
},
469+
"required": false,
470+
},
471+
"leadingLoose": Object {
472+
"description": "",
473+
"flowType": Object {
474+
"name": "boolean",
475+
},
476+
"required": false,
477+
},
478+
"leadingNone": Object {
479+
"description": "",
480+
"flowType": Object {
481+
"name": "boolean",
482+
},
483+
"required": false,
484+
},
485+
"leadingNormal": Object {
486+
"description": "",
487+
"flowType": Object {
488+
"name": "boolean",
489+
},
490+
"required": false,
491+
},
492+
"leadingTight": Object {
493+
"description": "",
494+
"flowType": Object {
495+
"name": "boolean",
496+
},
497+
"required": false,
498+
},
499+
"left": Object {
500+
"description": "",
501+
"flowType": Object {
502+
"name": "boolean",
503+
},
504+
"required": false,
505+
},
506+
"lowercase": Object {
507+
"description": "",
508+
"flowType": Object {
509+
"name": "boolean",
510+
},
511+
"required": false,
512+
},
513+
"muted": Object {
514+
"description": "",
515+
"flowType": Object {
516+
"name": "boolean",
517+
},
518+
"required": false,
519+
},
520+
"right": Object {
521+
"description": "",
522+
"flowType": Object {
523+
"name": "boolean",
524+
},
525+
"required": false,
526+
},
527+
"size": Object {
528+
"description": "",
529+
"flowType": Object {
530+
"name": "string",
531+
},
532+
"required": false,
533+
},
534+
"tracking": Object {
535+
"description": "",
536+
"flowType": Object {
537+
"elements": Array [
538+
Object {
539+
"name": "literal",
540+
"value": "\\"tight\\"",
541+
},
542+
Object {
543+
"name": "literal",
544+
"value": "\\"normal\\"",
545+
},
546+
Object {
547+
"name": "literal",
548+
"value": "\\"wide\\"",
549+
},
550+
],
551+
"name": "union",
552+
"raw": "\\"tight\\" | \\"normal\\" | \\"wide\\"",
553+
},
554+
"required": false,
555+
},
556+
"trackingNormal": Object {
557+
"description": "",
558+
"flowType": Object {
559+
"name": "boolean",
560+
},
561+
"required": false,
562+
},
563+
"trackingTight": Object {
564+
"description": "",
565+
"flowType": Object {
566+
"name": "boolean",
567+
},
568+
"required": false,
569+
},
570+
"trackingWide": Object {
571+
"description": "",
572+
"flowType": Object {
573+
"name": "boolean",
574+
},
575+
"required": false,
576+
},
577+
"transform": Object {
578+
"description": "",
579+
"flowType": Object {
580+
"elements": Array [
581+
Object {
582+
"name": "literal",
583+
"value": "\\"lowercase\\"",
584+
},
585+
Object {
586+
"name": "literal",
587+
"value": "\\"uppercase\\"",
588+
},
589+
Object {
590+
"name": "literal",
591+
"value": "\\"capitalize\\"",
592+
},
593+
],
594+
"name": "union",
595+
"raw": "\\"lowercase\\" | \\"uppercase\\" | \\"capitalize\\"",
596+
},
597+
"required": false,
598+
},
599+
"uppercase": Object {
600+
"description": "",
601+
"flowType": Object {
602+
"name": "boolean",
603+
},
604+
"required": false,
605+
},
606+
"wrap": Object {
607+
"description": "",
608+
"flowType": Object {
609+
"name": "boolean",
610+
},
611+
"required": false,
612+
},
613+
},
614+
}
615+
`;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2015, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
*/
10+
11+
/**
12+
* Test for documentation of React components with Flow annotations for props.
13+
*/
14+
15+
import React from 'react';
16+
17+
type AlignProps = {|
18+
+align?: "left" | "center" | "right" | "justify",
19+
+left?: boolean,
20+
+center?: boolean,
21+
+right?: boolean,
22+
+justify?: boolean,
23+
|};
24+
25+
type TransformProps = {|
26+
+transform?: "lowercase" | "uppercase" | "capitalize",
27+
+lowercase?: boolean,
28+
+uppercase?: boolean,
29+
+capitalize?: boolean,
30+
|};
31+
32+
type TrackingProps = {|
33+
+tracking?: "tight" | "normal" | "wide",
34+
+trackingTight?: boolean,
35+
+trackingNormal?: boolean,
36+
+trackingWide?: boolean,
37+
|};
38+
39+
type LeadingProps = {|
40+
+leading?: "none" | "tight" | "normal" | "loose",
41+
+leadingNone?: boolean,
42+
+leadingTight?: boolean,
43+
+leadingNormal?: boolean,
44+
+leadingLoose?: boolean,
45+
|};
46+
47+
type TextProps = {|
48+
...AlignProps,
49+
...TransformProps,
50+
...TrackingProps,
51+
...LeadingProps,
52+
+children?: React.Node,
53+
+className?: string,
54+
+RootComponent?: React.ElementType,
55+
+color?: string,
56+
+size?: string,
57+
+wrap?: boolean,
58+
+muted?: boolean,
59+
|};
60+
61+
class Foo extends React.Component<TextProps> {
62+
render() {
63+
return <div />;
64+
}
65+
}
66+
67+
export default Foo;

0 commit comments

Comments
 (0)