diff --git a/src/app/features/indicadores/indicador-ayuda.spec.ts b/src/app/features/indicadores/indicador-ayuda.spec.ts
new file mode 100644
index 0000000..e177c77
--- /dev/null
+++ b/src/app/features/indicadores/indicador-ayuda.spec.ts
@@ -0,0 +1,50 @@
+// Covers the round "?" help of TEA's cards: hover or focus shows the text, a click keeps it until the next click.
+// Fixture: a host component that projects one line of text into the button.
+import { Component } from '@angular/core';
+import { TestBed } from '@angular/core/testing';
+import { IndicadorAyuda } from './indicador-ayuda';
+
+@Component({ imports: [IndicadorAyuda], template: ` {{ note }}{{ indicador.titulo }}
+ {{ indicador.titulo }}
@for (line of interpretation; track $index) {
+ @if (state.status === 'ready' && state.footnotes?.length) {
+ @for (note of state.footnotes; track $index) {
Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}
+ @if (!ayudaRedonda) { + +Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}
+ } } @else {{{ !selected?.figuras?.length ? 'El indicador no tiene figuras disponibles.' : 'Completa una selección válida para consultar la figura.' }}
} @@ -84,7 +93,7 @@ } @if (state.status === 'ready' && state.highlight; as h) { -Selección: {{ highlightStatus }}
@for (row of highlightRows(h); track row.group?.id ?? '') { diff --git a/src/app/features/indicadores/indicador-figure-card.scss b/src/app/features/indicadores/indicador-figure-card.scss index 3fe56b0..8f2c09f 100644 --- a/src/app/features/indicadores/indicador-figure-card.scss +++ b/src/app/features/indicadores/indicador-figure-card.scss @@ -22,6 +22,7 @@ .methodology-toggle:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; } .figure-card { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; overflow: visible; min-width: 0; border: 1px solid var(--issste-border); } +.figure-card.sin-marco { position: static; border: 0; box-shadow: none; background: transparent; --mat-card-outlined-outline-width: 0; --mat-card-elevated-container-elevation: none; } .figure-heading { grid-row: 2; min-width: 0; padding-bottom: .5rem; } .interpretation { grid-row: 1; } .figure-legend { grid-row: 3; min-width: 0; } @@ -117,6 +118,7 @@ .highlight-legend { display: grid; gap: .5rem; padding: .5rem .75rem .75rem; color: var(--issste-text); } .dark .highlight-legend { color: #eef1f7; } .highlight-status { margin: 0; font-weight: 600; } +.sin-estado .highlight-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .highlight-back { justify-self: start; } .highlight-keys { display: flex; flex-wrap: wrap; gap: .5rem; } .highlight-legend button { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: .3rem .75rem; text-align: start; @@ -126,3 +128,6 @@ .highlight-legend button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } .highlight-legend .legend-swatch { border-radius: 50%; } .highlight-legend .highlight-group { font-weight: 600; } + +.ayuda-lista { margin: 0; padding-left: 1.1rem; } +.ayuda-nota { margin: .5rem 0 0; } diff --git a/src/app/features/indicadores/indicador-figure-card.spec.ts b/src/app/features/indicadores/indicador-figure-card.spec.ts index d7b6cd9..be6bde9 100644 --- a/src/app/features/indicadores/indicador-figure-card.spec.ts +++ b/src/app/features/indicadores/indicador-figure-card.spec.ts @@ -515,4 +515,14 @@ describe('IndicadorFigureCard', () => { expect(JSON.stringify(original)).toBe(snapshot); expect(JSON.stringify(copy)).toBe(copySnapshot); }); + it('con la ayuda redonda no repite el título ni el nombre de la figura', () => { + // Fails if TEA's cards bring back the heading box with the title and «Figura: …» under the card's own title. + fixture.componentRef.setInput('ayudaRedonda', true); + ready({ data: [{ y: [1] }], layout: {} }); + const root: HTMLElement = fixture.nativeElement; + expect(root.querySelector('.figure-title')).toBeNull(); + expect(root.querySelector('.figure-id')).toBeNull(); + expect(root.querySelector('.ayuda-boton')).not.toBeNull(); + expect(root.querySelector('.interpretation')).toBeNull(); + }); }); diff --git a/src/app/features/indicadores/indicador-figure-card.ts b/src/app/features/indicadores/indicador-figure-card.ts index dc6f8cc..3e56541 100644 --- a/src/app/features/indicadores/indicador-figure-card.ts +++ b/src/app/features/indicadores/indicador-figure-card.ts @@ -10,6 +10,7 @@ import { figureDisplayName } from './indicadores-figure-labels'; import { CategoryLabel } from './indicadores-axis-labels'; import { figureIdentity, identityElementId } from './indicadores-identities'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; +import { IndicadorAyuda } from './indicador-ayuda'; import { figureInterpretation, PERIOD_INTERPRETATION } from './indicadores-methodology'; import { DonutHierarchy, DonutLegendEntry, DonutSelection, donutSimpleView, donutView } from './indicadores-donut-drilldown'; import { FigureHighlight, highlightAt, highlightFigure, highlightLabel, highlightRows, HighlightSelection, toggleHighlight } from './indicadores-highlight'; @@ -41,7 +42,7 @@ export interface FigureState { selector: 'app-indicador-figure-card', standalone: true, host: { '[class.methodology-expanded]': 'methodologyExpanded()' }, - imports: [MatButtonModule, MatIconModule, MatCardModule, MatProgressBarModule, MatTooltipModule, PlotlyChart], + imports: [MatButtonModule, MatIconModule, MatCardModule, MatProgressBarModule, MatTooltipModule, PlotlyChart, IndicadorAyuda], templateUrl: './indicador-figure-card.html', styleUrl: './indicador-figure-card.scss', }) @@ -142,6 +143,8 @@ export class IndicadorFigureCard implements OnChanges { if (point?.curveNumber === (this.activeParent ? 1 : 0) && typeof point.label === 'string') this.expandParent(point.label); else if (this.activeParent && point?.curveNumber === 0 && typeof point.label === 'string') this.selectCategory(point.label); } + // A round "?" button with the reading guide instead of the «Cómo leer» box. + @Input() ayudaRedonda = false; @Input() selected?: Indicador; @Input() metadata?: IndicadorMetadatos; @Input({ required: true }) figuraId!: string; diff --git a/src/app/features/indicadores/indicador-figure-panel.spec.ts b/src/app/features/indicadores/indicador-figure-panel.spec.ts index e34ec83..d858e65 100644 --- a/src/app/features/indicadores/indicador-figure-panel.spec.ts +++ b/src/app/features/indicadores/indicador-figure-panel.spec.ts @@ -33,6 +33,8 @@ describe('IndicadorFigurePanel', () => { fixture.componentRef.setInput('dominio', 'tea'); fixture.componentRef.setInput('indicador', catalog[0]); fixture.componentRef.setInput('figuraId', 'f1'); + // These tests cover the «Cómo leer» box shared by the domains; TEA's round help has its own spec. + fixture.componentRef.setInput('ayudaRedonda', false); fixture.componentRef.setInput('tema', 'claro'); state = TestBed.inject(IndicadoresMemory).restoreGlobal('tea', ['semestre']); fixture.componentRef.setInput('applied', state.applied); @@ -373,6 +375,7 @@ describe('IndicadorFigurePanel', () => { fixture = TestBed.createComponent(IndicadorFigurePanel); fixture.componentRef.setInput('dominio', 'tea'); fixture.componentRef.setInput('indicador', catalog[0]); fixture.componentRef.setInput('figuraId', 'f1'); fixture.componentRef.setInput('tema', 'claro'); + fixture.componentRef.setInput('ayudaRedonda', false); fixture.componentRef.setInput('applied', state.applied); page = fixture.componentInstance; load(); figure().flush({ data: [], layout: {} }); expect(JSON.stringify(state)).toBe(snapshot); diff --git a/src/app/features/indicadores/indicador-figure-panel.ts b/src/app/features/indicadores/indicador-figure-panel.ts index 0213b44..711c4c4 100644 --- a/src/app/features/indicadores/indicador-figure-panel.ts +++ b/src/app/features/indicadores/indicador-figure-panel.ts @@ -23,9 +23,10 @@ import { MatTooltipModule } from '@angular/material/tooltip'; @Component({ selector: 'app-indicador-figure-panel', + host: { '[class.ayuda-externa]': 'conAyudaRedonda' }, imports: [IndicadorFigureCard, MatTooltipModule], template: ` -