From ac49168c02c83234ce554a8f389a23ead0383cdb Mon Sep 17 00:00:00 2001 From: airkjw Date: Sat, 13 Jun 2026 18:26:20 +0900 Subject: [PATCH] test(juice): PressableScale doesn't swallow the inner button tap --- test/ui/pressable_scale_test.dart | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/ui/pressable_scale_test.dart diff --git a/test/ui/pressable_scale_test.dart b/test/ui/pressable_scale_test.dart new file mode 100644 index 0000000..07a7b23 --- /dev/null +++ b/test/ui/pressable_scale_test.dart @@ -0,0 +1,43 @@ +import 'package:block_seasons/ui/widgets/pressable_scale.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('inner button onPressed still fires when wrapped', (tester) async { + var taps = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: Center( + child: PressableScale( + child: FilledButton( + onPressed: () => taps++, + child: const Text('Play'), + ), + ), + ), + ), + )); + + await tester.tap(find.text('Play')); + await tester.pump(); + expect(taps, 1, reason: 'PressableScale must not swallow the inner tap'); + }); + + testWidgets('own onTap fires when no inner handler', (tester) async { + var taps = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: Center( + child: PressableScale( + onTap: () => taps++, + child: const SizedBox(width: 100, height: 50), + ), + ), + ), + )); + + await tester.tap(find.byType(PressableScale)); + await tester.pump(); + expect(taps, 1); + }); +}