fix(language-service): Provide completions for attribute values (#33839)
This commit fixes a bug whereby completions for attribute values are only provided for directives that support the micro-syntax format, all other bindings are ignored. I'm not sure if this is a regresssion or a bug, because there were no tests prior to this. PR Close #33839
This commit is contained in:

committed by
Alex Rickabaugh

parent
7eb3e3bce6
commit
592fd37b3e
@ -161,6 +161,26 @@ describe('completions', () => {
|
||||
expectContain(completions, CompletionKind.METHOD, ['$any']);
|
||||
});
|
||||
|
||||
it('should suggest attribute values', () => {
|
||||
mockHost.override(TEST_TEMPLATE, `<div [id]="~{cursor}"></div>`);
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
|
||||
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start);
|
||||
expectContain(completions, CompletionKind.PROPERTY, [
|
||||
'title',
|
||||
'hero',
|
||||
'heroes',
|
||||
'league',
|
||||
'anyValue',
|
||||
]);
|
||||
});
|
||||
|
||||
it('should suggest event handlers', () => {
|
||||
mockHost.override(TEST_TEMPLATE, `<div (click)="~{cursor}"></div>`);
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
|
||||
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start);
|
||||
expectContain(completions, CompletionKind.METHOD, ['myClick']);
|
||||
});
|
||||
|
||||
describe('in external template', () => {
|
||||
it('should be able to get entity completions in external template', () => {
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'entity-amp');
|
||||
|
Reference in New Issue
Block a user