35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import { describe, it, expect, beforeEach } from "vitest";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
const ROOT = path.resolve(__dirname, "..");
|
|
const htmlPath = path.join(ROOT, "index.html");
|
|
|
|
function getBody(html) {
|
|
const match = /<body[^>]*>([\s\S]*?)<\/body>/i.exec(html);
|
|
return match ? match[1] : html;
|
|
}
|
|
|
|
describe("Q-Edit static DOM", () => {
|
|
let html;
|
|
beforeEach(() => {
|
|
html = fs.readFileSync(htmlPath, "utf-8");
|
|
document.body.innerHTML = getBody(html);
|
|
});
|
|
|
|
it("has key structural elements", () => {
|
|
// Loading overlay exists
|
|
expect(document.getElementById("loading-overlay")).toBeTruthy();
|
|
// Sidebar tree exists
|
|
expect(document.getElementById("file-tree")).toBeTruthy();
|
|
// Results container exists
|
|
expect(document.getElementById("content-summary")).toBeTruthy();
|
|
});
|
|
|
|
it("defaults to 25 items per page in the UI", () => {
|
|
const sel = document.getElementById("items-per-page-dropdown");
|
|
expect(sel).toBeTruthy();
|
|
expect(sel.value).toBe("25");
|
|
});
|
|
});
|