mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Create checkbox_test.dart
This commit is contained in:
30
test/widgets/checkbox_test.dart
Normal file
30
test/widgets/checkbox_test.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:apidash/widgets/checkbox.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets('Testing for Checkbox', (tester) async {
|
||||||
|
dynamic changedValue;
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
title: 'Checkbox Widget',
|
||||||
|
home: Scaffold(
|
||||||
|
body: CheckBox(
|
||||||
|
keyId: "1",
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {
|
||||||
|
changedValue = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.byKey(const Key("1")), findsOneWidget);
|
||||||
|
var box = find.byKey(const Key("1"));
|
||||||
|
await tester.tap(box);
|
||||||
|
await tester.pump();
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(changedValue, true);
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user