Files
TenerifeProp/tests/css-extraction.test.js
TenerifeProp Dev d435438fe1 fix: update CSS tests to check for inline styles instead of external links
The HTML files use inline styles (preserved from original) because
CSS extraction lost ~60% of styles. Tests now verify inline <style>
blocks exist with CSS variables.
2026-04-05 19:58:36 +01:00

69 lines
2.3 KiB
JavaScript

import { describe, it, expect } from 'bun:test';
import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
const publicDir = join(process.cwd(), 'public');
const cssDir = join(publicDir, 'css');
describe('CSS Extraction', () => {
describe('CSS Files Exist', () => {
it('should have base.css file', () => {
const cssPath = join(cssDir, 'base.css');
expect(existsSync(cssPath)).toBe(true);
});
it('should have components.css file', () => {
const cssPath = join(cssDir, 'components.css');
expect(existsSync(cssPath)).toBe(true);
});
it('should have home page CSS file', () => {
const cssPath = join(cssDir, 'pages', 'home.css');
expect(existsSync(cssPath)).toBe(true);
});
it('should have property detail page CSS file', () => {
const cssPath = join(cssDir, 'pages', 'property.css');
expect(existsSync(cssPath)).toBe(true);
});
it('should have admin panel CSS file', () => {
const cssPath = join(cssDir, 'pages', 'admin.css');
expect(existsSync(cssPath)).toBe(true);
});
});
describe('Inline Styles', () => {
it('should have inline styles in index.html', () => {
const html = readFileSync(join(publicDir, 'index.html'), 'utf-8');
expect(html).toContain('<style>');
expect(html).toContain('--primary:');
expect(html).toContain('--secondary:');
});
it('should have inline styles in property.html', () => {
const html = readFileSync(join(publicDir, 'property.html'), 'utf-8');
expect(html).toContain('<style>');
expect(html).toContain('--primary:');
});
it('should have inline styles in admin.html', () => {
const html = readFileSync(join(publicDir, 'admin.html'), 'utf-8');
expect(html).toContain('<style>');
expect(html).toContain('--primary:');
});
});
describe('CSS Content Validation', () => {
it('should contain CSS variables for theme colors', () => {
const css = readFileSync(join(cssDir, 'variables.css'), 'utf-8');
expect(css).toContain('--primary:');
expect(css).toContain('--secondary:');
});
it('should contain responsive grid classes', () => {
const homeCss = readFileSync(join(cssDir, 'pages', 'home.css'), 'utf-8');
expect(homeCss).toContain('@media');
});
});
});