Skip to content

Commit

Permalink
add on changed test
Browse files Browse the repository at this point in the history
  • Loading branch information
erayerdin committed Dec 6, 2022
1 parent 34dc770 commit 4ab0322
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/form_builder_stream_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,31 @@ void main() {
expect(nextChange, contains('text1'));
expect(nextChange['text1']?.value, isNull);
});

testWidgets('on changed', (WidgetTester tester) async {
await tester.runAsync(() async {
await tester.pumpWidget(buildTestableFieldWidget(form));
final widget = find.byWidget(emptyTextField);

expectLater(
formKey.currentState!.onChanged.map(
(fields) =>
fields.entries.map((e) => {e.key: e.value.value}).toList(),
),
emitsInOrder([
[
{'text1': null}
],
[
{'text1': 'foo'}
],
[], // caused by `FormBuilderState.unregisterField`
emitsDone,
]),
);

await tester.enterText(widget, 'foo');
});
});
});
}

0 comments on commit 4ab0322

Please sign in to comment.