feat(language-service): completions for output $event properties in (#34570)
This commit adds support for completions of properties on `$event` variables in bound outputs. This is the second major PR to support completions for `$event` variables (https://github.com/angular/vscode-ng-language-service/issues/531). The final completion support that must be provided is for `$event` variables in bindings targeting DOM events, like `(click)`. PR Close #34570
This commit is contained in:

committed by
Andrew Kushnir

parent
c246787ccc
commit
2a537273ca
@ -758,10 +758,17 @@ describe('completions', () => {
|
||||
it('should suggest $event in event bindings', () => {
|
||||
mockHost.override(TEST_TEMPLATE, `<div (click)="myClick(~{cursor});"></div>`);
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
|
||||
debugger;
|
||||
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start);
|
||||
const completions = ngLS.getCompletionsAtPosition(TEST_TEMPLATE, marker.start);
|
||||
expectContain(completions, CompletionKind.VARIABLE, ['$event']);
|
||||
});
|
||||
|
||||
it('should suggest $event completions in output bindings', () => {
|
||||
mockHost.override(TEST_TEMPLATE, `<div string-model (modelChange)="$event.~{cursor}"></div>`);
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'cursor');
|
||||
const completions = ngLS.getCompletionsAtPosition(TEST_TEMPLATE, marker.start);
|
||||
// Expect string properties
|
||||
expectContain(completions, CompletionKind.METHOD, ['charAt', 'substring']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user