Files
bitvid/tests/visual/embed-layout.spec.ts
T
google-labs-jules[bot] a708883abb fix(embed): video sizing letterbox and logo accent
- Changed embed video sizing to `object-fit: cover` and `width: 100%` to eliminate black bars/letterboxing.
- Updated `embed.html` and `css/tailwind.source.css` to enforce these styles on `.video-modal__media`, `.video-modal__video`, and `#embedVideo`.
- Wired the embed logo accent color to use the instance configuration (`THEME_ACCENT_OVERRIDES` from `config/instance-config.js`) via a `--bitvid-accent` CSS variable injected in `js/embed.js`.
- Added unit and visual tests to verify styling and configuration logic.
2026-01-24 23:57:29 +00:00

42 lines
1.6 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { THEME_ACCENT_OVERRIDES } from "../../config/instance-config.js";
test.describe("embed layout and styling", () => {
test("embed video fills container and uses accent color", async ({ page }) => {
// Navigate to embed.html with a dummy pointer to trigger logic
await page.goto("/embed.html?pointer=nevent123", { waitUntil: "domcontentloaded" });
// 1. Verify CSS Variable
const accentColor = await page.evaluate(() => {
return getComputedStyle(document.documentElement).getPropertyValue("--bitvid-accent").trim();
});
// The configured color is #540011 (from config/instance-config.js)
const expectedAccent = THEME_ACCENT_OVERRIDES?.light?.accent || "#ff6b6b";
expect(accentColor).toBe(expectedAccent);
// 2. Verify Video Element Styling
const video = page.locator("#embedVideo");
await expect(video).toBeVisible();
const objectFit = await video.evaluate((el) => {
return window.getComputedStyle(el).objectFit;
});
expect(objectFit).toBe("cover");
const backgroundColor = await video.evaluate((el) => {
return window.getComputedStyle(el).backgroundColor;
});
// Transparent is typically rgba(0, 0, 0, 0)
expect(backgroundColor).toMatch(/rgba\(0,\s*0,\s*0,\s*0\)|transparent/);
// 3. Verify Logo Styling
const logoAccent = page.locator(".bv-logo__accent");
const fill = await logoAccent.evaluate((el) => {
return window.getComputedStyle(el).fill;
});
// #540011 in rgb is rgb(84, 0, 17)
expect(fill).toBe("rgb(84, 0, 17)");
});
});