Skip to content

Commit

Permalink
style: Fix several styling issues (#16381)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
steinsebastian authored Nov 8, 2022
1 parent d64708f commit 47893b9
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('ConfigurationConflictSuggestionComponent', () => {
expect(component).toBeDefined();
});

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ConfiguratorConflictSuggestionComponent {
displayConflictSuggestion(group: Configurator.Group): boolean {
return group.groupType === Configurator.GroupType.CONFLICT_GROUP &&
group.attributes
? group.attributes?.length > 1
? group.attributes.length > 0
: false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ng-container *ngIf="configuration$ | async as configuration; else ghostForm">
<ng-container *ngIf="currentGroup$ | async as currentGroup">
<div id="{{ createGroupId(currentGroup.id) }}" role="tabpanel">
<ng-container *ngIf="isConflictGroupType(currentGroup.groupType)">
<ng-container *ngIf="displayConflictDescription(currentGroup)">
<cx-configurator-conflict-description
[currentGroup]="currentGroup"
></cx-configurator-conflict-description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ const configRead2: Configurator.Configuration = {
groups: groups,
};

const conflictGroup: Configurator.Group = {
id: 'GROUP_ID_CONFLICT_1',
name: 'The conflict text',
groupType: Configurator.GroupType.CONFLICT_GROUP,
subGroups: [],
attributes: [
{ name: 'ATTRIBUTE_1_CHECKBOX', key: 'ATTRIBUTE_1' },
{ name: 'ATTRIBUTE_2_RADIOBUTTON', key: 'ATTRIBUTE_2' },
],
};

@Component({
selector: 'cx-configurator-price',
template: '',
Expand Down Expand Up @@ -566,4 +577,38 @@ describe('ConfigurationFormComponent', () => {
}
});
});

describe('displayConflictDescription', () => {
it('should return true if group is conflict group and has a name', () => {
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
true
);
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
true
);
});
it('should return false if group is standard group', () => {
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
false
);
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
false
);
});
it('should return false if group is conflict group and does not have a name', () => {
spyOn(configuratorGroupsService, 'isConflictGroupType').and.returnValue(
true
);
conflictGroup.name = '';
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
false
);
});
it('should return false if group type is undefined', () => {
conflictGroup.groupType = undefined;
expect(createComponent().displayConflictDescription(conflictGroup)).toBe(
false
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ export class ConfiguratorFormComponent implements OnInit {
return this.configuratorGroupsService.isConflictGroupType(groupType);
}

/**
* Display group description box only for conflict groups with a given group name (i.e. a conflict description)
* @param group
* @returns true if conflict description box should be displayed
*/
displayConflictDescription(group: Configurator.Group): boolean {
return (
group.groupType !== undefined &&
this.configuratorGroupsService.isConflictGroupType(group.groupType) &&
group.name !== ''
);
}

/**
* Generates a group ID.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
.cx-action-link {
color: var(--cx-color-text);
font-size: 14px;
min-height: 0px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
padding-block-start: 15px;
padding-block-end: 15px;

margin-inline-start: -20px;
margin-inline-end: -20px;
margin-inline-start: -15px;
margin-inline-end: -15px;

@include forVersion(5.1) {
margin-inline-start: -15px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.cx-attribute-value {
width: 50%;
font-weight: 600;
line-break: anywhere;
line-break: normal;
padding-inline-end: 10px;
@include forVersion(5.1) {
z-index: -6;
Expand All @@ -22,7 +22,7 @@
.cx-attribute-label {
width: 100%;
padding-inline-end: 10px;
line-break: anywhere;
line-break: normal;
color: var(--cx-color-secondary);
@include forVersion(5.1) {
z-index: -6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.cx-value-label-pair {
width: 80%;
padding-inline-end: 10px;
line-break: anywhere;
line-break: normal;
}

.cx-value-price {
Expand Down

0 comments on commit 47893b9

Please sign in to comment.