feat(apps): establish shared mobile design system
This commit is contained in:
39
apps/heqi_design_system/test/design_system_test.dart
Normal file
39
apps/heqi_design_system/test/design_system_test.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:heqi_design_system/heqi_design_system.dart';
|
||||
|
||||
void main() {
|
||||
test('two brands share safety semantics but use distinct primary colors', () {
|
||||
final consumer = HeqiTheme.light(HeqiBrand.consumer).colorScheme;
|
||||
final service = HeqiTheme.light(HeqiBrand.service).colorScheme;
|
||||
|
||||
expect(consumer.primary, HeqiColors.consumerPrimary);
|
||||
expect(service.primary, HeqiColors.servicePrimary);
|
||||
expect(consumer.error, HeqiColors.danger);
|
||||
expect(service.error, HeqiColors.danger);
|
||||
});
|
||||
|
||||
testWidgets('status pill exposes a semantic status label', (tester) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: HeqiTheme.light(HeqiBrand.consumer),
|
||||
home: const Scaffold(
|
||||
body: HeqiStatusPill(label: '已通过', tone: HeqiStatusTone.success),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(widget) => widget is Semantics && widget.properties.label == '状态:已通过',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
test('touch target follows Material mobile minimum', () {
|
||||
expect(HeqiSize.minTouchTarget, greaterThanOrEqualTo(48));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user