From 6d35c5094ab2f9c04b20519602c647aa4867cdb6 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 4 Apr 2019 12:54:17 +0200 Subject: [PATCH] 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 --- .../template_var_assignment_migration_spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/core/schematics/test/template_var_assignment_migration_spec.ts b/packages/core/schematics/test/template_var_assignment_migration_spec.ts index 2b56dd5c41..c3bac52433 100644 --- a/packages/core/schematics/test/template_var_assignment_migration_spec.ts +++ b/packages/core/schematics/test/template_var_assignment_migration_spec.ts @@ -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', ` + + `); + + runMigration(); + + expect(warnOutput.length).toBe(0); }); it('should not throw an error if a detected template fails parsing', () => {