Files
WebApp/scripts/ux06c-presentation.test.mjs
T
2026-10-13 12:34:03 -06:00

40 lines
2.0 KiB
JavaScript

import { readFileSync } from 'node:fs';
import { test } from 'node:test';
import assert from 'node:assert/strict';
const root = new URL('../src/app/features/indicadores/', import.meta.url);
const read = path => readFileSync(new URL(path, root), 'utf8');
test('UX-06C: geometría prevista conserva título flexible, flecha lateral y foco visible', () => {
const card = read('indicador-catalog-card.ts');
const styles = card.slice(card.indexOf(' styles:'), card.indexOf('export class'));
assert.match(styles, /grid-template-columns:\s*minmax\(0, 1fr\) auto/);
assert.match(styles, /header button\s*\{[^}]*justify-self:\s*end/);
assert.match(styles, /header button\s*\{[^}]*min-width:\s*48px;\s*min-height:\s*48px/);
assert.match(styles, /button:focus-visible\s*\{[^}]*outline:/);
assert.match(styles, /overflow-wrap:\s*anywhere/);
});
test('UX-06C: navegación centrada sin banda blanca ni sticky añadido', () => {
const styles = read('indicadores-page.scss');
const nav = styles.match(/(?:^|\n)nav\s*\{([^}]*)\}/)?.[1];
assert.ok(nav);
assert.match(nav, /justify-content:\s*center/);
assert.match(nav, /flex-wrap:\s*wrap/);
assert.doesNotMatch(nav, /background|border:/);
assert.doesNotMatch(styles, /position:\s*(sticky|fixed)/);
assert.match(styles, /nav a\[aria-current='page'\]\s*\{[^}]*text-decoration:\s*underline/);
});
test('UX-06C: filtros preparados para valores largos y apilamiento móvil con ayudas dinámicas', () => {
const styles = read('indicador-period-filters.scss');
const template = read('indicador-period-filters.html');
assert.match(styles, /\.select-value\s*\{[^}]*white-space:\s*normal;[^}]*overflow-wrap:\s*anywhere/);
assert.match(styles, /@media\s*\(max-width:\s*550px\)[\s\S]*flex:\s*1 1 100%/);
assert.match(styles, /mat-form-field\s*\{[^}]*min-width:\s*0/);
const fields = template.match(/<mat-form-field\b[^>]*>/g);
assert.equal(fields.length, 5);
assert.ok(fields.every(field => field.includes('subscriptSizing="dynamic"')));
assert.doesNotMatch(styles, /overflow:\s*hidden|z-index|\.mat-mdc-|::ng-deep/);
});