From a082f6484a9d2ebb31463131a0302dfd33433951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Mon, 26 Nov 2018 14:16:18 +0100 Subject: [PATCH] fix(ivy): fix style prop instructions to account for zero-based values (#27270) PR Close #27270 --- packages/core/src/render3/instructions.ts | 2 +- packages/core/test/render3/integration_spec.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/render3/instructions.ts b/packages/core/src/render3/instructions.ts index 0d85beaf4d..099768117b 100644 --- a/packages/core/src/render3/instructions.ts +++ b/packages/core/src/render3/instructions.ts @@ -1220,7 +1220,7 @@ export function elementStyleProp( return hackImplementationOfElementStyleProp( index, styleIndex, value, suffix, directive); // supported in next PR let valueToAdd: string|null = null; - if (value) { + if (value !== null) { if (suffix) { // when a suffix is applied then it will bypass // sanitization entirely (b/c a new string is created) diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index 4d1ee8b3b6..3359ef3a9f 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -1459,6 +1459,10 @@ describe('render3 integration test', () => { fixture.update(); expect(fixture.html).toEqual(''); + fixture.component.time = 0; + fixture.update(); + expect(fixture.html).toEqual(''); + fixture.component.time = null; fixture.update(); expect(fixture.html).toEqual('');