Skip to content

Commit 18490e9

Browse files
Modify pattern for filename to skip whitespaces (#100)
fixes MAT-464 flag=none Test plan: - Navigate to an RCE instance - Upload an image (jpg, png mainly) and assign an alt attribute as a filename with spaces (i.e this image.jpg) - After upload and preview, click the accesibility checker. It must warn of a filename not allowed as an alt attribute - repeat the process with a different alt value, this time use a normal sentence. Click the accesibility checker again. this time there must be no alerts or messages
1 parent de4bbf5 commit 18490e9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/rules/__tests__/img-alt-filename.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ describe("test", () => {
3131
el.setAttribute("alt", "file.txt")
3232
expect(rule.test(el)).toBeFalsy()
3333
})
34+
35+
test("returns false if alt text is filename with blank spaces", () => {
36+
el.setAttribute("alt", "file with blank.txt")
37+
expect(rule.test(el)).toBeFalsy()
38+
})
3439
})
3540

3641
describe("data", () => {

src/rules/img-alt-filename.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import formatMessage from "../format-message"
22

3-
const FILENAMELIKE = /^\S+\.\S+$/
3+
const FILENAMELIKE = /^(\S|\s)+\.\S+$/
44

55
export default {
66
id: "img-alt-filename",

0 commit comments

Comments
 (0)