@@ -18,6 +18,7 @@ describe("GH003: No Empty String Alt", () => {
18
18
const strings = [
19
19
'<img alt="" src="https://user-images.githubusercontent.com/abcdef.png">' ,
20
20
"<img alt='' src='https://user-images.githubusercontent.com/abcdef.png'>" ,
21
+ '<img src="cat.png" alt="" /> <img src="dog.png" alt="" />' ,
21
22
] ;
22
23
23
24
const results = await runTest ( strings , noEmptyStringAltRule ) ;
@@ -27,7 +28,7 @@ describe("GH003: No Empty String Alt", () => {
27
28
. flat ( )
28
29
. filter ( ( name ) => ! name . includes ( "GH" ) ) ;
29
30
30
- expect ( failedRules ) . toHaveLength ( 2 ) ;
31
+ expect ( failedRules ) . toHaveLength ( 4 ) ;
31
32
for ( const rule of failedRules ) {
32
33
expect ( rule ) . toBe ( "no-empty-string-alt" ) ;
33
34
}
@@ -36,6 +37,7 @@ describe("GH003: No Empty String Alt", () => {
36
37
test ( "error message" , async ( ) => {
37
38
const strings = [
38
39
'<img alt="" src="https://user-images.githubusercontent.com/abcdef.png">' ,
40
+ '<img src="cat.png" alt="" /> <img src="dog.png" alt="" />' ,
39
41
] ;
40
42
41
43
const results = await runTest ( strings , noEmptyStringAltRule ) ;
@@ -44,6 +46,15 @@ describe("GH003: No Empty String Alt", () => {
44
46
"Please provide an alternative text for the image." ,
45
47
) ;
46
48
expect ( results [ 0 ] . errorRange ) . toEqual ( [ 6 , 6 ] ) ;
49
+
50
+ expect ( results [ 1 ] . ruleDescription ) . toMatch (
51
+ "Please provide an alternative text for the image." ,
52
+ ) ;
53
+ expect ( results [ 1 ] . errorRange ) . toEqual ( [ 20 , 6 ] ) ;
54
+ expect ( results [ 2 ] . ruleDescription ) . toMatch (
55
+ "Please provide an alternative text for the image." ,
56
+ ) ;
57
+ expect ( results [ 2 ] . errorRange ) . toEqual ( [ 49 , 6 ] ) ;
47
58
} ) ;
48
59
} ) ;
49
60
} ) ;
0 commit comments