feat: align shared app foundations
This commit is contained in:
1 parent
bd6bb0ffce
commit
c5653a3699
21 files changed
+894
-66
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/common/theme/jinzhi_theme.dart';
|
||||
import 'package:jinzhi_flutter_app/common/widgets/app_network_image.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('uses the standard fallback for an empty image URL', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
ShadApp(
|
||||
theme: ShadThemeData(colorScheme: jinzhiLightScheme),
|
||||
home: const Scaffold(body: AppNetworkImage(imageUrl: ' ')),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byIcon(Icons.image_not_supported_outlined), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('uses a supplied fallback for an empty image URL', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
ShadApp(
|
||||
theme: ShadThemeData(colorScheme: jinzhiLightScheme),
|
||||
home: const Scaffold(
|
||||
body: AppNetworkImage(
|
||||
imageUrl: '',
|
||||
errorWidget: Text('image unavailable'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('image unavailable'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user