e5c824970c
The theme switcher button was hidden above the viewport on desktop because .has-tooltip's position: relative was overriding the button's position: fixed due to CSS cascade order (_tooltips.css loaded after _themes.css). Fixed by adding !important to .color-theme-switcher position: fixed rule. Changes: - static/css/01-foundation/_themes.css: Add !important to position: fixed to override .has-tooltip position: relative cascade Testing: - Added comprehensive tooltip tests for all buttons (desktop & mobile) - Verified theme switcher visible on desktop at correct position - Verified all tooltips working on hover (desktop only, hidden on mobile touch) - Verified button positioning in mobile bottom dock All buttons now display correctly: ✅ Desktop: All 6 buttons with working tooltips ✅ Mobile: All 5 buttons in bottom dock
87 lines
2.8 KiB
JavaScript
Executable File
87 lines
2.8 KiB
JavaScript
Executable File
#!/usr/bin/env bun
|
|
import { chromium } from 'playwright';
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: false });
|
|
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } });
|
|
|
|
console.log('🔍 Testing theme button visibility on DESKTOP...\n');
|
|
|
|
await page.goto('http://localhost:1999/');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Check theme button
|
|
const themeButton = page.locator('#color-theme-switcher');
|
|
const exists = await themeButton.count() > 0;
|
|
console.log(exists ? '✅ Theme button exists in DOM' : '❌ Theme button NOT in DOM');
|
|
|
|
if (exists) {
|
|
const isVisible = await themeButton.isVisible();
|
|
console.log(isVisible ? '✅ Theme button is VISIBLE' : '❌ Theme button is NOT visible');
|
|
|
|
const box = await themeButton.boundingBox();
|
|
console.log('\n📦 Bounding box:', box);
|
|
|
|
// Check if Y position is positive (on screen)
|
|
if (box && box.y > 0) {
|
|
console.log('✅ Button is ON SCREEN (y > 0)');
|
|
} else if (box && box.y < 0) {
|
|
console.log('❌ Button is ABOVE SCREEN (y < 0) - STILL BROKEN');
|
|
}
|
|
|
|
// Get computed position
|
|
const position = await page.evaluate(() => {
|
|
const btn = document.getElementById('color-theme-switcher');
|
|
const computed = window.getComputedStyle(btn);
|
|
return {
|
|
position: computed.position,
|
|
bottom: computed.bottom,
|
|
left: computed.left,
|
|
top: computed.top
|
|
};
|
|
});
|
|
|
|
console.log('\n🎨 Computed position:', position);
|
|
|
|
if (position.position === 'fixed') {
|
|
console.log('✅ Position is FIXED (correct!)');
|
|
} else {
|
|
console.log(`❌ Position is ${position.position} (should be fixed)`);
|
|
}
|
|
|
|
// Take screenshot
|
|
await page.screenshot({
|
|
path: '/Users/txeo/Git/yo/cv/tests/mjs/screenshots/theme-button-fixed.png',
|
|
fullPage: false
|
|
});
|
|
console.log('\n📸 Screenshot saved to screenshots/theme-button-fixed.png');
|
|
|
|
// Test tooltip
|
|
console.log('\n🎯 Testing tooltip...');
|
|
await themeButton.hover();
|
|
await page.waitForTimeout(500);
|
|
|
|
const tooltipVisible = await page.evaluate(() => {
|
|
const btn = document.getElementById('color-theme-switcher');
|
|
const computed = window.getComputedStyle(btn, '::before');
|
|
return {
|
|
opacity: computed.opacity,
|
|
visibility: computed.visibility,
|
|
content: computed.content
|
|
};
|
|
});
|
|
|
|
console.log('💬 Tooltip state:', tooltipVisible);
|
|
if (parseFloat(tooltipVisible.opacity) > 0.5) {
|
|
console.log('✅ Tooltip is VISIBLE on hover');
|
|
} else {
|
|
console.log('⚠️ Tooltip opacity is low or hidden');
|
|
}
|
|
}
|
|
|
|
console.log('\n✅ Test complete - browser will close in 5 seconds');
|
|
await page.waitForTimeout(5000);
|
|
await browser.close();
|
|
})();
|