import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:smoke_cess_app/widgets/elevated_card.dart'; void main() { group('ElevatedCard', () { testWidgets('Renders the title and child', (WidgetTester tester) async { // Arrange const title = 'My Card Title'; const childText = 'My Card Content'; const child = Text(childText); const card = ElevatedCard(title: title, child: child); // Act await tester.pumpWidget(const MaterialApp(home: Scaffold(body: card))); final titleFinder = find.text(title); final childFinder = find.text(childText); // Assert expect(titleFinder, findsOneWidget); expect(childFinder, findsOneWidget); }); testWidgets('Uses default title style', (WidgetTester tester) async { // Arrange final card = ElevatedCard(title: 'My Title', child: Container()); // Act await tester.pumpWidget(MaterialApp(home: Scaffold(body: card))); final titleFinder = find.text('My Title'); final titleWidget = tester.widget(titleFinder); // Assert expect(titleWidget.style?.fontSize, equals(16.0)); expect(titleWidget.style?.fontWeight, equals(FontWeight.bold)); }); testWidgets('Uses custom title style', (WidgetTester tester) async { // Arrange final card = ElevatedCard( title: 'My Title', child: Container(), ); // Act await tester.pumpWidget(MaterialApp(home: Scaffold(body: card))); final titleFinder = find.text('My Title'); final titleWidget = tester.widget(titleFinder); // Assert expect(titleWidget.style?.fontSize, equals(16.0)); expect(titleWidget.style?.fontWeight, equals(FontWeight.bold)); }); testWidgets('Has rounded corners', (WidgetTester tester) async { // Arrange final card = ElevatedCard(title: 'My Title', child: Container()); // Act await tester.pumpWidget(MaterialApp(home: Scaffold(body: card))); final cardFinder = find.byType(Card); final cardWidget = tester.widget(cardFinder); // Assert expect( cardWidget.shape, const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(16.0)))); }); }); }