mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 21:32:51 +00:00
Replace UI grid and notify with Tailwind components
This commit is contained in:
1 parent
8506b76004
commit
c3ba160ef8
14 files changed
+555
-687
No files matched your search
@@ -70,6 +70,7 @@ describe("torrent/ui/styleHelpers", () => {
|
||||
beaconDynamicFallbackClasses.clipboard,
|
||||
"torrent-clipboard-textarea",
|
||||
);
|
||||
assert.equal(beaconDynamicFallbackClasses.toast, "torrent-toast-motion");
|
||||
});
|
||||
|
||||
it("applies dynamic styles and fallback classes", () => {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { strict as assert } from "node:assert";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
import { createToastManager } from "../../torrent/ui/toastService.js";
|
||||
|
||||
let dom;
|
||||
|
||||
describe("torrent/ui/toastService", () => {
|
||||
beforeEach(() => {
|
||||
dom = new JSDOM("<!doctype html><html><head></head><body></body></html>", {
|
||||
pretendToBeVisual: true,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (dom) {
|
||||
dom.window.close();
|
||||
dom = null;
|
||||
}
|
||||
});
|
||||
|
||||
it("renders a toast with Tailwind token classes and removes it on dismiss", async () => {
|
||||
const documentRef = dom.window.document;
|
||||
const toastManager = createToastManager(documentRef);
|
||||
const handle = toastManager.success("Magnet copied", { sticky: true });
|
||||
|
||||
const container = documentRef.getElementById("beacon-toast-container");
|
||||
assert.ok(container, "toast container should be created");
|
||||
assert.equal(container.classList.contains("flex"), true);
|
||||
|
||||
const wrapper = container.firstElementChild;
|
||||
assert.ok(wrapper, "toast wrapper should exist");
|
||||
assert.equal(wrapper.classList.contains("torrent-toast-motion"), true);
|
||||
|
||||
const toast = wrapper.querySelector("div[role='status']");
|
||||
assert.ok(toast, "toast element should be present");
|
||||
assert.equal(toast.textContent.includes("Magnet copied"), true);
|
||||
assert.equal(toast.classList.contains("torrent-toast"), true);
|
||||
assert.equal(toast.classList.contains("torrent-toast--success"), true);
|
||||
|
||||
const closeButton = toast.querySelector("button[aria-label='Dismiss notification']");
|
||||
assert.ok(closeButton, "close button should be rendered");
|
||||
|
||||
handle.dismiss();
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
|
||||
assert.equal(container.childElementCount, 0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user