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 18247e8

Browse filesBrowse files
authored
Set detail not details (#11)
* Set not * Add test
1 parent e02d52a commit 18247e8
Copy full SHA for 18247e8

File tree

Expand file treeCollapse file tree

3 files changed

+26
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+26
-2
lines changed

‎.eslintrc.js

Copy file name to clipboardExpand all lines: .eslintrc.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ module.exports = {
1313
rules: {
1414
"import/no-commonjs": "off",
1515
"filenames/match-regex": "off",
16+
"i18n-text/no-en": "off",
1617
},
1718
};

‎no-default-alt-text.js

Copy file name to clipboardExpand all lines: no-default-alt-text.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
if (image.content.match(altTextRegex)) {
2424
onError({
2525
lineNumber: image.lineNumber,
26-
details: `For image: ${image.content}`,
26+
detail: `For image: ${image.content}`,
2727
});
2828
}
2929
}
@@ -35,7 +35,7 @@ module.exports = {
3535
if (line.match(altTextTagRegex)) {
3636
onError({
3737
lineNumber,
38-
details: `For image: ${line}`,
38+
detail: `For image: ${line}`,
3939
});
4040
}
4141
lineNumber++;

‎test/no-default-alt-text.test.js

Copy file name to clipboardExpand all lines: test/no-default-alt-text.test.js
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ describe("GH001: No Default Alt Text", () => {
7575
expect(rule).toBe(thisRuleName);
7676
}
7777
});
78+
7879
test("HTML example", async () => {
7980
const strings = [
8081
'<img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">',
@@ -95,5 +96,27 @@ describe("GH001: No Default Alt Text", () => {
9596
expect(rule).toBe(thisRuleName);
9697
}
9798
});
99+
100+
test("error message", async () => {
101+
const strings = [
102+
"![Screen Shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
103+
'<img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">',
104+
];
105+
106+
const results = await runTest(strings);
107+
108+
expect(results[0].ruleDescription).toMatch(
109+
/Images should not use the MacOS default screenshot filename as alternate text/
110+
);
111+
expect(results[0].errorDetail).toBe(
112+
"For image: Screen Shot 2022-06-26 at 7 41 30 PM"
113+
);
114+
expect(results[1].ruleDescription).toMatch(
115+
/Images should not use the MacOS default screenshot filename as alternate text/
116+
);
117+
expect(results[1].errorDetail).toBe(
118+
'For image: <img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">'
119+
);
120+
});
98121
});
99122
});

0 commit comments

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