Test Cases
This commit is contained in:
@@ -5,7 +5,7 @@ import 'package:tasq/theme/app_surfaces.dart';
|
||||
import 'package:tasq/widgets/tasq_adaptive_list.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('AppTheme sets cardTheme elevation to 3 (M2-style)', (
|
||||
testWidgets('AppTheme sets cardTheme elevation to 1 (M3 tonal)', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
@@ -15,8 +15,9 @@ void main() {
|
||||
builder: (context) {
|
||||
final elevation = Theme.of(context).cardTheme.elevation;
|
||||
expect(elevation, isNotNull);
|
||||
expect(elevation, inInclusiveRange(2.0, 4.0));
|
||||
expect(elevation, equals(3));
|
||||
// M3 Expressive uses tonal elevation — minimal 0-1 shadow.
|
||||
expect(elevation, inInclusiveRange(0.0, 2.0));
|
||||
expect(elevation, equals(1));
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
@@ -46,7 +47,8 @@ void main() {
|
||||
|
||||
final material = tester.widget<Material>(materialFinder.first);
|
||||
expect(material.elevation, isNotNull);
|
||||
expect(material.elevation, inInclusiveRange(2.0, 4.0));
|
||||
// M3 Expressive: tonal elevation is 0-2, not the M2 range of 2-4.
|
||||
expect(material.elevation, inInclusiveRange(0.0, 2.0));
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
@@ -147,6 +149,44 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Desktop pagination forwards onPageChanged callback', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
int? receivedIndex;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
home: MediaQuery(
|
||||
data: const MediaQueryData(size: Size(1200, 800)),
|
||||
child: Scaffold(
|
||||
body: TasQAdaptiveList<int>(
|
||||
items: List.generate(60, (i) => i),
|
||||
columns: [
|
||||
TasQColumn<int>(header: 'C', cellBuilder: (c, t) => Text('$t')),
|
||||
],
|
||||
mobileTileBuilder: (c, t, a) => const SizedBox.shrink(),
|
||||
rowsPerPage: 10,
|
||||
onPageChanged: (firstRow) {
|
||||
receivedIndex = firstRow;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// locate the PaginatedDataTable and manually invoke the callback to
|
||||
// simulate the user requesting the second page
|
||||
final table = tester.widget<PaginatedDataTable>(
|
||||
find.byType(PaginatedDataTable),
|
||||
);
|
||||
expect(table.onPageChanged, isNotNull);
|
||||
|
||||
table.onPageChanged!(10);
|
||||
expect(receivedIndex, equals(10));
|
||||
});
|
||||
|
||||
testWidgets('AppSurfaces tokens are present and dialog/card radii differ', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user