Files
cv-site/tests/mjs/17-all-icons-test.mjs
juanatsap f7cda5dba3 refactor: Modularize CSS and fix theme-aware text colors
CSS Restructuring:
- Reorganize monolithic main.css into modular architecture
- Create foundation/ (reset, variables, typography, themes)
- Create layout/ (container, page, grid, paper)
- Create components/ (8 component files)
- Create interactive/ (toggles, remaining for future split)
- Create effects/ (skeleton loading)
- Create contexts/ (print styles)

Theme Support Fixes:
- Replace all hardcoded text colors with CSS variables
- Fix .section-title: rgb(51,51,51) → var(--text-primary)
- Fix .cv-name, .intro-text: hardcoded → theme-aware
- Fix .experience-period, .duration-text: #555/#aaa → variables
- Fix course/project/experience text colors
- Support proper light/dark theme text contrast

Icon & Layout Fixes:
- Standardize all icon sizes to 80×80px
- Change all icon backgrounds to transparent
- Fix award section layout (missing flexbox)
- Update HTML templates (experience.html, awards.html) to width='80'
- Fix default icon sizing conflicts

View Switcher Fix:
- Fix toggleTheme() to target .cv-container instead of body
- Ensures clean/default theme toggle works correctly

Files: 40+ CSS files modularized, 3 templates updated, 7 tests added
2025-11-19 14:31:17 +00:00

99 lines
3.0 KiB
JavaScript
Executable File
Raw Permalink Blame History

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.
#!/usr/bin/env bun
/**
* ALL ICONS COMPREHENSIVE TEST
* Check ALL icon types for consistent size and transparent backgrounds
*/
import { chromium } from "playwright";
const URL = "http://localhost:1999";
async function testAllIcons() {
console.log("🧪 ALL ICONS COMPREHENSIVE TEST\n");
console.log("=".repeat(70));
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
await page.goto(URL);
await page.waitForTimeout(2000);
console.log("\n📋 Checking ALL icon types:\n");
const iconData = await page.evaluate(() => {
const selectors = [
{ name: 'Company Logos', selector: '.company-logo img' },
{ name: 'Award Logos', selector: '.award-logo img' },
{ name: 'Project Icons', selector: '.project-icon img' },
{ name: 'Course Icons', selector: '.course-icon img' },
{ name: 'Default Company', selector: '.default-company-icon' },
{ name: 'Default Award', selector: '.default-award-icon' },
{ name: 'Default Project', selector: '.default-project-icon' },
{ name: 'Default Course', selector: '.default-course-icon' }
];
const results = [];
selectors.forEach(({ name, selector }) => {
const elements = document.querySelectorAll(selector);
const samples = [];
elements.forEach((el, i) => {
if (i < 3) { // Check first 3 of each type
const style = window.getComputedStyle(el);
samples.push({
index: i + 1,
width: style.width,
height: style.height,
background: style.backgroundColor,
opacity: style.opacity
});
}
});
results.push({
type: name,
count: elements.length,
samples
});
});
return results;
});
iconData.forEach(({ type, count, samples }) => {
console.log(`\n${type}:`);
console.log(` Total found: ${count}`);
samples.forEach(sample => {
console.log(` #${sample.index}: ${sample.width} × ${sample.height}, bg: ${sample.background}, opacity: ${sample.opacity}`);
});
// Check consistency
if (samples.length > 0) {
const uniqueSizes = new Set(samples.map(s => `${s.width}×${s.height}`));
const uniqueBgs = new Set(samples.map(s => s.background));
if (uniqueSizes.size === 1) {
console.log(` ✅ Consistent size: ${Array.from(uniqueSizes)[0]}`);
} else {
console.log(` ❌ INCONSISTENT sizes: ${Array.from(uniqueSizes).join(', ')}`);
}
const bg = Array.from(uniqueBgs)[0];
if (bg.includes('rgba(0, 0, 0, 0)') || bg === 'transparent') {
console.log(` ✅ Transparent background`);
} else {
console.log(` ⚠️ Background: ${bg}`);
}
}
});
console.log("\n" + "=".repeat(70));
console.log("\nBrowser will stay open for 30 seconds for visual inspection...");
await page.waitForTimeout(30000);
await browser.close();
}
await testAllIcons();