File tree Expand file tree Collapse file tree 2 files changed +61
-1
lines changed
extensions/ql-vscode/src/view/model-editor Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,27 @@ const Name = styled.span`
77 word-break: break-all;
88` ;
99
10+ const TypeMethodName = ( method : Method ) => {
11+ if ( ! method . typeName ) {
12+ return < > { method . methodName } </ > ;
13+ }
14+
15+ if ( ! method . methodName ) {
16+ return < > { method . typeName } </ > ;
17+ }
18+
19+ return (
20+ < >
21+ { method . typeName } .{ method . methodName }
22+ </ >
23+ ) ;
24+ } ;
25+
1026export const MethodName = ( method : Method ) : JSX . Element => {
1127 return (
1228 < Name >
1329 { method . packageName && < > { method . packageName } .</ > }
14- { method . typeName } . { method . methodName }
30+ < TypeMethodName { ... method } />
1531 { method . methodParameters }
1632 </ Name >
1733 ) ;
Original file line number Diff line number Diff line change @@ -24,4 +24,48 @@ describe(MethodName.name, () => {
2424 const name = `${ method . typeName } .${ method . methodName } ${ method . methodParameters } ` ;
2525 expect ( screen . getByText ( name ) ) . toBeInTheDocument ( ) ;
2626 } ) ;
27+
28+ it ( "renders method name without method name but with parameters" , ( ) => {
29+ const method = createMethod ( {
30+ packageName : "" ,
31+ methodName : "" ,
32+ } ) ;
33+ render ( method ) ;
34+
35+ const name = `${ method . typeName } ${ method . methodParameters } ` ;
36+ expect ( screen . getByText ( name ) ) . toBeInTheDocument ( ) ;
37+ } ) ;
38+
39+ it ( "renders method name without method name and parameters" , ( ) => {
40+ const method = createMethod ( {
41+ packageName : "" ,
42+ methodName : "" ,
43+ methodParameters : "" ,
44+ } ) ;
45+ render ( method ) ;
46+
47+ const name = `${ method . typeName } ` ;
48+ expect ( screen . getByText ( name ) ) . toBeInTheDocument ( ) ;
49+ } ) ;
50+
51+ it ( "renders method name without package and type name" , ( ) => {
52+ const method = createMethod ( {
53+ packageName : "" ,
54+ typeName : "" ,
55+ } ) ;
56+ render ( method ) ;
57+
58+ const name = `${ method . methodName } ${ method . methodParameters } ` ;
59+ expect ( screen . getByText ( name ) ) . toBeInTheDocument ( ) ;
60+ } ) ;
61+
62+ it ( "renders method name without type name" , ( ) => {
63+ const method = createMethod ( {
64+ typeName : "" ,
65+ } ) ;
66+ render ( method ) ;
67+
68+ const name = `${ method . packageName } .${ method . methodName } ${ method . methodParameters } ` ;
69+ expect ( screen . getByText ( name ) ) . toBeInTheDocument ( ) ;
70+ } ) ;
2771} ) ;
You can’t perform that action at this time.
0 commit comments