feat(tokens): add design tokens, type scale, push scaffold, and root nav state
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/tema/pluriwave_tokens.dart';
|
||||
|
||||
/// Design ADR-1: 3 new colour fields join the existing PluriWaveTokens
|
||||
/// extension (colours belong here because they must participate in lerp).
|
||||
/// Dedicated file under test/tema/ so the WU1 verify command
|
||||
/// (`flutter test test/tema/ ...`) discovers it; the single pre-existing
|
||||
/// PluriWaveTokens assertion inside pluriwave_foundations_test.dart is left
|
||||
/// untouched.
|
||||
void main() {
|
||||
group('PluriWaveTokens — redesign colours', () {
|
||||
test('dark keeps the pre-existing base palette', () {
|
||||
expect(PluriWaveTokens.dark.deepViolet, const Color(0xFF07121A));
|
||||
expect(PluriWaveTokens.dark.radiusMd, 22);
|
||||
expect(PluriWaveTokens.dark.spacingMd, 16);
|
||||
});
|
||||
|
||||
test(
|
||||
'dark exposes listSurface and liveGreen de-literalised from theme.dart',
|
||||
() {
|
||||
// Design ADR-1: these match the theme's previous raw literals
|
||||
// (surfaceContainerLow / secondary) exactly, so promoting them to
|
||||
// named tokens keeps rendered output byte-identical.
|
||||
expect(PluriWaveTokens.dark.listSurface, const Color(0xFF102532));
|
||||
expect(PluriWaveTokens.dark.liveGreen, const Color(0xFF7EE4C2));
|
||||
},
|
||||
);
|
||||
|
||||
test('dark exposes offlineAccent as a genuinely new colour', () {
|
||||
expect(PluriWaveTokens.dark.offlineAccent, const Color(0xFF94A3B8));
|
||||
});
|
||||
|
||||
test('copyWith overrides only the new colour fields', () {
|
||||
final overridden = PluriWaveTokens.dark.copyWith(
|
||||
listSurface: Colors.black,
|
||||
liveGreen: Colors.black,
|
||||
offlineAccent: Colors.black,
|
||||
);
|
||||
expect(overridden.listSurface, Colors.black);
|
||||
expect(overridden.liveGreen, Colors.black);
|
||||
expect(overridden.offlineAccent, Colors.black);
|
||||
// Untouched fields keep their original value.
|
||||
expect(overridden.deepViolet, PluriWaveTokens.dark.deepViolet);
|
||||
});
|
||||
|
||||
test('lerp interpolates listSurface, liveGreen and offlineAccent', () {
|
||||
const a = PluriWaveTokens.dark;
|
||||
final b = a.copyWith(
|
||||
listSurface: Colors.white,
|
||||
liveGreen: Colors.white,
|
||||
offlineAccent: Colors.white,
|
||||
);
|
||||
|
||||
final mid = a.lerp(b, 0.5);
|
||||
|
||||
expect(mid.listSurface, Color.lerp(a.listSurface, Colors.white, 0.5));
|
||||
expect(mid.liveGreen, Color.lerp(a.liveGreen, Colors.white, 0.5));
|
||||
expect(mid.offlineAccent, Color.lerp(a.offlineAccent, Colors.white, 0.5));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user