fix(vacaciones): replace the progress bar with the prototype's date pair
Item 21 / audit 9b.4-9b.5 (t4:451-462, 469-479): the active vacation range showed a LinearProgressIndicator the prototype never draws. Replace it with the screen's real signature element -- a start/end date pair (day+month, weekday, connector rule) -- reused with a flat connector for the "programados"/"pasados" rows, replacing their plain ListTiles with proper cards.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/estado/estado_alarmas.dart';
|
||||
import 'package:pluriwave/l10n/formato_fechas.dart';
|
||||
import 'package:pluriwave/l10n/gen/app_localizations.dart';
|
||||
import 'package:pluriwave/modelos/alarma_musical.dart';
|
||||
import 'package:pluriwave/pantallas/pantalla_vacaciones.dart';
|
||||
@@ -221,4 +222,125 @@ void main() {
|
||||
|
||||
expect(find.text(l10n.newVacationRangeTitle), findsOneWidget);
|
||||
});
|
||||
|
||||
// Item 21 / audit 9b.4-9b.5 (t4:451-462, 469-479): the screen's signature
|
||||
// element is a start/end date pair, never a determinate progress bar.
|
||||
testWidgets(
|
||||
'el rango activo muestra el par de fechas, no una barra de progreso',
|
||||
(tester) async {
|
||||
final inicio = _hoyDia.subtract(const Duration(days: 3));
|
||||
final fin = _hoyDia.add(const Duration(days: 5));
|
||||
final estado = await _crearEstado(
|
||||
vacaciones: [
|
||||
RangoVacaciones(
|
||||
id: 'v1',
|
||||
nombre: 'Julio activo',
|
||||
inicio: inicio,
|
||||
fin: fin,
|
||||
),
|
||||
],
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
|
||||
await tester.pumpWidget(_buildScreen(estado));
|
||||
await _pumpEstable(tester);
|
||||
|
||||
expect(
|
||||
find.byType(LinearProgressIndicator),
|
||||
findsNothing,
|
||||
reason:
|
||||
't4:451-462 replaces the progress bar with a start/end date '
|
||||
'pair — the screen\'s signature element',
|
||||
);
|
||||
|
||||
expect(find.text(diaMesLocalizado('es', inicio)), findsOneWidget);
|
||||
expect(find.text(diaMesLocalizado('es', fin)), findsOneWidget);
|
||||
expect(
|
||||
find.text(nombreDiaSemanaLocalizado('es', inicio)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text(nombreDiaSemanaLocalizado('es', fin)), findsOneWidget);
|
||||
|
||||
final fechaTexto = tester.widget<Text>(
|
||||
find.text(diaMesLocalizado('es', inicio)),
|
||||
);
|
||||
expect(
|
||||
fechaTexto.style?.fontSize,
|
||||
26,
|
||||
reason: 't4:459 the date digits are 26px/w800/ls-1',
|
||||
);
|
||||
expect(fechaTexto.style?.fontWeight, FontWeight.w800);
|
||||
|
||||
final diaSemanaTexto = tester.widget<Text>(
|
||||
find.text(nombreDiaSemanaLocalizado('es', inicio)),
|
||||
);
|
||||
expect(
|
||||
diaSemanaTexto.style?.fontSize,
|
||||
11,
|
||||
reason: 't4:459 the weekday caption is 11px/w700/50%',
|
||||
);
|
||||
expect(diaSemanaTexto.style?.fontWeight, FontWeight.w700);
|
||||
|
||||
final regla = tester.widget<DecoratedBox>(
|
||||
find.byKey(const ValueKey('vacaciones-regla-activo')),
|
||||
);
|
||||
final decoration = regla.decoration as BoxDecoration;
|
||||
expect(
|
||||
decoration.gradient,
|
||||
isNotNull,
|
||||
reason:
|
||||
't4:460 the active range connector is a brand-teal gradient, '
|
||||
'not the flat rgba(255,255,255,.14) used by scheduled rows',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'un rango programado usa el mismo par de fechas, con una regla plana y '
|
||||
'una fila de etiqueta con el nombre del rango',
|
||||
(tester) async {
|
||||
final inicio = _hoyDia.add(const Duration(days: 20));
|
||||
final fin = _hoyDia.add(const Duration(days: 25));
|
||||
final estado = await _crearEstado(
|
||||
vacaciones: [
|
||||
RangoVacaciones(id: 'f2', nombre: 'Verano', inicio: inicio, fin: fin),
|
||||
],
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
|
||||
await tester.pumpWidget(_buildScreen(estado));
|
||||
await _pumpEstable(tester);
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(PantallaVacaciones),
|
||||
matching: find.byType(ListTile),
|
||||
),
|
||||
findsNothing,
|
||||
reason: '9b.5 (t4:469-479) replaces the ListTile row with a card',
|
||||
);
|
||||
expect(find.text(diaMesLocalizado('es', inicio)), findsOneWidget);
|
||||
expect(find.text(diaMesLocalizado('es', fin)), findsOneWidget);
|
||||
expect(
|
||||
find.text('Verano'),
|
||||
findsOneWidget,
|
||||
reason:
|
||||
't4:478 the label row shows the range name next to a '
|
||||
'"label" icon',
|
||||
);
|
||||
|
||||
final regla = tester.widget<DecoratedBox>(
|
||||
find.byKey(const ValueKey('vacaciones-regla-f2')),
|
||||
);
|
||||
final decoration = regla.decoration as BoxDecoration;
|
||||
expect(decoration.gradient, isNull);
|
||||
expect(
|
||||
decoration.color,
|
||||
Colors.white.withValues(alpha: 0.14),
|
||||
reason:
|
||||
't4:474 scheduled/past rows use a flat rgba(255,255,255,.14) '
|
||||
'connector, not the active gradient',
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user