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);
  });
}
