fix(ivy): ensure interpolated style/classes do not cause tracking issues for bindings (#28190)
With the refactoring or how styles/classes are implmented in Ivy, interpolation has caused the binding code to mess up since interpolation itself takes up its own slot in Ivy's memory management code. This patch makes sure that interpolation works as expected with class and style bindings. Jira issue: FW-944 PR Close #28190
This commit is contained in:

committed by
Alex Rickabaugh

parent
896cf35afb
commit
0d6913f037
@ -1916,6 +1916,30 @@ describe('render3 integration test', () => {
|
||||
fixture.update();
|
||||
expect(target.style.getPropertyValue('width')).toEqual('777px');
|
||||
});
|
||||
|
||||
it('should properly handle and render interpolation for class attribute bindings', () => {
|
||||
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
elementStart(0, 'div');
|
||||
elementStyling();
|
||||
elementEnd();
|
||||
}
|
||||
if (rf & RenderFlags.Update) {
|
||||
elementStylingMap(0, interpolation2('-', ctx.name, '-', ctx.age, '-'));
|
||||
elementStylingApply(0);
|
||||
}
|
||||
}, 1, 2);
|
||||
|
||||
const fixture = new ComponentFixture(App);
|
||||
const target = fixture.hostElement.querySelector('div') !;
|
||||
expect(target.classList.contains('-fred-36-')).toBeFalsy();
|
||||
|
||||
fixture.component.name = 'fred';
|
||||
fixture.component.age = '36';
|
||||
fixture.update();
|
||||
|
||||
expect(target.classList.contains('-fred-36-')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user