Skip to content

Commit 47893b9

Browse files
style: Fix several styling issues (#16381)
The following styling issues are fixed: * CXSPA-896: Fix line break * CXSPA-896: Fix styles for conflict groups for intervals * CXSPA-896: Fix suggestion box style * CXSPA-896: Fix conflict navigation link style
1 parent d64708f commit 47893b9

9 files changed

+68
-9
lines changed

feature-libs/product-configurator/rulebased/components/conflict-suggestion/configurator-conflict-suggestion.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('ConfigurationConflictSuggestionComponent', () => {
3737
expect(component).toBeDefined();
3838
});
3939

40-
it('should return true for conflict group with more than one attribute', () => {
40+
it('should return true for conflict group with at least one attribute', () => {
4141
const conflictGroup1: Configurator.Group = {
4242
...ConfiguratorTestUtils.createGroup('1'),
4343
groupType: Configurator.GroupType.CONFLICT_GROUP,
@@ -48,7 +48,7 @@ describe('ConfigurationConflictSuggestionComponent', () => {
4848
groupType: Configurator.GroupType.CONFLICT_GROUP,
4949
attributes: [{ name: '1' }],
5050
};
51-
expect(component.displayConflictSuggestion(conflictGroup2)).toBe(false);
51+
expect(component.displayConflictSuggestion(conflictGroup2)).toBe(true);
5252
const conflictGroup3 = {
5353
...ConfiguratorTestUtils.createGroup('3'),
5454

feature-libs/product-configurator/rulebased/components/conflict-suggestion/configurator-conflict-suggestion.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ConfiguratorConflictSuggestionComponent {
3939
displayConflictSuggestion(group: Configurator.Group): boolean {
4040
return group.groupType === Configurator.GroupType.CONFLICT_GROUP &&
4141
group.attributes
42-
? group.attributes?.length > 1
42+
? group.attributes.length > 0
4343
: false;
4444
}
4545

feature-libs/product-configurator/rulebased/components/form/configurator-form.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-container *ngIf="configuration$ | async as configuration; else ghostForm">
22
<ng-container *ngIf="currentGroup$ | async as currentGroup">
33
<div id="{{ createGroupId(currentGroup.id) }}" role="tabpanel">
4-
<ng-container *ngIf="isConflictGroupType(currentGroup.groupType)">
4+
<ng-container *ngIf="displayConflictDescription(currentGroup)">
55
<cx-configurator-conflict-description
66
[currentGroup]="currentGroup"
77
></cx-configurator-conflict-description>

feature-libs/product-configurator/rulebased/components/form/configurator-form.component.spec.ts

+45
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ const configRead2: Configurator.Configuration = {
7474
groups: groups,
7575
};
7676

77+
const conflictGroup: Configurator.Group = {
78+
id: 'GROUP_ID_CONFLICT_1',
79+
name: 'The conflict text',
80+
groupType: Configurator.GroupType.CONFLICT_GROUP,
81+
subGroups: [],
82+
attributes: [
83+
{ name: 'ATTRIBUTE_1_CHECKBOX', key: 'ATTRIBUTE_1' },
84+
{ name: 'ATTRIBUTE_2_RADIOBUTTON', key: 'ATTRIBUTE_2' },
85+
],
86+
};
87+
7788
@Component({
7889
selector: 'cx-configurator-price',
7990
template: '',
@@ -566,4 +577,38 @@ describe('ConfigurationFormComponent', () => {
566577
}
567578
});
568579
});
580+
581+
describe('displayConflictDescription', () => {
582+
it('should return true if group is conflict group and has a name', () => {
583+
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
584+
true
585+
);
586+
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
587+
true
588+
);
589+
});
590+
it('should return false if group is standard group', () => {
591+
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
592+
false
593+
);
594+
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
595+
false
596+
);
597+
});
598+
it('should return false if group is conflict group and does not have a name', () => {
599+
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
600+
true
601+
);
602+
conflictGroup.name = '';
603+
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
604+
false
605+
);
606+
});
607+
it('should return false if group type is undefined', () => {
608+
conflictGroup.groupType = undefined;
609+
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
610+
false
611+
);
612+
});
613+
});
569614
});

feature-libs/product-configurator/rulebased/components/form/configurator-form.component.ts

+13
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ export class ConfiguratorFormComponent implements OnInit {
134134
return this.configuratorGroupsService.isConflictGroupType(groupType);
135135
}
136136

137+
/**
138+
* Display group description box only for conflict groups with a given group name (i.e. a conflict description)
139+
* @param group
140+
* @returns true if conflict description box should be displayed
141+
*/
142+
displayConflictDescription(group: Configurator.Group): boolean {
143+
return (
144+
group.groupType !== undefined &&
145+
this.configuratorGroupsService.isConflictGroupType(group.groupType) &&
146+
group.name !== ''
147+
);
148+
}
149+
137150
/**
138151
* Generates a group ID.
139152
*

feature-libs/product-configurator/rulebased/styles/_configurator-attribute-header.scss

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
.cx-action-link {
3939
color: var(--cx-color-text);
4040
font-size: 14px;
41+
min-height: 0px;
4142
}
4243
}
4344

feature-libs/product-configurator/rulebased/styles/_configurator-conflict-suggestion.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
padding-block-start: 15px;
1212
padding-block-end: 15px;
1313

14-
margin-inline-start: -20px;
15-
margin-inline-end: -20px;
14+
margin-inline-start: -15px;
15+
margin-inline-end: -15px;
1616

1717
@include forVersion(5.1) {
1818
margin-inline-start: -15px;

feature-libs/product-configurator/rulebased/styles/_configurator-overview-attribute.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.cx-attribute-value {
99
width: 50%;
1010
font-weight: 600;
11-
line-break: anywhere;
11+
line-break: normal;
1212
padding-inline-end: 10px;
1313
@include forVersion(5.1) {
1414
z-index: -6;
@@ -22,7 +22,7 @@
2222
.cx-attribute-label {
2323
width: 100%;
2424
padding-inline-end: 10px;
25-
line-break: anywhere;
25+
line-break: normal;
2626
color: var(--cx-color-secondary);
2727
@include forVersion(5.1) {
2828
z-index: -6;

feature-libs/product-configurator/rulebased/styles/mixins/_configurator-attribute-type.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
.cx-value-label-pair {
2222
width: 80%;
2323
padding-inline-end: 10px;
24-
line-break: anywhere;
24+
line-break: normal;
2525
}
2626

2727
.cx-value-price {

0 commit comments

Comments
 (0)