@@ -52,21 +52,28 @@ describe('CloudinaryImageComponent render', () => {
5252 tick ( 0 ) ;
5353 const imgElement : HTMLImageElement = fixture . nativeElement ;
5454 const img = imgElement . querySelector ( 'img' ) ;
55- expect ( img . outerHTML ) . toBe ( '<img _ngcontent-a-c11="" alt="text text text" width="400px" height="500px"' +
56- ' loading="eager" src="https://res.cloudinary.com/demo/image/upload/sample">' ) ;
55+ expect ( img . getAttribute ( 'alt' ) ) . toBe ( 'text text text' ) ;
56+ expect ( img . getAttribute ( 'width' ) ) . toBe ( '400px' ) ;
57+ expect ( img . getAttribute ( 'height' ) ) . toBe ( '500px' ) ;
58+ expect ( img . getAttribute ( 'loading' ) ) . toBe ( 'eager' ) ;
59+ expect ( img . src ) . toBe ( 'https://res.cloudinary.com/demo/image/upload/sample' ) ;
5760 component . width = '800px' ;
5861 component . alt = 'updated alt text' ;
5962 component . height = '1000px' ;
6063 component . loading = 'lazy' ;
6164 component . ngOnChanges ( ) ;
62- expect ( img . outerHTML ) . toBe ( '<img _ngcontent-a-c11="" alt="updated alt text" width="800px" height="1000px"' +
63- ' loading="lazy" src="https://res.cloudinary.com/demo/image/upload/sample">' ) ;
65+ expect ( img . getAttribute ( 'alt' ) ) . toBe ( 'updated alt text' ) ;
66+ expect ( img . getAttribute ( 'width' ) ) . toBe ( '800px' ) ;
67+ expect ( img . getAttribute ( 'height' ) ) . toBe ( '1000px' ) ;
68+ expect ( img . getAttribute ( 'loading' ) ) . toBe ( 'lazy' ) ;
69+ expect ( img . src ) . toBe ( 'https://res.cloudinary.com/demo/image/upload/sample' ) ;
6470 component . width = undefined ;
6571 component . height = undefined ;
6672 component . alt = '' ;
6773 component . loading = 'lazy' ;
6874 component . ngOnChanges ( ) ;
69- expect ( img . outerHTML ) . toBe ( '<img _ngcontent-a-c11="" alt=""' +
70- ' loading="lazy" src="https://res.cloudinary.com/demo/image/upload/sample">' ) ;
75+ expect ( img . getAttribute ( 'alt' ) ) . toBe ( '' ) ;
76+ expect ( img . getAttribute ( 'loading' ) ) . toBe ( 'lazy' ) ;
77+ expect ( img . src ) . toBe ( 'https://res.cloudinary.com/demo/image/upload/sample' ) ;
7178 } ) ) ;
7279} ) ;
0 commit comments