@@ -76,6 +76,14 @@ describe('MatIcon', () => {
76
76
sanitizer = ds ;
77
77
} ) ) ;
78
78
79
+ it ( 'should include notranslate class by default' , ( ) => {
80
+ let fixture = TestBed . createComponent ( IconWithColor ) ;
81
+
82
+ const matIconElement = fixture . debugElement . nativeElement . querySelector ( 'mat-icon' ) ;
83
+ expect ( matIconElement . classList . contains ( 'notranslate' ) )
84
+ . toBeTruthy ( 'Expected the mat-icon element to include the notranslate class' ) ;
85
+ } ) ;
86
+
79
87
it ( 'should apply class based on color attribute' , ( ) => {
80
88
let fixture = TestBed . createComponent ( IconWithColor ) ;
81
89
@@ -84,7 +92,8 @@ describe('MatIcon', () => {
84
92
testComponent . iconName = 'home' ;
85
93
testComponent . iconColor = 'primary' ;
86
94
fixture . detectChanges ( ) ;
87
- expect ( sortedClassNames ( matIconElement ) ) . toEqual ( [ 'mat-icon' , 'mat-primary' , 'material-icons' ] ) ;
95
+ expect ( sortedClassNames ( matIconElement ) )
96
+ . toEqual ( [ 'mat-icon' , 'mat-primary' , 'material-icons' , 'notranslate' ] ) ;
88
97
} ) ;
89
98
90
99
it ( 'should apply a class if there is no color' , ( ) => {
@@ -97,7 +106,7 @@ describe('MatIcon', () => {
97
106
fixture . detectChanges ( ) ;
98
107
99
108
expect ( sortedClassNames ( matIconElement ) )
100
- . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'material-icons' ] ) ;
109
+ . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'material-icons' , 'notranslate' ] ) ;
101
110
} ) ;
102
111
103
112
it ( 'should mark mat-icon as aria-hidden by default' , ( ) => {
@@ -135,7 +144,7 @@ describe('MatIcon', () => {
135
144
testComponent . iconName = 'home' ;
136
145
fixture . detectChanges ( ) ;
137
146
expect ( sortedClassNames ( matIconElement ) )
138
- . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'material-icons' ] ) ;
147
+ . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'material-icons' , 'notranslate' ] ) ;
139
148
} ) ;
140
149
141
150
it ( 'should use alternate icon font if set' , ( ) => {
@@ -147,7 +156,8 @@ describe('MatIcon', () => {
147
156
const matIconElement = fixture . debugElement . nativeElement . querySelector ( 'mat-icon' ) ;
148
157
testComponent . iconName = 'home' ;
149
158
fixture . detectChanges ( ) ;
150
- expect ( sortedClassNames ( matIconElement ) ) . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'myfont' ] ) ;
159
+ expect ( sortedClassNames ( matIconElement ) )
160
+ . toEqual ( [ 'mat-icon' , 'mat-icon-no-color' , 'myfont' , 'notranslate' ] ) ;
151
161
} ) ;
152
162
} ) ;
153
163
@@ -697,19 +707,19 @@ describe('MatIcon', () => {
697
707
testComponent . fontIcon = 'house' ;
698
708
fixture . detectChanges ( ) ;
699
709
expect ( sortedClassNames ( matIconElement ) )
700
- . toEqual ( [ 'font1' , 'house' , 'mat-icon' , 'mat-icon-no-color' ] ) ;
710
+ . toEqual ( [ 'font1' , 'house' , 'mat-icon' , 'mat-icon-no-color' , 'notranslate' ] ) ;
701
711
702
712
testComponent . fontSet = 'f2' ;
703
713
testComponent . fontIcon = 'igloo' ;
704
714
fixture . detectChanges ( ) ;
705
715
expect ( sortedClassNames ( matIconElement ) )
706
- . toEqual ( [ 'f2' , 'igloo' , 'mat-icon' , 'mat-icon-no-color' ] ) ;
716
+ . toEqual ( [ 'f2' , 'igloo' , 'mat-icon' , 'mat-icon-no-color' , 'notranslate' ] ) ;
707
717
708
718
testComponent . fontSet = 'f3' ;
709
719
testComponent . fontIcon = 'tent' ;
710
720
fixture . detectChanges ( ) ;
711
721
expect ( sortedClassNames ( matIconElement ) )
712
- . toEqual ( [ 'f3' , 'mat-icon' , 'mat-icon-no-color' , 'tent' ] ) ;
722
+ . toEqual ( [ 'f3' , 'mat-icon' , 'mat-icon-no-color' , 'notranslate' , ' tent'] ) ;
713
723
} ) ;
714
724
715
725
it ( 'should handle values with extraneous spaces being passed in to `fontSet`' , ( ) => {
@@ -721,15 +731,16 @@ describe('MatIcon', () => {
721
731
fixture . detectChanges ( ) ;
722
732
} ) . not . toThrow ( ) ;
723
733
724
- expect ( sortedClassNames ( matIconElement ) ) . toEqual ( [ 'font' , 'mat-icon' , 'mat-icon-no-color' ] ) ;
734
+ expect ( sortedClassNames ( matIconElement ) )
735
+ . toEqual ( [ 'font' , 'mat-icon' , 'mat-icon-no-color' , 'notranslate' ] ) ;
725
736
726
737
expect ( ( ) => {
727
738
fixture . componentInstance . fontSet = ' changed' ;
728
739
fixture . detectChanges ( ) ;
729
740
} ) . not . toThrow ( ) ;
730
741
731
742
expect ( sortedClassNames ( matIconElement ) )
732
- . toEqual ( [ 'changed' , 'mat-icon' , 'mat-icon-no-color' ] ) ;
743
+ . toEqual ( [ 'changed' , 'mat-icon' , 'mat-icon-no-color' , 'notranslate' ] ) ;
733
744
} ) ;
734
745
735
746
it ( 'should handle values with extraneous spaces being passed in to `fontIcon`' , ( ) => {
@@ -742,15 +753,15 @@ describe('MatIcon', () => {
742
753
} ) . not . toThrow ( ) ;
743
754
744
755
expect ( sortedClassNames ( matIconElement ) )
745
- . toEqual ( [ 'font' , 'mat-icon' , 'mat-icon-no-color' , 'material-icons' ] ) ;
756
+ . toEqual ( [ 'font' , 'mat-icon' , 'mat-icon-no-color' , 'material-icons' , 'notranslate '] ) ;
746
757
747
758
expect ( ( ) => {
748
759
fixture . componentInstance . fontIcon = ' changed' ;
749
760
fixture . detectChanges ( ) ;
750
761
} ) . not . toThrow ( ) ;
751
762
752
763
expect ( sortedClassNames ( matIconElement ) )
753
- . toEqual ( [ 'changed' , 'mat-icon' , 'mat-icon-no-color' , 'material-icons' ] ) ;
764
+ . toEqual ( [ 'changed' , 'mat-icon' , 'mat-icon-no-color' , 'material-icons' , 'notranslate '] ) ;
754
765
} ) ;
755
766
756
767
} ) ;
0 commit comments