mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Merge pull request #2134 from PR0M3TH3AN/fix-moderation-fixture-click-timeout-16961147370798844238
Fix moderation fixture click timeout and logic
This commit is contained in:
3 files changed
+16
-9
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
*/
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user