From 32b4c518c9b4c402049c347039d2604a3f96e7e4 Mon Sep 17 00:00:00 2001 From: semisse Date: Tue, 22 Jul 2025 10:52:50 +0100 Subject: [PATCH] CSX-73 Date and Select Satori --- .../card-view-dateitem.component.html | 262 ++++++++++-------- .../card-view-dateitem.component.spec.ts | 9 +- .../card-view-selectitem.component.html | 85 +++--- .../card-view-selectitem.component.spec.ts | 13 +- 4 files changed, 200 insertions(+), 169 deletions(-) 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..93736d0a64 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 @@ -1,129 +1,151 @@ - - {{ property.label | translate }} - -
- + + + {{ property.label | translate }} + + + + +
+ +
+ + + + {{ property.label | translate }} + +
{{ property.displayValue }} - - - - {{ property.label | translate }} - -
- - - {{ property.displayValue }} - -
- - - clear - - - - -
- - {{ property.default | translate }} - - -
- - - {{ propertyValue }} - cancel - - - -
- - - -
+ + {{ property.displayValue }} + +
+ + + clear + + + + + + + + {{ property.default | translate }} + + +
+ + + {{ propertyValue }} + cancel + + + +
+ + +
diff --git a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts index 963f80a325..41248e72cb 100644 --- a/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts +++ b/lib/core/src/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts @@ -66,14 +66,14 @@ describe('CardViewDateItemComponent', () => { afterEach(() => fixture.destroy()); const getPropertyLabel = (): string => testingUtils.getInnerTextByCSS('.adf-property-label'); - const getPropertyValue = (): string => testingUtils.getInnerTextByCSS('.adf-property-value'); + const getPropertyInputValue = (): HTMLInputElement => testingUtils.getInputByCSS('.adf-property-value'); const getDateTime = (): string => testingUtils.getInnerTextByCSS('.adf-datepicker-span-button'); it('should render the label and value', () => { fixture.detectChanges(); expect(getPropertyLabel()).toBe('Date label'); - expect(getPropertyValue().trim()).toBe('Jul 10, 2017'); + expect(getPropertyInputValue().value.trim()).toBe('Jul 10, 2017'); }); it('should NOT render the default as value if the value is empty, editable:false and displayEmpty is false', () => { @@ -89,6 +89,7 @@ describe('CardViewDateItemComponent', () => { component.displayEmpty = false; fixture.detectChanges(); + const getPropertyValue = (): string => testingUtils.getInnerTextByCSS('.adf-property-value'); expect(getPropertyValue().trim()).toBe(''); }); @@ -105,7 +106,7 @@ describe('CardViewDateItemComponent', () => { component.displayEmpty = true; fixture.detectChanges(); - expect(getPropertyValue().trim()).toBe('FAKE-DEFAULT-KEY'); + expect(getPropertyInputValue().value.trim()).toBe('FAKE-DEFAULT-KEY'); }); it('should render the default as value if the value is empty and editable:true', () => { @@ -215,7 +216,7 @@ describe('CardViewDateItemComponent', () => { component.editable = false; fixture.detectChanges(); - testingUtils.doubleClickByDataAutomationId(`card-dateitem-${component.property.key}`); + testingUtils.doubleClickByDataAutomationId(`card-${component.property.type}-value-${component.property.key}`); fixture.detectChanges(); expect(clipboardService.copyContentToClipboard).toHaveBeenCalledWith('Jul 10, 2017', 'CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE'); diff --git a/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.html b/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.html index 617952bf48..a11d2d8856 100644 --- a/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.html +++ b/lib/core/src/lib/card-view/components/card-view-selectitem/card-view-selectitem.component.html @@ -1,48 +1,51 @@
-
{{ property.label | translate }} -
-
-
+ - {{ property.displayValue | async | translate }} -
-
- - {{ property.label | translate }} - - - - {{ 'CORE.CARDVIEW.NONE' | translate }} - - {{ option.label | translate }} - - - -
-
+ {{ property.label | translate }} + + + + + {{ property.label | translate }} + + + + {{ 'CORE.CARDVIEW.NONE' | translate }} + + {{ option.label | translate }} + + +
{ let loader: HarnessLoader; @@ -87,7 +87,8 @@ describe('CardViewSelectItemComponent', () => { editable: false }); fixture.detectChanges(); - expect(testingUtils.getInnerTextByCSS('.adf-property-label')).toBe('Select box label'); + + expect(testingUtils.getInnerTextByDataAutomationId('card-select-label-key')).toBe('Select box label'); }); it('should render readOnly value is editable property is FALSE', () => { @@ -111,7 +112,9 @@ describe('CardViewSelectItemComponent', () => { }); fixture.detectChanges(); - expect(getReadOnlyElement().nativeElement.title).toBe('Two'); + + const inputEl = getReadOnlyElement().nativeElement as HTMLInputElement; + expect(inputEl.value).toBe('Two'); }); it('should be possible edit selectBox item', async () => { @@ -286,7 +289,9 @@ describe('CardViewSelectItemComponent', () => { const autocompleteValueSpy = spyOn(cardViewUpdateService.autocompleteInputValue$, 'next'); component.editedValue = ''; component.editable = true; - component.ngOnChanges({ property: { firstChange: true } } as any); + component.ngOnChanges({ + property: new SimpleChange(undefined, component.property, true) + }); fixture.detectChanges(); component.autocompleteControl.setValue('new value');