You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pinball/packages/pinball_ui/test/src/dialog/pinball_dialog_test.dart

45 lines
1.5 KiB

// ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pinball_ui/pinball_ui.dart';
void main() {
group('PinballDialog', () {
group('with title only', () {
testWidgets('renders the title and the body', (tester) async {
tester.binding.window.physicalSizeTestValue = const Size(2000, 4000);
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
await tester.pumpWidget(
const MaterialApp(
home: PinballDialog(title: 'title', child: Placeholder()),
),
);
expect(find.byType(PixelatedDecoration), findsOneWidget);
expect(find.text('title'), findsOneWidget);
expect(find.byType(Placeholder), findsOneWidget);
});
});
group('with title and subtitle', () {
testWidgets('renders the title, subtitle and the body', (tester) async {
tester.binding.window.physicalSizeTestValue = const Size(2000, 4000);
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
await tester.pumpWidget(
MaterialApp(
home: PinballDialog(
title: 'title',
subtitle: 'sub',
child: Icon(Icons.home),
),
),
);
expect(find.byType(PixelatedDecoration), findsOneWidget);
expect(find.text('title'), findsOneWidget);
expect(find.text('sub'), findsOneWidget);
expect(find.byType(Icon), findsOneWidget);
});
});
});
}