File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ import  'package:flutter/material.dart' ;
2+ import  'package:flutter_test/flutter_test.dart' ;
3+ import  'package:getwidget/getwidget.dart' ;
4+ 
5+ void  main () {
6+   testWidgets ('GFButton renders correctly and responds to tap' , (WidgetTester  tester) async  {
7+     bool  tapped =  false ;
8+     await  tester.pumpWidget (MaterialApp (
9+       home:  Scaffold (
10+         body:  GFButton (
11+           text:  'Test Button' ,
12+           onPressed:  () {
13+             tapped =  true ;
14+           },
15+         ),
16+       ),
17+     ));
18+ 
19+     // Verify the GFButton renders with correct text 
20+     expect (find.text ('Test Button' ), findsOneWidget);
21+ 
22+     // Tap the button. 
23+     await  tester.tap (find.byType (GFButton ));
24+     await  tester.pump ();
25+ 
26+     expect (tapped, isTrue);
27+   });
28+ 
29+   testWidgets ('GFButton disabled state works correctly' , (WidgetTester  tester) async  {
30+     await  tester.pumpWidget (MaterialApp (
31+       home:  Scaffold (
32+         body:  GFButton (
33+           text:  'Disabled Button' ,
34+           onPressed:  null ,
35+         ),
36+       ),
37+     ));
38+ 
39+     // The button should be disabled, we check that text exists 
40+     expect (find.text ('Disabled Button' ), findsOneWidget);
41+ 
42+     // Tapping should not trigger anything 
43+     await  tester.tap (find.byType (GFButton ));
44+     await  tester.pump ();
45+   });
46+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments