Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions lib/rules/template-require-media-caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ module.exports = {
return;
}
}

// Any other dynamic value (e.g. muted="{{isMuted}}" → ConcatStatement,
// or muted={{#if ...}}...{{/if}} → BlockStatement) → treat as exempt.
// Matches upstream ember-template-lint behavior where MustacheStatement,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we stop adding comments about "matches upstram" this means nothing post PR merge 🙈

// BlockStatement, or any non-text/non-"false" value is considered muted.
if (value.type !== 'GlimmerTextNode' && value.type !== 'GlimmerMustacheStatement') {
return;
}
}

// Check if there's a track element with kind="captions" as a child
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/template-require-media-caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ruleTester.run('template-require-media-caption', rule, {
'<template><audio muted="true"></audio></template>',
'<template><video muted></video></template>',
'<template><audio muted={{this.muted}}></audio></template>',
'<template><video muted="{{isMuted}}"><source src="movie.mp4" /></video></template>',
'<template><audio muted="{{this.isMuted}}"></audio></template>',
'<template><video><track kind="captions" /><track kind="descriptions" /></video></template>',
],

Expand Down Expand Up @@ -148,6 +150,8 @@ hbsRuleTester.run('template-require-media-caption', rule, {
'<audio muted="true"></audio>',
'<video muted></video>',
'<audio muted={{this.muted}}></audio>',
'<video muted="{{isMuted}}"><source src="movie.mp4" /></video>',
'<audio muted="{{this.isMuted}}"></audio>',
'<video><track kind="captions" /><track kind="descriptions" /></video>',
],
invalid: [
Expand Down
Loading