File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1513,13 +1513,26 @@ describe('parser', () => {
15131513 it ( 'should be disabled by default' , ( ) => {
15141514 const [ parsed ] = parse ( fixturePath ( 'StatelessDisplayName' ) ) ;
15151515 assert . equal ( parsed . expression , undefined ) ;
1516+ assert . equal ( parsed . expression , parsed . rootExpression ) ;
15161517 } ) ;
15171518
15181519 it ( 'should cause the parser to return the component expression when set to true' , ( ) => {
15191520 const [ parsed ] = parse ( fixturePath ( 'StatelessDisplayName' ) , {
15201521 shouldIncludeExpression : true
15211522 } ) ;
15221523 assert . equal ( parsed . expression ! . name , 'Stateless' ) ;
1524+ assert . equal ( parsed . expression , parsed . rootExpression ) ;
1525+ } ) ;
1526+
1527+ it ( 'should cause the parser to return the root expression when set to true' , ( ) => {
1528+ const [ parsed ] = parse (
1529+ fixturePath ( 'FunctionDeclarationAsDefaultExportWithMemo' ) ,
1530+ {
1531+ shouldIncludeExpression : true
1532+ }
1533+ ) ;
1534+ assert . equal ( parsed . expression ! . name , 'Jumbotron' ) ;
1535+ assert . equal ( parsed . rootExpression ! . name , 'default' ) ;
15231536 } ) ;
15241537 } ) ;
15251538 } ) ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export interface StringIndexedObject<T> {
1515
1616export interface ComponentDoc {
1717 expression ?: ts . Symbol ;
18+ rootExpression ?: ts . Symbol ;
1819 displayName : string ;
1920 filePath : string ;
2021 description : string ;
@@ -395,6 +396,7 @@ export class Parser {
395396
396397 if ( result !== null && this . shouldIncludeExpression ) {
397398 result . expression = rootExp ;
399+ result . rootExpression = exp ;
398400 }
399401
400402 return result ;
You can’t perform that action at this time.
0 commit comments