Fix moderation fixture click timeout and logic

Fixed a click timeout issue in `tests/visual/moderation.spec.ts` for the 'trusted mute hide' fixture by:
1.  Updating `js/ui/components/VideoCard.js` to use `display: flex !important` instead of `block` for the hidden summary container, ensuring consistency with `bv-stack` class and preventing layout issues that made the button unclickable.
2.  Adding `url` to fixture videos in `docs/moderation/fixtures/index.html` to prevent them from being hidden by source visibility logic.
3.  Adding `onModerationHide` handler to the fixture factory to support the "Restore default moderation" action.
4.  Uncommenting the test case logic in `tests/visual/moderation.spec.ts`.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-05 23:08:49 +00:00
1 parent 151e2a70d8
commit 54ed48ce35
3 files changed
+16 -9

No files matched your search

+11
View File
@@ -75,6 +75,7 @@
id: "1".repeat(64),
title: "Fixture: Blurred Preview",
pubkey: "a".repeat(64),
url: "https://example.com/video.mp4",
thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg"
},
moderation: {
@@ -103,6 +104,7 @@
id: "2".repeat(64),
title: "Fixture: Autoplay Blocked",
pubkey: "e".repeat(64),
url: "https://example.com/video.mp4",
thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg"
},
moderation: {
@@ -127,6 +129,7 @@
id: "3".repeat(64),
title: "Fixture: Override Persistence",
pubkey: "f".repeat(64),
url: "https://example.com/video.mp4",
thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg"
},
moderation: {
@@ -152,6 +155,7 @@
id: "4".repeat(64),
title: "Fixture: Trusted Report Hide",
pubkey: "aa".repeat(32),
url: "https://example.com/video.mp4",
thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg"
},
moderation: {
@@ -177,6 +181,7 @@
id: "5".repeat(64),
title: "Fixture: Trusted Mute Hide",
pubkey: "bb".repeat(32),
url: "https://example.com/video.mp4",
thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg"
},
moderation: {
@@ -607,6 +612,12 @@
}
return true;
};
card.onModerationHide = () => {
overrides = setOverride(overrides, video.id, { showAnyway: false });
refreshModeration();
return true;
};
}
const root = card.getRoot();
+3 -3
View File
@@ -1856,9 +1856,9 @@ export class VideoCard {
target.hidden = false;
target.removeAttribute("hidden");
target.removeAttribute("aria-hidden");
// If target is summary container, ensure it's displayed as block
// If target is summary container, ensure it's displayed as flex (to match bv-stack)
if (target !== slot) {
target.style.setProperty("display", "block", "important");
target.style.setProperty("display", "flex", "important");
} else {
target.style.removeProperty("display");
}
@@ -2009,7 +2009,7 @@ export class VideoCard {
if (!this.hiddenSummaryEl) {
this.hiddenSummaryEl = this.createElement("div", {
classNames: ["p-md", "bv-stack", "bv-stack--tight"],
classNames: ["p-md", "bv-stack", "bv-stack--tight", "items-start"],
});
this.hiddenSummaryEl.dataset.moderationHiddenContainer = "true";
this.hiddenSummaryEl.setAttribute("role", "group");
+2 -6
View File
@@ -219,14 +219,11 @@ test.describe("moderation fixtures", () => {
await expect(muteCard).toHaveAttribute("data-moderation-trusted-mute-count", "1");
await expect(badge).toContainText("Hidden · 1 trusted mute");
await expect(thumbnail).toHaveAttribute("data-thumbnail-state", "blurred");
// TODO: Investigate visibility check failure
// await expect(showAnywayButton).toBeVisible();
await expect(showAnywayButton).toBeVisible();
await expect(restoreButtonQuery).toHaveCount(0);
// TODO: Investigate click timeout failure
// await showAnywayButton.click({ force: true });
await showAnywayButton.click();
/*
await expect(muteCard).not.toHaveAttribute("data-moderation-hidden", "true");
await expect(muteCard).toHaveAttribute("data-moderation-override", "show-anyway");
await expect(muteCard.locator('[data-moderation-badge="true"]')).toContainText(
@@ -245,6 +242,5 @@ test.describe("moderation fixtures", () => {
await expect(muteCard).not.toHaveAttribute("data-moderation-override", "show-anyway");
await expect(thumbnail).toHaveAttribute("data-thumbnail-state", "blurred");
await expect(muteCard.getByRole("button", { name: "Show anyway" })).toBeVisible();
*/
});
});