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

Set detail not details #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ module.exports = {
rules: {
"import/no-commonjs": "off",
"filenames/match-regex": "off",
"i18n-text/no-en": "off",
smockle marked this conversation as resolved.
Show resolved Hide resolved
},
};
4 changes: 2 additions & 2 deletions 4 no-default-alt-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
if (image.content.match(altTextRegex)) {
onError({
lineNumber: image.lineNumber,
details: `For image: ${image.content}`,
detail: `For image: ${image.content}`,
});
}
}
Expand All @@ -35,7 +35,7 @@ module.exports = {
if (line.match(altTextTagRegex)) {
onError({
lineNumber,
details: `For image: ${line}`,
detail: `For image: ${line}`,
});
}
lineNumber++;
Expand Down
23 changes: 23 additions & 0 deletions 23 test/no-default-alt-text.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe("GH001: No Default Alt Text", () => {
expect(rule).toBe(thisRuleName);
}
});

test("HTML example", async () => {
const strings = [
'<img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">',
Expand All @@ -95,5 +96,27 @@ describe("GH001: No Default Alt Text", () => {
expect(rule).toBe(thisRuleName);
}
});

test("error message", async () => {
const strings = [
"![Screen Shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
'<img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">',
];

const results = await runTest(strings);

expect(results[0].ruleDescription).toMatch(
/Images should not use the MacOS default screenshot filename as alternate text/
);
expect(results[0].errorDetail).toBe(
"For image: Screen Shot 2022-06-26 at 7 41 30 PM"
);
expect(results[1].ruleDescription).toMatch(
/Images should not use the MacOS default screenshot filename as alternate text/
);
expect(results[1].errorDetail).toBe(
'For image: <img alt="Screen Shot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">'
);
});
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.