Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions packages/lint/src/rules/media.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { lintHyperframeHtml } from "../hyperframeLinter.js";

describe("media rules", () => {
it("keeps the editorial emphasis registry component free of invalid placeholder media", async () => {
const component = readFileSync(
resolve(
process.cwd(),
"../../registry/components/caption-editorial-emphasis/caption-editorial-emphasis.html",
),
"utf8",
);

const result = await lintHyperframeHtml(component);

expect(result.findings.find((finding) => finding.code === "media_missing_src")).toBeUndefined();
});

it("reports error for duplicate media ids", async () => {
const html = `
<html><body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@
background: transparent;
}

#bg-video {
position: absolute;
inset: 0;
z-index: 1;
width: 100%;
height: 100%;
object-fit: cover;
}

.caption-layer {
position: absolute;
inset: 0;
Expand Down Expand Up @@ -132,17 +123,6 @@
data-width="1920"
data-height="1080"
>
<video
id="bg-video"
muted
playsinline
preload="auto"
data-start="0"
data-duration="8"
data-track-index="0"
data-has-audio="false"
></video>

<div class="caption-layer" aria-hidden="true">
<div id="caption-stage" class="safe-zone"></div>
</div>
Expand Down
20 changes: 0 additions & 20 deletions registry/components/caption-editorial-emphasis/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@
background: #000;
}

#bg-video {
position: absolute;
inset: 0;
z-index: 1;
width: 100%;
height: 100%;
object-fit: cover;
}

.caption-layer {
position: absolute;
inset: 0;
Expand Down Expand Up @@ -130,17 +121,6 @@
data-width="1920"
data-height="1080"
>
<video
id="bg-video"
muted
playsinline
preload="auto"
data-start="0"
data-duration="8"
data-track-index="0"
data-has-audio="false"
></video>

<div class="caption-layer" aria-hidden="true">
<div id="caption-stage" class="safe-zone"></div>
</div>
Expand Down
Loading