Skip to content

Commit 10f4827

Browse files
benleshjasonaden
authored andcommitted
test(ivy): add attribute interpolation test (angular#30503)
PR Close angular#30503
1 parent d4e6263 commit 10f4827

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

packages/core/test/acceptance/attributes_spec.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,54 @@ describe('attribute binding', () => {
9898
expect(a.href.indexOf('unsafe:')).toBe(-1);
9999
});
100100
});
101+
102+
describe('attribute interpolation', () => {
103+
it('should handle all varieties of interpolation', () => {
104+
@Component({
105+
template: `
106+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e{{e}}f{{f}}g{{g}}h{{h}}i{{i}}j"></div>
107+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e{{e}}f{{f}}g{{g}}h{{h}}i"></div>
108+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e{{e}}f{{f}}g{{g}}h"></div>
109+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e{{e}}f{{f}}g"></div>
110+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e{{e}}f"></div>
111+
<div attr.title="a{{a}}b{{b}}c{{c}}d{{d}}e"></div>
112+
<div attr.title="a{{a}}b{{b}}c{{c}}d"></div>
113+
<div attr.title="a{{a}}b{{b}}c"></div>
114+
<div attr.title="a{{a}}b"></div>
115+
<div attr.title="{{a}}"></div>
116+
`
117+
})
118+
class App {
119+
a = 1;
120+
b = 2;
121+
c = 3;
122+
d = 4;
123+
e = 5;
124+
f = 6;
125+
g = 7;
126+
h = 8;
127+
i = 9;
128+
}
129+
130+
TestBed.configureTestingModule({
131+
declarations: [App],
132+
});
133+
const fixture = TestBed.createComponent(App);
134+
fixture.detectChanges();
135+
136+
const divs = fixture.debugElement.queryAll(By.css('div[title]'));
137+
138+
expect(divs.map(el => el.nativeElement.getAttribute('title'))).toEqual([
139+
'a1b2c3d4e5f6g7h8i9j',
140+
'a1b2c3d4e5f6g7h8i',
141+
'a1b2c3d4e5f6g7h',
142+
'a1b2c3d4e5f6g',
143+
'a1b2c3d4e5f',
144+
'a1b2c3d4e',
145+
'a1b2c3d',
146+
'a1b2c',
147+
'a1b',
148+
'1',
149+
]);
150+
});
151+
});

0 commit comments

Comments
 (0)