feat(mobile): UI-01 theme system, shared components and navigation
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/// SectionHeader widget 测试(UI-01 Task 3)。
|
||||
///
|
||||
/// 覆盖:分组标题渲染(titleMedium 字阶)、可选行尾动作渲染/缺省。
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:photo_live/app/theme.dart';
|
||||
import 'package:photo_live/ui/components/section_header.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('渲染标题与可选行尾动作', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.light,
|
||||
home: const Scaffold(
|
||||
body: SectionHeader(title: '活动信息', trailing: Text('查看全部')),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final title = tester.widget<Text>(find.text('活动信息'));
|
||||
expect(title.style!.fontSize, 17, reason: '分组标题字阶 17(titleMedium)');
|
||||
expect(find.text('查看全部'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('无行尾动作 → 仅标题', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(body: SectionHeader(title: '活动信息')),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('活动信息'), findsOneWidget);
|
||||
expect(find.byType(TextButton), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user