mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Major documentation reorganization and improvements: ## Documentation Cleanup - Deleted 13 old status/report MD files from root - Moved old reports to docs/archive/ for reference - Removed USAGE.md, WHITE_LABEL.md, TESTING_GUIDE.md - Now only 9 essential MD files at root (LLM.md, README.md, etc.) ## New Comprehensive Documentation Created in app/content/docs/ (visible on ui.hanzo.ai): ### Frameworks (/docs/frameworks/) - Multi-framework overview and comparison - React guide (8KB) - hooks, Next.js, TypeScript - Vue guide (4.6KB) - Composition API, Nuxt ### Packages (/docs/packages/) - Complete package documentation (6.3KB) - @hanzo/ui, @hanzo/auth, @hanzo/commerce, @hanzo/brand ### Testing (/docs/testing/) - Comprehensive testing guide (7.6KB) - Unit, E2E, visual regression, accessibility - Vitest, Playwright, CI/CD examples ### White-Label (/docs/white-label/) - Fork and rebrand guide (6.4KB) - Publishing, deployment, syncing with upstream ## Navigation & UX Improvements - Updated sidebar navigation with 4 new sections - Added comprehensive footer with quick links - 4-column footer: Getting Started, Frameworks, Resources, Community - Version number in footer (v5.0.0) ## Technical Fixes - Fixed build:registry workspace references (www,v4 → app) - Removed deprecated prettier import order options - Updated site config with version and Discord link ## Updated Documentation - README.md - Concise, feature-rich overview - LLM.md - Documentation structure rules and recent updates - All 175 MDX files accessible and building correctly Deployment ready for ui.hanzo.ai
88 lines
2.9 KiB
TypeScript
88 lines
2.9 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
const BASE_URL = 'http://localhost:3003';
|
|
|
|
test('Theme switcher dropdown should work on homepage', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/`, { waitUntil: 'networkidle' });
|
|
|
|
// Get initial theme
|
|
const initialTheme = await page.evaluate(() => {
|
|
return document.documentElement.getAttribute('class')?.includes('dark') ? 'dark' : 'light';
|
|
});
|
|
|
|
// Find and click theme switcher button
|
|
const themeButton = page.locator('button[aria-label="Toggle theme"]').first();
|
|
await expect(themeButton).toBeVisible();
|
|
await themeButton.click();
|
|
|
|
// Wait for dropdown to open
|
|
await page.waitForTimeout(300);
|
|
|
|
// Select dark theme if currently light, otherwise select light
|
|
const themeToSelect = initialTheme === 'light' ? 'Dark' : 'Light';
|
|
const menuItem = page.locator('text=' + themeToSelect).first();
|
|
await expect(menuItem).toBeVisible();
|
|
await menuItem.click();
|
|
|
|
// Wait for theme to apply
|
|
await page.waitForTimeout(500);
|
|
|
|
// Verify theme changed
|
|
const newTheme = await page.evaluate(() => {
|
|
return document.documentElement.getAttribute('class')?.includes('dark') ? 'dark' : 'light';
|
|
});
|
|
|
|
expect(newTheme).not.toBe(initialTheme);
|
|
console.log(`Theme changed from ${initialTheme} to ${newTheme}`);
|
|
});
|
|
|
|
test('Theme switcher dropdown should work on dashboard example', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/examples/dashboard`, { waitUntil: 'networkidle' });
|
|
|
|
const themeButton = page.locator('button[aria-label="Toggle theme"]').first();
|
|
await expect(themeButton).toBeVisible();
|
|
|
|
// Get initial state
|
|
const initialState = await page.evaluate(() => document.documentElement.getAttribute('class'));
|
|
|
|
// Click theme button
|
|
await themeButton.click();
|
|
await page.waitForTimeout(300);
|
|
|
|
// Select Dark theme
|
|
const darkMenuItem = page.locator('text=Dark').first();
|
|
await expect(darkMenuItem).toBeVisible();
|
|
await darkMenuItem.click();
|
|
|
|
await page.waitForTimeout(500);
|
|
|
|
// Verify it changed
|
|
const newState = await page.evaluate(() => document.documentElement.getAttribute('class'));
|
|
expect(newState).not.toBe(initialState);
|
|
});
|
|
|
|
test('Theme should persist across page navigation', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/`, { waitUntil: 'networkidle' });
|
|
|
|
// Switch to dark theme
|
|
const themeButton = page.locator('button[aria-label="Toggle theme"]').first();
|
|
await themeButton.click();
|
|
await page.waitForTimeout(300);
|
|
|
|
const darkMenuItem = page.locator('text=Dark').first();
|
|
await darkMenuItem.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
// Navigate to another page
|
|
const docsLink = page.locator('a:has-text("Docs")').first();
|
|
await docsLink.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Check theme is still dark
|
|
const isDark = await page.evaluate(() => {
|
|
return document.documentElement.getAttribute('class')?.includes('dark');
|
|
});
|
|
|
|
expect(isDark).toBe(true);
|
|
});
|