@@ -30,6 +30,8 @@ void main() {
3030 (document: textDocument2, position: activeCursorPosition2): result2,
3131 (document: textDocument1, position: activeCursorPosition3): resultWithText,
3232 (document: textDocument1, position: activeCursorPosition4): resultWithTitle,
33+ (document: textDocument1, position: activeCursorPosition5):
34+ deprecatedResult,
3335 };
3436
3537 late MockEditorClient mockEditorClient;
@@ -145,6 +147,27 @@ void main() {
145147 });
146148 });
147149
150+ testWidgets ('verify editable arguments when some are deprecated' , (
151+ tester,
152+ ) async {
153+ await tester.runAsync (() async {
154+ // Load the property editor.
155+ await tester.pumpWidget (wrap (propertyEditor));
156+ final editableArgsFuture = waitForEditableArgs ();
157+
158+ // Send an active location changed event.
159+ eventController.add (activeLocationChangedEvent5);
160+
161+ // Wait for the expected editable args.
162+ final editableArgs = await editableArgsFuture;
163+ verifyEditableArgs (
164+ actual: editableArgs,
165+ // Only deprecated properties with set arguments should be included.
166+ expected: [deprecatedPropertyWithArg],
167+ );
168+ });
169+ });
170+
148171 testWidgets ('verify editable arguments update when widget changes' , (
149172 tester,
150173 ) async {
@@ -329,6 +352,30 @@ void main() {
329352 });
330353 });
331354
355+ group ('inputs for deprecated arguments' , () {
356+ testWidgets ('inputs are expected for deprecated arguments' , (tester) async {
357+ // Load the property editor.
358+ await tester.pumpWidget (wrap (propertyEditor));
359+
360+ // Change the editable args.
361+ controller.initForTestsOnly (editableArgsResult: deprecatedResult);
362+ await tester.pumpAndSettle ();
363+
364+ final deprecatedWithArgInput = _findDropdownButtonFormField (
365+ 'deprecatedWithArg' ,
366+ );
367+
368+ // Verify the inputs are expected.
369+ expect (deprecatedWithArgInput, findsOneWidget);
370+
371+ // Verify the labels and required are expected.
372+ _labelsAndRequiredTextAreExpected (
373+ deprecatedWithArgInput,
374+ inputExpectations: deprecatedWithArgInputExpectations,
375+ );
376+ });
377+ });
378+
332379 group ('filtering editable arguments' , () {
333380 testWidgets ('can filter by name' , (tester) async {
334381 // Load the property editor.
@@ -884,8 +931,17 @@ void _labelsAndRequiredTextAreExpected(
884931 shouldBeSet ? findsOneWidget : findsNothing,
885932 reason: 'Expected to find ${shouldBeSet ? 'a' : 'no' } "set" badge.' ,
886933 );
934+ // Check for the existence/non-existence of the "deprecated" badge.
935+ final shouldBeDeprecated = inputExpectations['isDeprecated' ] == true ;
936+ expect (
937+ _labelForInput (inputFinder, matching: 'deprecated' ),
938+ shouldBeDeprecated ? findsOneWidget : findsNothing,
939+ reason:
940+ 'Expected to find ${shouldBeDeprecated ? 'a' : 'no' } "deprecated" badge.' ,
941+ );
887942 // Check for the existence/non-existence of the "default" badge.
888- final shouldBeDefault = inputExpectations['isDefault' ] == true ;
943+ final shouldBeDefault =
944+ inputExpectations['isDefault' ] == true && ! shouldBeDeprecated;
889945 expect (
890946 _labelForInput (inputFinder, matching: 'default' ),
891947 shouldBeDefault ? findsOneWidget : findsNothing,
@@ -1058,6 +1114,18 @@ final activeLocationChangedEvent4 = ActiveLocationChangedEvent(
10581114 textDocument: textDocument1,
10591115);
10601116
1117+ // Location position 5
1118+ final activeCursorPosition5 = CursorPosition (character: 81 , line: 19 );
1119+ final anchorCursorPosition5 = CursorPosition (character: 113 , line: 12 );
1120+ final editorSelection5 = EditorSelection (
1121+ active: activeCursorPosition5,
1122+ anchor: anchorCursorPosition5,
1123+ );
1124+ final activeLocationChangedEvent5 = ActiveLocationChangedEvent (
1125+ selections: [editorSelection5],
1126+ textDocument: textDocument1,
1127+ );
1128+
10611129final notADartDocument = TextDocument (
10621130 uriAsString: '/my/fake/other.js' ,
10631131 version: 1 ,
@@ -1122,6 +1190,7 @@ final heightInputExpectations = {
11221190 'isSet' : false ,
11231191 'isRequired' : false ,
11241192 'isDefault' : true ,
1193+ 'isDeprecated' : false ,
11251194};
11261195final result1 = EditableArgumentsResult (
11271196 name: widgetName,
@@ -1143,6 +1212,7 @@ final softWrapInputExpectations = {
11431212 'isSet' : false ,
11441213 'isRequired' : false ,
11451214 'isDefault' : true ,
1215+ 'isDeprecated' : false ,
11461216};
11471217final alignProperty = EditableArgument .fromJson ({
11481218 'name' : 'align' ,
@@ -1169,12 +1239,49 @@ final alignInputExpectations = {
11691239 'isSet' : true ,
11701240 'isRequired' : false ,
11711241 'isDefault' : false ,
1242+ 'isDeprecated' : false ,
11721243};
11731244final result2 = EditableArgumentsResult (
11741245 name: widgetName,
11751246 args: [softWrapProperty, alignProperty],
11761247);
11771248
1249+ // Result for test cases of deprecated properties
1250+ final deprecatedPropertyNoArg = EditableArgument .fromJson ({
1251+ 'name' : 'deprecatedNoArg' ,
1252+ 'type' : 'bool' ,
1253+ 'isNullable' : false ,
1254+ 'defaultValue' : false ,
1255+ 'hasArgument' : false ,
1256+ 'isEditable' : true ,
1257+ 'isRequired' : false ,
1258+ 'isDeprecated' : true ,
1259+ });
1260+
1261+ final deprecatedPropertyWithArg = EditableArgument .fromJson ({
1262+ 'name' : 'deprecatedWithArg' ,
1263+ 'type' : 'bool' ,
1264+ 'value' : false ,
1265+ 'isNullable' : false ,
1266+ 'defaultValue' : true ,
1267+ 'hasArgument' : true ,
1268+ 'isEditable' : true ,
1269+ 'isRequired' : false ,
1270+ 'isDeprecated' : true ,
1271+ });
1272+
1273+ final deprecatedWithArgInputExpectations = {
1274+ 'isSet' : true ,
1275+ 'isRequired' : false ,
1276+ 'isDefault' : false ,
1277+ 'isDeprecated' : true ,
1278+ };
1279+
1280+ final deprecatedResult = EditableArgumentsResult (
1281+ name: widgetName,
1282+ args: [deprecatedPropertyNoArg, deprecatedPropertyWithArg],
1283+ );
1284+
11781285// Example results for documentation test cases.
11791286final resultWithWidgetNameAndDocs = result1;
11801287final resultWithWidgetNameNoDocs = result2;
0 commit comments