@@ -11,21 +11,15 @@ describe("GH001: No Default Alt Text", () => {
1111 ] ;
1212
1313 const results = await runTest ( strings , altTextRule ) ;
14-
15- for ( const result of results ) {
16- expect ( result ) . not . toBeDefined ( ) ;
17- }
14+ expect ( results . length ) . toBe ( 0 ) ;
1815 } ) ;
1916 test ( "html image" , async ( ) => {
2017 const strings = [
2118 '<img alt="A helpful description" src="https://user-images.githubusercontent.com/abcdef.png">' ,
2219 ] ;
2320
2421 const results = await runTest ( strings , altTextRule ) ;
25-
26- for ( const result of results ) {
27- expect ( result ) . not . toBeDefined ( ) ;
28- }
22+ expect ( results . length ) . toBe ( 0 ) ;
2923 } ) ;
3024 } ) ;
3125 describe ( "failures" , ( ) => {
@@ -77,6 +71,17 @@ describe("GH001: No Default Alt Text", () => {
7771 }
7872 } ) ;
7973
74+ test ( "flags multiple consecutive inline images" , async ( ) => {
75+ const strings = [ '<img alt="image"><img alt="Image">' ] ;
76+ const results = await runTest ( strings , altTextRule ) ;
77+ expect ( results ) . toHaveLength ( 2 ) ;
78+
79+ expect ( results [ 0 ] . errorRange ) . toEqual ( [ 11 , 5 ] ) ;
80+ expect ( results [ 0 ] . errorDetail ) . toEqual ( "Flagged alt: image" ) ;
81+ expect ( results [ 1 ] . errorRange ) . toEqual ( [ 28 , 5 ] ) ;
82+ expect ( results [ 1 ] . errorDetail ) . toEqual ( "Flagged alt: Image" ) ;
83+ } ) ;
84+
8085 test ( "error message" , async ( ) => {
8186 const strings = [
8287 "" ,
0 commit comments