Skip to content
Permalink
Browse files

fix(language-service): re-add regressed templateUrl tests (#32438)

Commit 18ce58 (per #32378) regressed tests for templateUrl definitions.
This PR re-adds those tests.

PR Close #32438
  • Loading branch information...
ayazhafiz authored and mhevery committed Sep 1, 2019
1 parent a20fcbb commit 1ed353104931edb585e06e16da66c0be1bed49d8
Showing with 22 additions and 0 deletions.
  1. +22 −0 packages/language-service/test/definitions_spec.ts
@@ -253,4 +253,26 @@ describe('definitions', () => {
// Not asserting the textSpan of definition because it's external file
}
});

it('should be able to find a template from a url', () => {
const fileName = mockHost.addCode(`
@Component({
templateUrl: './«test».ng',
})
export class MyComponent {}`);

const marker = mockHost.getReferenceMarkerFor(fileName, 'test');
const result = ngService.getDefinitionAt(fileName, marker.start);

expect(result).toBeDefined();
const {textSpan, definitions} = result !;

expect(textSpan).toEqual({start: marker.start - 2, length: 9});

expect(definitions).toBeDefined();
expect(definitions !.length).toBe(1);
const [def] = definitions !;
expect(def.fileName).toBe('/app/test.ng');
expect(def.textSpan).toEqual({start: 0, length: 0});
});
});

0 comments on commit 1ed3531

Please sign in to comment.
You can’t perform that action at this time.