Skip to content

Ensure no-default-alt-text tests against Screencast #105

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 1 commit into from
Mar 14, 2024
Merged
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
3 changes: 2 additions & 1 deletion src/rules/no-default-alt-text.js
Original file line number Diff line number Diff line change
@@ -3,9 +3,10 @@
* * "Screen Shot 2020-10-20 at 2 52 27 PM"
* * "Screenshot 2020-10-20 at 2 52 27 PM"
* * "Clean Shot 2020-10-20 @45x"
* * "Screencast from 23 02 2024 19 15 19]"
*/
const defaultScreenshotRegex =
"(?:screen|clean) ?shot \\d{4}-\\d{2}-\\d{2}[^'\"\\]]*";
"(?:screen|clean) ?(?:shot|cast) \\d{4}-\\d{2}-\\d{2}[^'\"\\]]*";

const imageRegex = "image";
const combinedRegex = `(${[defaultScreenshotRegex, imageRegex].join("|")})`;
2 changes: 2 additions & 0 deletions test/no-default-alt-text.test.js
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ describe("GH001: No Default Alt Text", () => {
test("markdown example", async () => {
const strings = [
"![Screen Shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
"![Screencast from 23 02 2024 19 15 19](https://user-images.githubusercontent.com/abcdef.png)",
"![ScreenShot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
"![Screen shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
"![Screenshot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)",
@@ -50,6 +51,7 @@ describe("GH001: No Default Alt Text", () => {
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">',
'<img alt=" Screencast from 23 02 2024 19 15 19" src="https://user-images.githubusercontent.com/abcdef.png">',
'<img alt="ScreenShot 2022-06-26 at 7 41 30 PM" src="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">',
'<img alt="Screenshot 2022-06-26 at 7 41 30 PM" src="https://user-images.githubusercontent.com/abcdef.png">',