Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f80d4d

Browse filesBrowse files
committed
Add test case for multiple images in one line
Related:#85 (comment)
1 parent 0ba6e3c commit 8f80d4d
Copy full SHA for 8f80d4d

File tree

Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed

‎test/no-empty-string-alt.test.js

Copy file name to clipboardExpand all lines: test/no-empty-string-alt.test.js
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe("GH003: No Empty String Alt", () => {
1818
const strings = [
1919
'<img alt="" src="https://user-images.githubusercontent.com/abcdef.png">',
2020
"<img alt='' src='https://user-images.githubusercontent.com/abcdef.png'>",
21+
'<img src="cat.png" alt="" /> <img src="dog.png" alt="" />',
2122
];
2223

2324
const results = await runTest(strings, noEmptyStringAltRule);
@@ -27,7 +28,7 @@ describe("GH003: No Empty String Alt", () => {
2728
.flat()
2829
.filter((name) => !name.includes("GH"));
2930

30-
expect(failedRules).toHaveLength(2);
31+
expect(failedRules).toHaveLength(4);
3132
for (const rule of failedRules) {
3233
expect(rule).toBe("no-empty-string-alt");
3334
}
@@ -36,6 +37,7 @@ describe("GH003: No Empty String Alt", () => {
3637
test("error message", async () => {
3738
const strings = [
3839
'<img alt="" src="https://user-images.githubusercontent.com/abcdef.png">',
40+
'<img src="cat.png" alt="" /> <img src="dog.png" alt="" />',
3941
];
4042

4143
const results = await runTest(strings, noEmptyStringAltRule);
@@ -44,6 +46,15 @@ describe("GH003: No Empty String Alt", () => {
4446
"Please provide an alternative text for the image.",
4547
);
4648
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]);
4758
});
4859
});
4960
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.