@@ -86,78 +86,88 @@ describe('getName', () => {
8686describe ( 'addIcons' , ( ) => {
8787 it ( 'should add an svg to the icon cache' , ( ) => {
8888 const testData = 'stubbed data' ;
89-
89+
9090 expect ( getIconMap ( ) . get ( 'logo-ionic' ) ) . toEqual ( undefined ) ;
91-
91+
9292 addIcons ( { 'logo-ionic' : 'stubbed data' } ) ;
93-
93+
9494 expect ( getIconMap ( ) . get ( 'logo-ionic' ) ) . toEqual ( testData ) ;
9595 } ) ;
96-
96+
9797 it ( 'should add kebab and camel case names to the icon cache' , ( ) => {
9898 const logoIonitron = 'stubbed data' ;
99-
99+
100100 expect ( getIconMap ( ) . get ( 'logo-ionitron' ) ) . toEqual ( undefined ) ;
101101 expect ( getIconMap ( ) . get ( 'logoIonitron' ) ) . toEqual ( undefined ) ;
102-
102+
103103 addIcons ( { logoIonitron } ) ;
104-
104+
105105 expect ( getIconMap ( ) . get ( 'logo-ionitron' ) ) . toEqual ( logoIonitron ) ;
106106 expect ( getIconMap ( ) . get ( 'logoIonitron' ) ) . toEqual ( logoIonitron ) ;
107+
108+ const logoIonitron0 = 'stubbed data 0'
109+
110+ expect ( getIconMap ( ) . get ( 'logo-ionitron-0' ) ) . toEqual ( undefined ) ;
111+ expect ( getIconMap ( ) . get ( 'logoIonitron0' ) ) . toEqual ( undefined ) ;
112+
113+ addIcons ( { logoIonitron0 } ) ;
114+
115+ expect ( getIconMap ( ) . get ( 'logo-ionitron-0' ) ) . toEqual ( logoIonitron0 ) ;
116+ expect ( getIconMap ( ) . get ( 'logoIonitron0' ) ) . toEqual ( logoIonitron0 ) ;
107117 } ) ;
108-
118+
109119 it ( 'should map to a name that does not match the svg' , ( ) => {
110120 const logoIonitron = 'stubbed data' ;
111-
121+
112122 expect ( getIconMap ( ) . get ( 'my-fun-icon' ) ) . toEqual ( undefined ) ;
113-
123+
114124 addIcons ( { 'my-fun-icon' : logoIonitron } ) ;
115-
125+
116126 expect ( getIconMap ( ) . get ( 'my-fun-icon' ) ) . toEqual ( logoIonitron ) ;
117127 } ) ;
118-
128+
119129 it ( 'should map to an explicit camel case name' , ( ) => {
120130 const logoIonitron = 'stubbed data' ;
121-
131+
122132 expect ( getIconMap ( ) . get ( 'myCoolIcon' ) ) . toEqual ( undefined ) ;
123-
133+
124134 addIcons ( { 'myCoolIcon' : logoIonitron } ) ;
125-
135+
126136 expect ( getIconMap ( ) . get ( 'myCoolIcon' ) ) . toEqual ( logoIonitron ) ;
127137 } ) ;
128-
138+
129139 it ( 'should not warn when mapping the same icon twice' , ( ) => {
130140 const spy = jest . spyOn ( console , 'warn' ) ;
131141
132142 const myIcon = 'my-icon' ;
133-
143+
134144 expect ( spy ) . not . toHaveBeenCalled ( ) ;
135-
145+
136146 addIcons ( { myIcon } ) ;
137-
147+
138148 expect ( spy ) . not . toHaveBeenCalled ( ) ;
139-
149+
140150 addIcons ( { myIcon } ) ;
141-
151+
142152 expect ( spy ) . not . toHaveBeenCalled ( ) ;
143153 } ) ;
144-
154+
145155 it ( 'should not overwrite icons' , ( ) => {
146156 const spy = jest . spyOn ( console , 'warn' ) ;
147-
157+
148158 const logoA = 'logo a' ;
149159 const logoB = 'logo b' ;
150-
160+
151161 expect ( spy ) . not . toHaveBeenCalled ( ) ;
152-
162+
153163 expect ( getIconMap ( ) . get ( 'logo-a' ) ) . toEqual ( undefined ) ;
154-
164+
155165 addIcons ( { 'logo-a' : logoB , logoA } ) ;
156-
166+
157167 expect ( getIconMap ( ) . get ( 'logo-a' ) ) . toEqual ( logoB ) ;
158168 expect ( getIconMap ( ) . get ( 'logoA' ) ) . toEqual ( logoA ) ;
159-
169+
160170 expect ( spy ) . toHaveBeenCalled ( ) ;
161171 } ) ;
162-
172+
163173} ) ;
0 commit comments