@@ -439,6 +439,16 @@ void main() {
439
439
});
440
440
441
441
group ('filtering editable arguments' , () {
442
+ void resetFilters () {
443
+ for (final filter in controller.settingFilters) {
444
+ filter.setting.value = filter.defaultValue;
445
+ }
446
+ }
447
+
448
+ tearDown (() {
449
+ resetFilters ();
450
+ });
451
+
442
452
testWidgets ('can filter by name' , (tester) async {
443
453
// Load the property editor.
444
454
await tester.pumpWidget (wrap (propertyEditor));
@@ -525,6 +535,36 @@ void main() {
525
535
expect (widthInput, findsNothing);
526
536
expect (heightInput, findsNothing);
527
537
});
538
+
539
+ testWidgets ('can filter for only set values' , (tester) async {
540
+ // Load the property editor.
541
+ await tester.pumpWidget (wrap (propertyEditor));
542
+
543
+ // Change the editable args.
544
+ controller.initForTestsOnly (editableArgsResult: result1);
545
+ await tester.pumpAndSettle ();
546
+
547
+ final titleInput = _findTextFormField ('String? title' );
548
+ final widthInput = _findTextFormField ('double width' );
549
+ final heightInput = _findTextFormField ('double? height' );
550
+
551
+ // Verify all inputs are visible.
552
+ expect (_findNoPropertiesMessage, findsNothing);
553
+ expect (titleInput, findsOneWidget);
554
+ expect (widthInput, findsOneWidget);
555
+ expect (heightInput, findsOneWidget);
556
+
557
+ // Filter for only set vaues.
558
+ await _setFilter (
559
+ 'Only include properties that are set in the code.' ,
560
+ tester: tester,
561
+ );
562
+
563
+ // Verify only the "title" and "width" properties are visible.
564
+ expect (heightInput, findsNothing);
565
+ expect (titleInput, findsOneWidget);
566
+ expect (widthInput, findsOneWidget);
567
+ });
528
568
});
529
569
530
570
group ('editing arguments' , () {
@@ -952,6 +992,33 @@ final _findNoPropertiesMessage = find.text(
952
992
'No widget properties at current cursor location.' ,
953
993
);
954
994
995
+ Future <void > _setFilter (
996
+ String filterSettingText, {
997
+ required WidgetTester tester,
998
+ }) async {
999
+ // Click the filter button.
1000
+ final filterButtonFinder = find.byType (DevToolsFilterButton );
1001
+ await tester.tap (filterButtonFinder);
1002
+ await tester.pumpAndSettle ();
1003
+
1004
+ // Find the checkbox for the filter and click it.
1005
+ final rowFinder = find.ancestor (
1006
+ of: find.textContaining (filterSettingText),
1007
+ matching: find.byType (Row ),
1008
+ );
1009
+ final checkboxFinder = find.descendant (
1010
+ of: rowFinder,
1011
+ matching: find.byType (NotifierCheckbox ),
1012
+ );
1013
+ await tester.tap (checkboxFinder);
1014
+ await tester.pumpAndSettle ();
1015
+
1016
+ // Click "Apply" to apply the filter and close the dialog.
1017
+ final applyFilterButtonFinder = find.byType (DialogApplyButton );
1018
+ await tester.tap (applyFilterButtonFinder);
1019
+ await tester.pumpAndSettle ();
1020
+ }
1021
+
955
1022
Finder _findFilterField () => find.descendant (
956
1023
of: find.byType (StandaloneFilterField <EditableProperty >),
957
1024
matching: find.byType (TextField ),
0 commit comments