Skip to content

Commit 5198836

Browse files
committed
test: reproduce false-positive video_present on image filenames
Add regression tests for PRO-1229: an <img> whose filename merely contains "youtube" or "vimeo" (e.g. a screenshot named screenshot-2026-05-21-at-16-53-07-claims-department-youtube.jpg used as a featured image) currently trips the video_present rule even though the page has no video or embed on it.
1 parent 3959d1e commit 5198836

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/jest/rules/videoElementPresent.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,21 @@ describe( 'video_present rule', () => {
170170
html: '<script type="text/javascript" src="https://www.youtube.com/iframe_api?ver=1.2.6" id="youtube-scripts-js"></script>',
171171
shouldPass: true,
172172
},
173+
{
174+
// Regression test for https://linear.app/equalize-digital/issue/PRO-1229.
175+
// A featured image whose filename happens to contain "youtube" (e.g. a
176+
// screenshot of a YouTube video) was being misidentified as an embedded
177+
// video because the keyword match applied to any [src] element, not just
178+
// iframe/embed-style elements.
179+
name: 'does not detect an <img> whose filename merely contains the keyword "youtube"',
180+
html: '<img src="screenshot-2026-05-21-at-16-53-07-claims-department-youtube.jpg" alt="Claims Department" />',
181+
shouldPass: true,
182+
},
183+
{
184+
name: 'does not detect an <img> whose filename merely contains the keyword "vimeo"',
185+
html: '<img src="team-photo-vimeo-conference-2026.png" alt="Team photo" />',
186+
shouldPass: true,
187+
},
173188
];
174189

175190
testCases.forEach( ( testCase ) => {

0 commit comments

Comments
 (0)