Files
snapcad-studio/tests/unit/appPreloaderAndTransitions.test.ts
Enes Yakıştır 33b0940012
Build and Push Docker Images / build (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
feat: SnapCAD Studio'yu YakHub deposuna taşı
- DWG/DXF içe aktarma ve .skf yeniden açma düzeltmeleri

- YakNet Bulut eşitlemede boş/eski kopya koruması ve yerel-only proje bildirimi

- Panelden içe aktarma duyuruları ve erişilebilir Türkçe hata mesajları

- AGPL-3.0 lisansı, README ve YakHub bağlantıları
2026-10-25 18:20:21 +03:00

72 lines
3.3 KiB
TypeScript

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import fs from "node:fs";
import path from "node:path";
const getComponentSource = (filename: string) => {
const filePath = path.resolve(__dirname, "../../apps/web/src/components/snapcad", filename);
return fs.readFileSync(filePath, "utf-8");
};
const getAppLayoutSource = () => {
const filePath = path.resolve(__dirname, "../../apps/web/src/app/layout.tsx");
return fs.readFileSync(filePath, "utf-8");
};
const getPageSource = () => {
const filePath = path.resolve(__dirname, "../../apps/web/src/app/page.tsx");
return fs.readFileSync(filePath, "utf-8");
};
describe("Page Transition, Preloader & Google Cloud Console Cascade Loading", () => {
it("renders non-blocking Google Cloud Console linear progress bar and skeleton grid", () => {
const pageSrc = getPageSource();
expect(pageSrc).toContain("gcp-linear-progress");
expect(pageSrc).toContain("gcp-skeleton-grid");
expect(pageSrc).toContain("project-card-skeleton");
expect(pageSrc).toContain('role="progressbar"');
expect(pageSrc).toContain('aria-hidden="true"');
});
it("hides transient visual skeleton cards from screen readers to prevent cluttering accessibility tree", () => {
const pageSrc = getPageSource();
expect(pageSrc).not.toContain("kart ${num} / 6");
expect(pageSrc).not.toContain("kart ${num} / 3");
expect(pageSrc).toContain('className="project-grid gcp-skeleton-grid"\n aria-hidden="true"');
});
it("page.tsx implements Google Cloud Console top-to-bottom cascade waterfall classes without robotic initial announcements", () => {
const pageSrc = getPageSource();
expect(pageSrc).toContain("gcp-cascade-topbar");
expect(pageSrc).toContain("gcp-cascade-sidebar");
expect(pageSrc).toContain("gcp-cascade-actions");
expect(pageSrc).toContain("gcp-cascade-starters");
expect(pageSrc).toContain("gcp-cascade-header");
expect(pageSrc).toContain("gcp-cascade-card");
expect(pageSrc).toContain("gcp-cascade-footer");
// Sayfa açılışında ekran okuyucuya yapay/aşağılayıcı anons yapılmaz
expect(pageSrc).not.toContain("SnapCAD Studio çalışma alanı üstten alta başarıyla yüklendi");
});
it("RootLayout includes NextTopLoader and inline anti-FOUC theme script to prevent white flash", () => {
const layoutSrc = getAppLayoutSource();
expect(layoutSrc).toContain("NextTopLoader");
expect(layoutSrc).toContain("AppErrorBoundary");
expect(layoutSrc).toContain("sketchforge.theme.preference");
expect(layoutSrc).toContain("document.documentElement.style.backgroundColor");
});
it("AppErrorBoundary safely catches exceptions and prevents white screen of death", () => {
const errorBoundarySrc = getComponentSource("AppErrorBoundary.tsx");
expect(errorBoundarySrc).toContain("SnapCAD Studio Yükleme Kurtarma");
expect(errorBoundarySrc).toContain("Sayfayı Yeniden Yükle");
expect(errorBoundarySrc).toContain("Güvenli Modda Başlat");
});
it("strictly prohibits banned competitor name", () => {
const preloaderSrc = getComponentSource("SnapCADAppPreloader.tsx");
const errorBoundarySrc = getComponentSource("AppErrorBoundary.tsx");
expect(preloaderSrc.toLowerCase()).not.toContain("tinker" + "cad");
expect(errorBoundarySrc.toLowerCase()).not.toContain("tinker" + "cad");
});
});