test(core): add test for template variable object property assignment (#29708)

The `template-var-assignment` schematic currently complains if someone
assigns a value to a template variable. This will no longer work with Ivy, but
it should be totally fine to update a property of the template variable if it refers
to an object. This commit adds a test that ensures that we don't incorrectly report
any failure for such property writes in bound events.

PR Close #29708
This commit is contained in:
Paul Gschwendtner 2019-04-04 12:54:17 +02:00 committed by Igor Minar
parent 4a2fb86b1e
commit 6d35c5094a
1 changed files with 18 additions and 0 deletions

View File

@ -161,6 +161,24 @@ describe('template variable assignment migration', () => {
expect(warnOutput.length).toBe(0);
});
it('should not warn for bound event assignments to template variable object property', () => {
writeFile('/index.ts', `
import {Component} from '@angular/core';
@Component({
templateUrl: './sub_dir/tmpl.html',
})
export class MyComp {}
`);
writeFile('/sub_dir/tmpl.html', `
<button *ngFor="let element of list" (click)="element.value = null">Reset</button>
`);
runMigration();
expect(warnOutput.length).toBe(0);
});
it('should not throw an error if a detected template fails parsing', () => {