fix(ivy): fix style prop instructions to account for zero-based values (#27270)

PR Close #27270
This commit is contained in:
Matias Niemelä 2018-11-26 14:16:18 +01:00 committed by Igor Minar
parent d84705121a
commit a082f6484a
2 changed files with 5 additions and 1 deletions

View File

@ -1220,7 +1220,7 @@ export function elementStyleProp(
return hackImplementationOfElementStyleProp( return hackImplementationOfElementStyleProp(
index, styleIndex, value, suffix, directive); // supported in next PR index, styleIndex, value, suffix, directive); // supported in next PR
let valueToAdd: string|null = null; let valueToAdd: string|null = null;
if (value) { if (value !== null) {
if (suffix) { if (suffix) {
// when a suffix is applied then it will bypass // when a suffix is applied then it will bypass
// sanitization entirely (b/c a new string is created) // sanitization entirely (b/c a new string is created)

View File

@ -1459,6 +1459,10 @@ describe('render3 integration test', () => {
fixture.update(); fixture.update();
expect(fixture.html).toEqual('<span style="font-size: 200px;"></span>'); expect(fixture.html).toEqual('<span style="font-size: 200px;"></span>');
fixture.component.time = 0;
fixture.update();
expect(fixture.html).toEqual('<span style="font-size: 0px;"></span>');
fixture.component.time = null; fixture.component.time = null;
fixture.update(); fixture.update();
expect(fixture.html).toEqual('<span></span>'); expect(fixture.html).toEqual('<span></span>');