feat(language-service): completions support for template reference variables (#34363)

PR Close #34363
This commit is contained in:
ivanwonder
2019-12-21 16:32:56 +08:00
committed by atscott
parent 180d214ff4
commit 937d3fd112
2 changed files with 56 additions and 3 deletions

View File

@ -717,6 +717,22 @@ describe('completions', () => {
expectContain(completions, CompletionKind.METHOD, ['substring']);
});
});
describe('with template reference variables', () => {
it('should be able to get the completions (ref- prefix)', () => {
mockHost.override(TEST_TEMPLATE, `<form ref-itemForm="ngF~{reference}"></form>`);
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'reference');
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start) !;
expectContain(completions, CompletionKind.REFERENCE, ['ngForm']);
});
it('should be able to get the completions (# prefix)', () => {
mockHost.override(TEST_TEMPLATE, `<form #itemForm="ngF~{reference}"></form>`);
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'reference');
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start) !;
expectContain(completions, CompletionKind.REFERENCE, ['ngForm']);
});
});
});
});