File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
projects/igniteui-angular/src/lib Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,28 @@ describe('Avatar', () => {
170170
171171 expect ( instance . src ) . toEqual ( "/assets/Test%20-%2017.jpg" ) ;
172172 } ) ;
173+
174+ it ( 'should not throw error if src is null' , ( ) => {
175+ const fixture = TestBed . createComponent ( InitImageAvatarComponent ) ;
176+ fixture . detectChanges ( ) ;
177+ expect ( ( ) => {
178+ const instance = fixture . componentInstance . avatar ;
179+ instance . src = null ;
180+ fixture . detectChanges ( ) ;
181+ } ) . not . toThrow ( ) ;
182+ } ) ;
183+
184+ it ( 'avatar with [src] and fallback [initials] should not throw error if src is null' , ( ) => {
185+ const fixture = TestBed . createComponent ( AvatarWithAttribsComponent ) ;
186+ fixture . detectChanges ( ) ;
187+ const instance = fixture . componentInstance . avatar ;
188+ expect ( instance . type ) . toEqual ( IgxAvatarType . INITIALS ) ;
189+ expect ( instance . initials ) . toEqual ( 'ZK' ) ;
190+ expect ( ( ) => {
191+ instance . src = null ;
192+ fixture . detectChanges ( ) ;
193+ } ) . not . toThrow ( ) ;
194+ } ) ;
173195} ) ;
174196
175197@Component ( {
Original file line number Diff line number Diff line change @@ -655,6 +655,6 @@ export function getComponentCssSizeVar(size: string) {
655655 * @param path - The URI path to be normalized.
656656 * @returns string encoded using the encodeURI function.
657657 */
658- export function normalizeURI ( path : string ) {
659- return path . split ( '/' ) . map ( encodeURI ) . join ( '/' ) ;
660- }
658+ export function normalizeURI ( path : string ) {
659+ return path ? .split ( '/' ) . map ( encodeURI ) . join ( '/' ) ;
660+ }
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ <h4 class="sample-title">Square Avatars</h4>
6262
6363 < igx-avatar initials ="AZ " size ="medium "> </ igx-avatar >
6464
65- < igx-avatar initials ="AZ " size ="large "> </ igx-avatar >
65+ < igx-avatar [src] =" null " initials ="AZ " size ="large "> </ igx-avatar >
6666
6767 < igx-avatar src ="assets/images/avatar/18.jpg " size ="small "> </ igx-avatar >
6868
You can’t perform that action at this time.
0 commit comments