refactor(indicadores): extraer componente de figura UX-03
This commit is contained in:
@@ -7,6 +7,7 @@ import { syntheticCatalogs } from './indicadores.synthetic-fixtures';
|
||||
import { PlotlyFigure } from './indicadores.models';
|
||||
import { Component } from '@angular/core';
|
||||
import { IndicadoresPage } from './indicadores-page';
|
||||
import { IndicadorFigureCard } from './indicador-figure-card';
|
||||
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
|
||||
|
||||
@Component({ selector: 'app-plotly-chart', inputs: ['figure'], template: '' })
|
||||
@@ -22,7 +23,7 @@ describe('IndicadoresPage', () => {
|
||||
let fixture: ReturnType<typeof TestBed.createComponent<IndicadoresPage>>;
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ imports: [IndicadoresPage], providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting()] });
|
||||
TestBed.overrideComponent(IndicadoresPage, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } });
|
||||
TestBed.overrideComponent(IndicadorFigureCard, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } });
|
||||
fixture = TestBed.createComponent(IndicadoresPage);
|
||||
page = fixture.componentInstance;
|
||||
http = TestBed.inject(HttpTestingController);
|
||||
@@ -94,10 +95,12 @@ describe('IndicadoresPage', () => {
|
||||
const req = http.expectOne(r => r.url.includes('/synthetic_future/figuras/fig_c2_apiladas'));
|
||||
expect(req.request.params.has('periodos')).toBe(false);
|
||||
req.flush({ data: [{ type: 'bar', y: [50, null] }], layout: { barmode: 'stack' } });
|
||||
expect(page.interpretation.join(' ')).toContain('composición porcentual');
|
||||
fixture.detectChanges();
|
||||
expect((fixture.debugElement.query(By.directive(IndicadorFigureCard)).componentInstance as IndicadorFigureCard).interpretation.join(' ')).toContain('composición porcentual');
|
||||
page.selectFigura('fig_c1_puntos');
|
||||
http.expectOne(r => r.url.includes('/fig_c1_puntos')).flush({ data: [], layout: {} });
|
||||
expect(page.interpretation.join(' ')).toContain('no entregan intervalos Wilson efectivos');
|
||||
fixture.detectChanges();
|
||||
expect((fixture.debugElement.query(By.directive(IndicadorFigureCard)).componentInstance as IndicadorFigureCard).interpretation.join(' ')).toContain('no entregan intervalos Wilson efectivos');
|
||||
});
|
||||
it('presenta carga y elige una primera figura válida desde el catálogo', () => {
|
||||
expect(page.catalogLoading()).toBe(true);
|
||||
@@ -225,7 +228,7 @@ describe('IndicadoresPage', () => {
|
||||
expect(page.result().message).toContain(message);
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.textContent).not.toContain('error privado');
|
||||
page.requestFigure();
|
||||
fixture.nativeElement.querySelector('app-indicador-figure-card button').click();
|
||||
figure().flush({ data: [], layout: {} });
|
||||
expect(page.result().status).toBe('ready');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user