feat(ui): incorporar base institucional UX-06B

This commit is contained in:
Angel Capetillo Zavala
2026-10-13 11:38:17 -06:00
parent 9c012e9bb4
commit ecf2778f1a
10 changed files with 333 additions and 56 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+59
View File
@@ -0,0 +1,59 @@
import { readFileSync } from 'node:fs';
import { test } from 'node:test';
import assert from 'node:assert/strict';
const root = new URL('../', import.meta.url);
const read = path => readFileSync(new URL(path, root), 'utf8');
test('UX-06B: idioma, título, base y favicon', () => {
const index = read('src/index.html');
for (const value of [
'lang="es"',
'<title>Plataforma de Indicadores | ISSSTELEON</title>',
'<base href="/"',
'href="favicon.ico"',
]) assert.ok(index.includes(value), value);
});
test('UX-06B: fuentes aprobadas, pesos, HTTPS, swap y fallback', () => {
const index = read('src/index.html');
assert.equal(index.match(/family=Rajdhani/g)?.length, 1);
assert.equal(index.match(/family=Roboto/g)?.length, 1);
for (const value of [
'https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700',
'family=Roboto:wght@300;400;500',
'display=swap',
'https://fonts.googleapis.com/icon?family=Material+Icons',
]) assert.ok(index.includes(value), value);
const styles = read('src/styles.scss');
assert.ok(styles.includes("--issste-font-heading: 'Rajdhani', 'Roboto', sans-serif;"));
assert.ok(styles.includes("--issste-font-body: 'Roboto', sans-serif;"));
});
test('UX-06B: PNG original y mecanismo de publicación del asset', () => {
const png = readFileSync(new URL('public/images/LogoISSSTELEON.png', root));
assert.deepEqual(Array.from(png.subarray(0, 8)), [137, 80, 78, 71, 13, 10, 26, 10]);
assert.equal(png.readUInt32BE(16), 1125);
assert.equal(png.readUInt32BE(20), 358);
const config = JSON.parse(read('angular.json'));
assert.ok(config.projects.WebApp.architect.build.options.assets.some(
asset => asset.glob === '**/*' && asset.input === 'public',
));
assert.ok(read('src/app/app.html').includes('src="images/LogoISSSTELEON.png"'));
});
test('UX-06B: tokens globales, tema único y uso en shell/navegación', () => {
const styles = read('src/styles.scss');
for (const value of [
'--issste-text: #081839;',
'--issste-background: #F7F7F7;',
'@include mat.theme-overrides(',
'primary: var(--issste-text)',
'outline: var(--issste-text-secondary)',
]) assert.ok(styles.includes(value), value);
assert.equal(styles.match(/@include mat.theme\(/g)?.length, 1);
assert.ok(read('src/app/app.scss').includes('background: var(--issste-surface)'));
assert.ok(read('src/app/app.scss').includes('font-family: var(--issste-font-heading)'));
assert.ok(read('src/app/features/indicadores/indicadores-page.scss')
.includes('background: var(--issste-accent)'));
});
+9 -4
View File
@@ -1,7 +1,12 @@
<mat-toolbar color="primary">
<span>{{ title }}</span>
</mat-toolbar>
<a class="skip-link" href="#contenido-principal">Saltar al contenido principal</a>
<header class="institutional-header">
<div class="header-content">
<img class="institutional-logo" src="images/LogoISSSTELEON.png" alt="ISSSTELEON"
width="1125" height="358" />
<span class="platform-title">{{ title }}</span>
</div>
</header>
<main>
<main id="contenido-principal" tabindex="-1">
<router-outlet />
</main>
+88 -2
View File
@@ -1,3 +1,89 @@
main {
padding: 1.5rem;
:host {
display: block;
min-height: 100%;
}
.institutional-header {
position: sticky;
top: 0;
z-index: 100;
background: var(--issste-surface);
border-bottom: 3px solid var(--issste-logo-lime);
}
.header-content {
display: flex;
align-items: center;
gap: var(--issste-space-4);
box-sizing: border-box;
min-height: 69px;
max-width: 1488px;
margin-inline: auto;
padding-inline: var(--issste-page-gutter);
}
.institutional-logo {
display: block;
flex: 0 0 auto;
width: 200px;
height: auto;
}
.platform-title {
color: var(--issste-text);
font-family: var(--issste-font-heading);
font-size: 1.5rem;
font-weight: 600;
line-height: 1.15;
overflow-wrap: anywhere;
}
main {
padding: var(--issste-space-4) var(--issste-page-gutter);
scroll-margin-top: var(--issste-header-clearance);
}
.skip-link {
position: fixed;
top: var(--issste-space-2);
left: var(--issste-page-gutter);
z-index: 101;
transform: translateY(-200%);
padding: var(--issste-space-2) var(--issste-space-3);
color: var(--issste-surface);
background: var(--issste-text);
border-radius: var(--issste-radius);
}
.skip-link:focus {
transform: translateY(0);
}
@media (max-width: 550px) {
.header-content {
gap: var(--issste-space-2);
min-height: 64px;
}
.institutional-logo {
width: 145px;
}
.platform-title {
font-size: 1.125rem;
}
}
@media (max-width: 359px) {
.header-content {
flex-wrap: wrap;
justify-content: center;
padding-block: var(--issste-space-2);
gap: var(--issste-space-1);
}
.platform-title {
flex-basis: 100%;
text-align: center;
}
}
+42 -11
View File
@@ -1,25 +1,56 @@
import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';
import { provideHttpClient } from '@angular/common/http';
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
import { App } from './app';
describe('App', () => {
describe('App — UX-06B', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [App],
})
.compileComponents();
providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting()],
}).compileComponents();
});
function render() {
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
return fixture;
}
it('should create the app', () => {
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
expect(render().componentInstance).toBeTruthy();
});
it('should render the toolbar title', async () => {
const fixture = TestBed.createComponent(App);
await fixture.whenStable();
it('renders one institutional header and the platform identification', () => {
const element = render().nativeElement as HTMLElement;
expect(element.querySelectorAll('header')).toHaveLength(1);
expect(element.querySelector('header')?.textContent).toContain('Plataforma de Indicadores');
});
it('uses the authorized static logo with alternative text and intrinsic proportions', () => {
const logo = (render().nativeElement as HTMLElement).querySelector('header img');
expect(logo?.getAttribute('src')).toBe('images/LogoISSSTELEON.png');
expect(logo?.getAttribute('alt')).toBe('ISSSTELEON');
expect(logo?.getAttribute('width')).toBe('1125');
expect(logo?.getAttribute('height')).toBe('358');
});
it('keeps the routed content inside a main landmark and a keyboard skip target', () => {
const element = render().nativeElement as HTMLElement;
const main = element.querySelector('main#contenido-principal');
expect(main?.querySelector('router-outlet')).toBeTruthy();
expect(main?.getAttribute('tabindex')).toBe('-1');
expect(element.querySelector('a.skip-link')?.getAttribute('href')).toBe('#contenido-principal');
});
it('does not duplicate domain navigation or introduce shell HTTP requests', () => {
const fixture = render();
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('mat-toolbar')?.textContent).toContain('ISSSTELEON');
const element = fixture.nativeElement as HTMLElement;
expect(element.querySelector('nav')).toBeNull();
expect(element.querySelectorAll('[routerLink]')).toHaveLength(0);
TestBed.inject(HttpTestingController).expectNone(() => true);
TestBed.inject(HttpTestingController).verify();
});
});
+2 -3
View File
@@ -1,13 +1,12 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { MatToolbarModule } from '@angular/material/toolbar';
@Component({
imports: [RouterOutlet, MatToolbarModule],
imports: [RouterOutlet],
selector: 'app-root',
styleUrl: './app.scss',
templateUrl: './app.html',
})
export class App {
protected readonly title = 'ISSSTELEON';
protected readonly title = 'Plataforma de Indicadores';
}
@@ -1,12 +1,36 @@
:host { display: block; }
.dashboard { max-width: 1440px; margin: 0 auto; }
h1 { font: var(--mat-sys-headline-large); margin: .65rem 0; }
h1 { font: var(--mat-sys-headline-large); font-family: var(--issste-font-heading); font-weight: 700; margin: .65rem 0; }
header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; }
.domain { color: var(--mat-sys-primary); font: var(--mat-sys-label-large); }
.notice { padding: 1rem 1.25rem; border-left: 4px solid var(--mat-sys-primary); background: var(--mat-sys-surface-container); border-radius: 8px; }
.state { padding: 1.25rem; margin: 0; }
mat-form-field { width: 100%; max-width: 24rem; }
@media (max-width: 550px) { h1 { font: var(--mat-sys-headline-medium); } }
@media (max-width: 550px) { h1 { font-size: var(--mat-sys-headline-medium-size); line-height: var(--mat-sys-headline-medium-line-height); } }
.catalog-search { display: flex; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.catalog-search button { margin-top: .5rem; }
.search-result { color: var(--mat-sys-on-surface-variant); font: var(--mat-sys-body-medium); }
nav {
display: flex;
flex-wrap: wrap;
gap: var(--issste-space-2);
padding: var(--issste-space-2);
background: var(--issste-surface);
border: 1px solid var(--issste-border);
border-radius: var(--issste-radius);
}
nav a {
flex: 1 1 4rem;
max-width: 10rem;
color: var(--issste-text);
border-radius: var(--issste-radius);
}
nav a[aria-current='page'] {
background: var(--issste-accent);
font-weight: 700;
text-decoration: underline;
text-underline-offset: .25em;
}
@@ -41,6 +41,35 @@ describe('UX-05B catálogo expandible', () => {
function flushAll() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [0, null] }], layout: {} })); fixture.detectChanges(); }
function control(index = 0) { return fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))[index].componentInstance as IndicadorPeriodFilters; }
it('UX-06B conserva una navegación con rutas y estado activo en los tres dominios', () => {
const domains = ['tea', 'cacu', 'cama'] as const;
for (const domain of domains) {
if (domain !== 'tea') page.changeDominio(domain);
load([], domain);
const navs = fixture.nativeElement.querySelectorAll('nav') as NodeListOf<HTMLElement>;
expect(navs).toHaveLength(1);
expect(navs[0].getAttribute('aria-label')).toBe('Dominios de indicadores');
const links = Array.from(navs[0].querySelectorAll('a'));
expect(links.map(link => link.textContent?.trim())).toEqual(['TEA', 'CaCu', 'CaMa']);
expect(links.map(link => link.getAttribute('href'))).toEqual(domains.map(d => '/indicadores/' + d));
expect(links.filter(link => link.getAttribute('aria-current') === 'page')).toHaveLength(1);
expect(links[domains.indexOf(domain)].getAttribute('aria-current')).toBe('page');
expect(cards()).toHaveLength(0);
http.expectNone(() => true);
}
});
it('UX-06B conserva el selector técnico claro/oscuro y no vuelve a cargar el catálogo', async () => {
load();
await fixture.whenStable(); fixture.detectChanges();
const select = fixture.debugElement.query(By.directive(MatSelect)).componentInstance as MatSelect;
expect(select.options.map(option => option.value)).toEqual(['claro', 'oscuro']);
expect(select.value).toBe('claro');
page.changeTema('oscuro'); fixture.detectChanges();
expect(page.tema).toBe('oscuro');
expect(cards().every(card => !card.expanded)).toBe(true);
http.expectNone(() => true);
});
it.each([0, 2, 18, 37])('catálogo de %i conserva orden y no consulta figuras inicialmente', count => {
const items = Array.from({ length: count }, (_, i) => ({ ...item, id: 'id-' + i }));
load(items);
+3 -3
View File
@@ -1,15 +1,15 @@
<!doctype html>
<html lang="en">
<html lang="es">
<head>
<meta charset="utf-8" />
<title>WebApp</title>
<title>Plataforma de Indicadores | ISSSTELEON</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&amp;family=Roboto:wght@300;400;500&amp;display=swap"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
+75 -31
View File
@@ -1,39 +1,83 @@
// Include theming for Angular Material with `mat.theme()`.
// This Sass mixin will define CSS variables that are used for styling Angular Material
// components according to the Material 3 design spec.
// Learn more about theming and how to use it for your application's
// custom components at https://material.angular.dev/guide/theming
@use '@angular/material' as mat;
html {
height: 100%;
@include mat.theme(
(
color: (
primary: mat.$azure-palette,
tertiary: mat.$blue-palette,
),
typography: Roboto,
density: 0,
)
);
// Presentation candidates approved for UX-06B, not a certified brand guide.
--issste-text: #081839;
--issste-accent: #A8C243;
--issste-logo-lime: #C3D600;
--issste-text-secondary: #4B4949;
--issste-background: #F7F7F7;
--issste-surface: #FFFFFF;
--issste-border: #E4E7E9;
--issste-font-heading: 'Rajdhani', 'Roboto', sans-serif;
--issste-font-body: 'Roboto', sans-serif;
--issste-space-1: .25rem;
--issste-space-2: .5rem;
--issste-space-3: .75rem;
--issste-space-4: 1rem;
--issste-space-6: 1.5rem;
--issste-radius: .5rem;
--issste-page-gutter: clamp(.75rem, 2vw, 1.5rem);
--issste-header-clearance: 7rem;
min-height: 100%;
color-scheme: light;
scroll-padding-top: var(--issste-header-clearance);
@include mat.theme((
color: (
primary: mat.$azure-palette,
tertiary: mat.$blue-palette,
),
typography: Roboto,
density: 0,
));
// Public Material system tokens also reach CDK overlays under body.
// Keep the figure's claro/oscuro setting independent from the application theme.
@include mat.theme-overrides((
primary: var(--issste-text),
on-primary: var(--issste-surface),
primary-container: var(--issste-accent),
on-primary-container: var(--issste-text),
secondary: var(--issste-text-secondary),
on-secondary: var(--issste-surface),
secondary-container: var(--issste-border),
on-secondary-container: var(--issste-text),
tertiary: var(--issste-text),
on-tertiary: var(--issste-surface),
tertiary-container: var(--issste-logo-lime),
on-tertiary-container: var(--issste-text),
surface: var(--issste-surface),
surface-dim: var(--issste-background),
surface-bright: var(--issste-surface),
surface-container-lowest: var(--issste-surface),
surface-container-low: var(--issste-background),
surface-container: var(--issste-background),
surface-container-high: var(--issste-border),
surface-container-highest: var(--issste-border),
on-surface: var(--issste-text),
on-surface-variant: var(--issste-text-secondary),
outline: var(--issste-text-secondary),
outline-variant: var(--issste-border),
));
}
body {
// Default the application to a light color theme. This can be changed to
// `dark` to enable the dark color theme, or to `light dark` to defer to the
// user's system settings.
color-scheme: light;
// Set a default background, font and text colors for the application using
// Angular Material's system-level CSS variables. Learn more about these
// variables at https://material.angular.dev/guide/system-variables
background-color: var(--mat-sys-surface);
color: var(--mat-sys-on-surface);
font: var(--mat-sys-body-medium);
// Reset the user agent margin.
margin: 0;
height: 100%;
min-height: 100vh;
background: var(--issste-background);
color: var(--issste-text);
font: var(--mat-sys-body-medium);
font-family: var(--issste-font-body);
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--issste-font-heading);
font-weight: 700;
}
:focus-visible {
outline: 2px solid var(--issste-text);
outline-offset: 3px;
}
/* You can add global styles to this file, and also import other style files */