Skip to content

Commit

Permalink
Ensure no-default-alt-text tests against Screencast (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
kendallgassner authored Mar 14, 2024
1 parent 197bd53 commit d858349
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/no-default-alt-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("|")})`;
Expand Down
2 changes: 2 additions & 0 deletions test/no-default-alt-text.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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">',
Expand Down

0 comments on commit d858349

Please sign in to comment.