@@ -9,7 +9,7 @@ import {Component, ErrorHandler, Provider, Type, ViewChild} from '@angular/core'
9
9
import { MAT_ICON_DEFAULT_OPTIONS , MAT_ICON_LOCATION , MatIconModule } from './index' ;
10
10
import { MatIconRegistry , getMatIconNoHttpProviderError } from './icon-registry' ;
11
11
import { FAKE_SVGS } from './fake-svgs' ;
12
- import { wrappedErrorMessage } from '../.. /cdk/testing/private' ;
12
+ import { wrappedErrorMessage } from '@angular /cdk/testing/private' ;
13
13
import { MatIcon } from './icon' ;
14
14
15
15
/** Returns the CSS classes assigned to an element as a sorted array. */
@@ -44,8 +44,7 @@ function verifyPathChildElement(element: Element, attributeValue: string): void
44
44
/** Creates a test component fixture. */
45
45
function createComponent < T > ( component : Type < T > , providers : Provider [ ] = [ ] ) {
46
46
TestBed . configureTestingModule ( {
47
- imports : [ MatIconModule ] ,
48
- declarations : [ component ] ,
47
+ imports : [ MatIconModule , component ] ,
49
48
providers : [ ...providers ] ,
50
49
} ) ;
51
50
@@ -65,8 +64,9 @@ describe('MatIcon', () => {
65
64
errorHandler = jasmine . createSpyObj ( 'errorHandler' , [ 'handleError' ] ) ;
66
65
67
66
TestBed . configureTestingModule ( {
68
- imports : [ HttpClientTestingModule , MatIconModule ] ,
69
- declarations : [
67
+ imports : [
68
+ HttpClientTestingModule ,
69
+ MatIconModule ,
70
70
IconWithColor ,
71
71
IconWithLigature ,
72
72
IconWithLigatureByAttribute ,
@@ -1297,6 +1297,13 @@ describe('MatIcon without HttpClientModule', () => {
1297
1297
let iconRegistry : MatIconRegistry ;
1298
1298
let sanitizer : DomSanitizer ;
1299
1299
1300
+ @Component ( {
1301
+ template : `<mat-icon [svgIcon]="iconName"></mat-icon>` ,
1302
+ } )
1303
+ class IconFromSvgName {
1304
+ iconName : string | undefined = '' ;
1305
+ }
1306
+
1300
1307
beforeEach ( waitForAsync ( ( ) => {
1301
1308
TestBed . configureTestingModule ( {
1302
1309
imports : [ MatIconModule ] ,
@@ -1390,58 +1397,102 @@ describe('MatIcon with default options', () => {
1390
1397
} ) ) ;
1391
1398
} ) ;
1392
1399
1393
- @Component ( { template : `<mat-icon>{{iconName}}</mat-icon>` } )
1400
+ @Component ( {
1401
+ template : `<mat-icon>{{iconName}}</mat-icon>` ,
1402
+ standalone : true ,
1403
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1404
+ } )
1394
1405
class IconWithLigature {
1395
1406
iconName = '' ;
1396
1407
}
1397
1408
1398
- @Component ( { template : `<mat-icon [fontIcon]="iconName"></mat-icon>` } )
1409
+ @Component ( {
1410
+ template : `<mat-icon [fontIcon]="iconName"></mat-icon>` ,
1411
+ standalone : true ,
1412
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1413
+ } )
1399
1414
class IconWithLigatureByAttribute {
1400
1415
iconName = '' ;
1401
1416
}
1402
1417
1403
- @Component ( { template : `<mat-icon [color]="iconColor">{{iconName}}</mat-icon>` } )
1418
+ @Component ( {
1419
+ template : `<mat-icon [color]="iconColor">{{iconName}}</mat-icon>` ,
1420
+ standalone : true ,
1421
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1422
+ } )
1404
1423
class IconWithColor {
1405
1424
iconName = '' ;
1406
1425
iconColor = 'primary' ;
1407
1426
}
1408
1427
1409
- @Component ( { template : `<mat-icon [fontSet]="fontSet" [fontIcon]="fontIcon"></mat-icon>` } )
1428
+ @Component ( {
1429
+ template : `<mat-icon [fontSet]="fontSet" [fontIcon]="fontIcon"></mat-icon>` ,
1430
+ standalone : true ,
1431
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1432
+ } )
1410
1433
class IconWithCustomFontCss {
1411
1434
fontSet = '' ;
1412
1435
fontIcon = '' ;
1413
1436
}
1414
1437
1415
- @Component ( { template : `<mat-icon [svgIcon]="iconName"></mat-icon>` } )
1438
+ @Component ( {
1439
+ template : `<mat-icon [svgIcon]="iconName"></mat-icon>` ,
1440
+ standalone : true ,
1441
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1442
+ } )
1416
1443
class IconFromSvgName {
1417
1444
iconName : string | undefined = '' ;
1418
1445
}
1419
1446
1420
- @Component ( { template : '<mat-icon aria-hidden="false">face</mat-icon>' } )
1447
+ @Component ( {
1448
+ template : '<mat-icon aria-hidden="false">face</mat-icon>' ,
1449
+ standalone : true ,
1450
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1451
+ } )
1421
1452
class IconWithAriaHiddenFalse { }
1422
1453
1423
- @Component ( { template : `@if (showIcon) {<mat-icon [svgIcon]="iconName">{{iconName}}</mat-icon>}` } )
1454
+ @Component ( {
1455
+ template : `@if (showIcon) {<mat-icon [svgIcon]="iconName">{{iconName}}</mat-icon>}` ,
1456
+ standalone : true ,
1457
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1458
+ } )
1424
1459
class IconWithBindingAndNgIf {
1425
1460
iconName = 'fluffy' ;
1426
1461
showIcon = true ;
1427
1462
}
1428
1463
1429
- @Component ( { template : `<mat-icon [inline]="inline">{{iconName}}</mat-icon>` } )
1464
+ @Component ( {
1465
+ template : `<mat-icon [inline]="inline">{{iconName}}</mat-icon>` ,
1466
+ standalone : true ,
1467
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1468
+ } )
1430
1469
class InlineIcon {
1431
1470
inline = false ;
1432
1471
}
1433
1472
1434
- @Component ( { template : `<mat-icon [svgIcon]="iconName"><div>Hello</div></mat-icon>` } )
1473
+ @Component ( {
1474
+ template : `<mat-icon [svgIcon]="iconName"><div>Hello</div></mat-icon>` ,
1475
+ standalone : true ,
1476
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1477
+ } )
1435
1478
class SvgIconWithUserContent {
1436
1479
iconName : string | undefined = '' ;
1437
1480
}
1438
1481
1439
- @Component ( { template : '<mat-icon [svgIcon]="iconName">house</mat-icon>' } )
1482
+ @Component ( {
1483
+ template : '<mat-icon [svgIcon]="iconName">house</mat-icon>' ,
1484
+ standalone : true ,
1485
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1486
+ } )
1440
1487
class IconWithLigatureAndSvgBinding {
1441
1488
iconName : string | undefined ;
1442
1489
}
1443
1490
1444
- @Component ( { template : `<mat-icon></mat-icon>` } )
1491
+ @Component ( {
1492
+ template : `<mat-icon></mat-icon>` ,
1493
+ standalone : true ,
1494
+ imports : [ HttpClientTestingModule , MatIconModule ] ,
1495
+ } )
1445
1496
class BlankIcon {
1446
1497
@ViewChild ( MatIcon ) icon : MatIcon ;
1447
1498
}
0 commit comments