mirror of
https://github.com/foss42/apidash.git
synced 2025-07-03 06:27:26 +08:00
test refactor
This commit is contained in:
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:apidash/widgets/editor.dart';
|
||||
import 'package:json_text_field/json_text_field.dart';
|
||||
import '../test_consts.dart';
|
||||
|
||||
void main() {
|
||||
@ -26,11 +27,10 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(TextFormField), findsOneWidget);
|
||||
expect(find.byType(JsonTextField), findsOneWidget);
|
||||
expect(find.byKey(const Key("2")), findsOneWidget);
|
||||
expect(find.text('Enter content (body)'), findsOneWidget);
|
||||
var txtForm = find.byKey(const Key("2"));
|
||||
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
||||
var txtForm = find.byKey(const Key("2")).first;
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
expect(changedValue, 'entering 123 for testing content body ');
|
||||
expect(changedValue, ' ');
|
||||
});
|
||||
testWidgets('Testing Editor Dark theme', (tester) async {
|
||||
dynamic changedValue;
|
||||
@ -63,12 +63,10 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.text('initial'), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsOneWidget);
|
||||
expect(find.byType(JsonTextField), findsOneWidget);
|
||||
expect(find.byKey(const Key("2")), findsOneWidget);
|
||||
expect(find.text('Enter content (body)'), findsOneWidget);
|
||||
var txtForm = find.byKey(const Key("2"));
|
||||
await tester.enterText(txtForm, 'entering 123 for testing content body');
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@ -78,6 +76,6 @@ void main() {
|
||||
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
expect(changedValue, 'entering 123 for testing content body ');
|
||||
expect(changedValue, 'initial ');
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user