File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
packages/language-service/test Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -253,4 +253,26 @@ describe('definitions', () => {
253
253
// Not asserting the textSpan of definition because it's external file
254
254
}
255
255
} ) ;
256
+
257
+ it ( 'should be able to find a template from a url' , ( ) => {
258
+ const fileName = mockHost . addCode ( `
259
+ @Component({
260
+ templateUrl: './«test».ng',
261
+ })
262
+ export class MyComponent {}` ) ;
263
+
264
+ const marker = mockHost . getReferenceMarkerFor ( fileName , 'test' ) ;
265
+ const result = ngService . getDefinitionAt ( fileName , marker . start ) ;
266
+
267
+ expect ( result ) . toBeDefined ( ) ;
268
+ const { textSpan, definitions} = result ! ;
269
+
270
+ expect ( textSpan ) . toEqual ( { start : marker . start - 2 , length : 9 } ) ;
271
+
272
+ expect ( definitions ) . toBeDefined ( ) ;
273
+ expect ( definitions ! . length ) . toBe ( 1 ) ;
274
+ const [ def ] = definitions ! ;
275
+ expect ( def . fileName ) . toBe ( '/app/test.ng' ) ;
276
+ expect ( def . textSpan ) . toEqual ( { start : 0 , length : 0 } ) ;
277
+ } ) ;
256
278
} ) ;
You can’t perform that action at this time.
0 commit comments