Skip to content

Commit f088b50

Browse files
Merge branch 'main' into deprecate-autofocus
2 parents 5bb4c65 + 801c2d8 commit f088b50

22 files changed

+327
-292
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
4+
import { SkyIconModule } from '../icon.module';
5+
6+
import { IconTestComponent } from './icon.component.fixture';
7+
8+
@NgModule({
9+
declarations: [IconTestComponent],
10+
imports: [CommonModule, SkyIconModule],
11+
})
12+
export class SkyIconFixturesModule {}

libs/components/indicators/src/lib/modules/icon/fixtures/icon.component.fixture.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { SkyIconVariantType } from '../types/icon-variant-type';
88
})
99
export class IconTestComponent {
1010
public icon = 'circle';
11-
public iconType: 'fa' | 'skyux';
12-
public size = '3x';
13-
public fixedWidth = false;
14-
public variant: SkyIconVariantType;
11+
public iconType: 'fa' | 'skyux' | undefined;
12+
public size: string | undefined = '3x';
13+
public fixedWidth: boolean | undefined = false;
14+
public variant: SkyIconVariantType | undefined;
1515
}

libs/components/indicators/src/lib/modules/icon/icon-stack.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class SkyIconStackComponent {
1616
* [Font Awesome sizes](https://fontawesome.com/how-to-use/on-the-web/styling/sizing-icons).
1717
*/
1818
@Input()
19-
public size: string;
19+
public size: string | undefined;
2020

2121
/**
2222
* The icon to display at the bottom of the stack.

libs/components/indicators/src/lib/modules/icon/icon.component.spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
22
import { expect } from '@skyux-sdk/testing';
33

4+
import { SkyIconFixturesModule } from './fixtures/icon-fixtures.module';
45
import { IconTestComponent } from './fixtures/icon.component.fixture';
56
import { SkyIconResolverService } from './icon-resolver.service';
6-
import { SkyIconModule } from './icon.module';
77

88
describe('Icon component', () => {
99
let fixture: ComponentFixture<IconTestComponent>;
@@ -23,8 +23,7 @@ describe('Icon component', () => {
2323
});
2424

2525
TestBed.configureTestingModule({
26-
declarations: [IconTestComponent],
27-
imports: [SkyIconModule],
26+
imports: [SkyIconFixturesModule],
2827
providers: [
2928
{
3029
provide: SkyIconResolverService,
@@ -43,10 +42,10 @@ describe('Icon component', () => {
4342
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-circle');
4443
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-3x');
4544
expect(element.querySelector('.sky-icon')).not.toHaveCssClass('fa-fw');
46-
expect(element.querySelector('.sky-icon').getAttribute('aria-hidden')).toBe(
47-
'true'
48-
);
49-
expect(element.querySelector('.sky-icon').classList.length).toBe(4);
45+
expect(
46+
element.querySelector('.sky-icon')?.getAttribute('aria-hidden')
47+
).toBe('true');
48+
expect(element.querySelector('.sky-icon')?.classList.length).toBe(4);
5049

5150
// Accessibility checks
5251
fixture.whenStable().then(() => {
@@ -64,10 +63,10 @@ describe('Icon component', () => {
6463
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-broom');
6564
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-5x');
6665
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-fw');
67-
expect(element.querySelector('.sky-icon').classList.length).toBe(5);
68-
expect(element.querySelector('.sky-icon').getAttribute('aria-hidden')).toBe(
69-
'true'
70-
);
66+
expect(element.querySelector('.sky-icon')?.classList.length).toBe(5);
67+
expect(
68+
element.querySelector('.sky-icon')?.getAttribute('aria-hidden')
69+
).toBe('true');
7170
});
7271

7372
it('should show an icon without optional inputs', () => {
@@ -77,7 +76,7 @@ describe('Icon component', () => {
7776
fixture.detectChanges();
7877

7978
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-spinner');
80-
expect(element.querySelector('.sky-icon').classList.length).toBe(3);
79+
expect(element.querySelector('.sky-icon')?.classList.length).toBe(3);
8180
});
8281

8382
it('should display the specified variant', () => {

libs/components/indicators/src/lib/modules/icon/icon.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ export class SkyIconComponent {
2626
* @default "fa"
2727
*/
2828
@Input()
29-
public iconType: SkyIconType = 'fa';
29+
public iconType: SkyIconType | undefined;
3030

3131
/**
3232
* Specifies the size of the icon using
3333
* [Font Awesome sizes](https://fontawesome.com/how-to-use/on-the-web/styling/sizing-icons). Do not prefix the size with `fa-`.
3434
*/
3535
@Input()
36-
public size: string;
36+
public size: string | undefined;
3737

3838
/**
3939
* Indicates whether the icon has a fixed width.
4040
* @default false
4141
*/
4242
@Input()
43-
public fixedWidth: boolean;
43+
public fixedWidth: boolean | undefined;
4444

4545
/**
4646
* Specifies the icon variant (`"line"` or `"solid"`). If the variant doesn't exist for the
4747
* specified icon, the normal icon is displayed. This property only applies when using SKY UX icons.
4848
*/
4949
@Input()
50-
public variant: SkyIconVariantType;
50+
public variant: SkyIconVariantType | undefined;
5151
}

libs/components/indicators/src/lib/modules/label/fixtures/label.component.fixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { SkyLabelType } from '../label-type';
88
templateUrl: './label.component.fixture.html',
99
})
1010
export class LabelTestComponent {
11-
public labelType: SkyLabelType = 'info';
11+
public labelType: SkyLabelType | undefined = 'info';
1212
public descriptionType: SkyIndicatorDescriptionType | undefined;
1313
public customDescription: string | undefined;
1414
}

libs/components/indicators/src/lib/modules/status-indicator/status-indicator.component.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Status indicator component', () => {
2323

2424
function validateIconWrapperClass(
2525
statusIndicatorEl: HTMLElement,
26-
indicatorType: string
26+
indicatorType: string | undefined
2727
): void {
2828
const iconWrapperEl = statusIndicatorEl.querySelector(
2929
'.sky-status-indicator-icon'
@@ -36,7 +36,7 @@ describe('Status indicator component', () => {
3636

3737
function validateIcon(
3838
fixture: ComponentFixture<StatusIndicatorTestComponent>,
39-
indicatorType: string,
39+
indicatorType: string | undefined,
4040
expectedIcon: string
4141
): void {
4242
let statusIndicatorEl;
@@ -109,7 +109,7 @@ describe('Status indicator component', () => {
109109
);
110110

111111
// Check exact text content here to ensure it has been trimmed by the skyTrim directive.
112-
expect(messageEl.textContent).toBe('Indicator text');
112+
expect(messageEl?.textContent).toBe('Indicator text');
113113
});
114114

115115
it('should display the expected icon', () => {
@@ -178,7 +178,7 @@ describe('Status indicator component', () => {
178178
describe('when modern theme', () => {
179179
function validateIconStack(
180180
fixture: ComponentFixture<StatusIndicatorTestComponent>,
181-
indicatorType: string,
181+
indicatorType: string | undefined,
182182
expectedBaseIcon: string,
183183
expectedTopIcon: string
184184
): void {
@@ -192,8 +192,8 @@ describe('Status indicator component', () => {
192192

193193
const iconStackEl = statusIndicatorEl.querySelector('.sky-icon-stack');
194194

195-
const baseIconEl = iconStackEl.querySelector('.fa-stack-2x');
196-
const topIconEl = iconStackEl.querySelector('.fa-stack-1x');
195+
const baseIconEl = iconStackEl?.querySelector('.fa-stack-2x');
196+
const topIconEl = iconStackEl?.querySelector('.fa-stack-1x');
197197

198198
expect(baseIconEl).toHaveCssClass(`sky-i-${expectedBaseIcon}`);
199199
expect(topIconEl).toHaveCssClass(`sky-i-${expectedTopIcon}`);

libs/components/indicators/src/lib/modules/status-indicator/status-indicator.component.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ export class SkyStatusIndicatorComponent implements OnInit {
4444
* @required
4545
*/
4646
@Input()
47-
public set descriptionType(value: SkyIndicatorDescriptionType) {
47+
public set descriptionType(value: SkyIndicatorDescriptionType | undefined) {
4848
this.#_descriptionType = value;
4949
this.#updateDescriptionComputed();
5050
}
5151

52-
public get descriptionType(): SkyIndicatorDescriptionType {
52+
public get descriptionType(): SkyIndicatorDescriptionType | undefined {
5353
return this.#_descriptionType;
5454
}
5555

@@ -58,39 +58,37 @@ export class SkyStatusIndicatorComponent implements OnInit {
5858
* the indicator icon when `descriptionType` is `custom`.
5959
*/
6060
@Input()
61-
public set customDescription(value: string) {
61+
public set customDescription(value: string | undefined) {
6262
this.#_customDescription = value;
6363
this.#updateDescriptionComputed();
6464
}
6565

66-
public get customDescription(): string {
66+
public get customDescription(): string | undefined {
6767
return this.#_customDescription;
6868
}
6969

70-
public descriptionComputed: string;
70+
public descriptionComputed: string | undefined;
7171

72-
public baseIcon: SkyIconStackItem;
72+
public baseIcon: SkyIconStackItem | undefined;
7373

74-
public icon: string;
74+
public icon: string | undefined;
7575

7676
public indicatorTypeOrDefault: SkyIndicatorIconType = INDICATOR_TYPE_DEFAULT;
7777

78-
public topIcon: SkyIconStackItem;
78+
public topIcon: SkyIconStackItem | undefined;
7979

8080
#changeDetector: ChangeDetectorRef;
81+
#resourcesSvc: SkyLibResourcesService;
8182

82-
#resources: SkyLibResourcesService;
83-
84-
#_descriptionType: SkyIndicatorDescriptionType;
85-
86-
#_customDescription: string;
83+
#_descriptionType: SkyIndicatorDescriptionType | undefined;
84+
#_customDescription: string | undefined;
8785

8886
constructor(
8987
changeDetector: ChangeDetectorRef,
9088
resources: SkyLibResourcesService
9189
) {
9290
this.#changeDetector = changeDetector;
93-
this.#resources = resources;
91+
this.#resourcesSvc = resources;
9492
}
9593

9694
public ngOnInit(): void {
@@ -117,7 +115,7 @@ export class SkyStatusIndicatorComponent implements OnInit {
117115
this.descriptionComputed = this.customDescription;
118116
break;
119117
default:
120-
this.#resources
118+
this.#resourcesSvc
121119
.getString(
122120
'skyux_status_indicator_sr_' +
123121
this.descriptionType.replace(/-/g, '_')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<sky-token [ariaLabel]="ariaLabel"></sky-token>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component, Input } from '@angular/core';
2+
3+
@Component({
4+
templateUrl: './token.component.fixture.html',
5+
})
6+
export class SkyTokenTestComponent {
7+
@Input()
8+
public ariaLabel: string | undefined;
9+
}

0 commit comments

Comments
 (0)