From 10f48278c237b7be27617e46f0dccd374db4b096 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Wed, 15 May 2019 16:41:29 -0700 Subject: [PATCH] test(ivy): add attribute interpolation test (#30503) PR Close #30503 --- .../core/test/acceptance/attributes_spec.ts | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/core/test/acceptance/attributes_spec.ts b/packages/core/test/acceptance/attributes_spec.ts index d8946033a0..1773227951 100644 --- a/packages/core/test/acceptance/attributes_spec.ts +++ b/packages/core/test/acceptance/attributes_spec.ts @@ -98,3 +98,54 @@ describe('attribute binding', () => { expect(a.href.indexOf('unsafe:')).toBe(-1); }); }); + +describe('attribute interpolation', () => { + it('should handle all varieties of interpolation', () => { + @Component({ + template: ` +
+
+
+
+
+
+
+
+
+
+ ` + }) + class App { + a = 1; + b = 2; + c = 3; + d = 4; + e = 5; + f = 6; + g = 7; + h = 8; + i = 9; + } + + TestBed.configureTestingModule({ + declarations: [App], + }); + const fixture = TestBed.createComponent(App); + fixture.detectChanges(); + + const divs = fixture.debugElement.queryAll(By.css('div[title]')); + + expect(divs.map(el => el.nativeElement.getAttribute('title'))).toEqual([ + 'a1b2c3d4e5f6g7h8i9j', + 'a1b2c3d4e5f6g7h8i', + 'a1b2c3d4e5f6g7h', + 'a1b2c3d4e5f6g', + 'a1b2c3d4e5f', + 'a1b2c3d4e', + 'a1b2c3d', + 'a1b2c', + 'a1b', + '1', + ]); + }); +});