Skip to content

Commit 3644555

Browse files
fix(components/errors): remove extra whitespace around error description (#733)
The error component's description previously added extra whitespace to the start and end of the description text. BREAKING CHANGE: Unit tests that expect this extra whitespace will need to be updated.
1 parent 4726ada commit 3644555

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

libs/components/errors/src/lib/modules/error/error.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
<div class="sky-error-title sky-font-heading-1 sky-margin-stacked-lg">
1515
<ng-container
1616
*ngIf="defaultTitle && (errorSvc.replaceDefaultTitle | async) === false"
17+
>{{ defaultTitle }}</ng-container
1718
>
18-
{{ defaultTitle }}
19-
</ng-container>
2019
<ng-content select="sky-error-title"></ng-content>
2120
</div>
2221

@@ -28,9 +27,8 @@
2827
defaultDescription &&
2928
(errorSvc.replaceDefaultDescription | async) === false
3029
"
30+
>{{ defaultDescription }}</span
3131
>
32-
{{ defaultDescription }}
33-
</span>
3432
<ng-content select="sky-error-description"></ng-content>
3533
</div>
3634

libs/components/errors/src/lib/modules/error/error.component.spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ describe('Error component', () => {
203203
);
204204
});
205205

206+
it('should not add extraneous whitespace around description', () => {
207+
component.errorType = 'broken';
208+
fixture.detectChanges();
209+
210+
expect(getErrorDescription('#test-error').innerText).toBe(
211+
resourceStrings.brokenDescription
212+
);
213+
});
214+
206215
it('should replace title and description', () => {
207216
component.errorType = 'broken';
208217
component.replaceDefaultDescription = true;
@@ -246,12 +255,12 @@ describe('Error component', () => {
246255
).not.toExist();
247256

248257
expect(getErrorTitle('#test-error-custom-replace-default')).toHaveText(
249-
`${resourceStrings.brokenTitle} ${component.customTitle}`
258+
`${resourceStrings.brokenTitle} ${component.customTitle}`
250259
);
251260
expect(
252261
getErrorDescription('#test-error-custom-replace-default')
253262
).toHaveText(
254-
`${resourceStrings.brokenDescription} ${component.customDescription}`
263+
`${resourceStrings.brokenDescription} ${component.customDescription}`
255264
);
256265
});
257266

0 commit comments

Comments
 (0)