From 9deaab4c11ffe131048ed50c801f99d9a678bc97 Mon Sep 17 00:00:00 2001 From: Darren Thornton <6361057+dthornton-hyl@users.noreply.github.com> Date: Fri, 15 Aug 2025 19:03:12 -0500 Subject: [PATCH] AAE-37006 Fix floating label overlapping in dateitem component (#11118) --- .../card-view-dateitem.component.html | 2 +- .../card-view-dateitem.component.spec.ts | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.html b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.html index 4d532411ae..aa09c74d5e 100644 --- a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.html +++ b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.html @@ -19,7 +19,7 @@ >{{ property.displayValue }} - + { expect(await chips[1].getText()).toBe('Jul 11, 2017, 0:01'); expect(await chips[2].getText()).toBe('Jul 12, 2017, 0:01'); }); + + describe('FloatLabel behavior', () => { + it('should set floatLabel to "always" when property has default value and is editable', async () => { + component.property = new CardViewDateItemModel({ + label: 'Date label', + value: new Date('07/10/2017'), + key: 'dateKey', + default: 'Default Value', + format: '', + editable: true + }); + component.editable = true; + fixture.detectChanges(); + + const matFormField = await testingUtils.getMatFormField(); + const host = await matFormField.host(); + const floatLabel = await host.getAttribute('ng-reflect-float-label'); + + expect(floatLabel).toBe('always'); + }); + + it('should set floatLabel to null when property has no default value and is editable', async () => { + component.property = new CardViewDateItemModel({ + label: 'Date label', + value: new Date('07/10/2017'), + key: 'dateKey', + default: '', + format: '', + editable: true + }); + component.editable = true; + fixture.detectChanges(); + + const matFormField = await testingUtils.getMatFormField(); + const host = await matFormField.host(); + const floatLabel = await host.getAttribute('ng-reflect-float-label'); + + expect(floatLabel).toBe(null); + }); + + it('should set floatLabel to null when property has null default value and is editable', async () => { + component.property = new CardViewDateItemModel({ + label: 'Date label', + value: new Date('07/10/2017'), + key: 'dateKey', + default: null, + format: '', + editable: true + }); + component.editable = true; + fixture.detectChanges(); + + const matFormField = await testingUtils.getMatFormField(); + const host = await matFormField.host(); + const floatLabel = await host.getAttribute('ng-reflect-float-label'); + + expect(floatLabel).toBe(null); + }); + }); });