Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart

Issue 2850693002: Trailing commas for named args in Flutter cons invocations (flutter-intellij#551). (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 7f13967820621442fc96b20f063b4768f98cedb1..1fd8852e03c1c15ebea728e9d14bdd0bd6d200b3 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -868,6 +868,78 @@ class ArgListContributorTest_Driver extends ArgListContributorTest {
@override
bool get enableNewAnalysisDriver => true;
+ test_ArgumentList_Flutter_InstanceCreationExpression_0() async {
+ configureFlutterPkg({
+ 'src/widgets/framework.dart': flutter_framework_code,
+ });
+
+ addTestSource('''
+import 'package:flutter/src/widgets/framework.dart';
+
+build() => new Row(
+ key: null,
+ ^
+ );
+''');
+
+ // Don't generate children boilerplate.
+ await computeSuggestions();
+
+ assertSuggest('children: ,',
+ csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
+ relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ defaultArgListString: null, // No default values.
+ selectionOffset: 10);
+ }
+
+ test_ArgumentList_Flutter_InstanceCreationExpression_1() async {
+ configureFlutterPkg({
+ 'src/widgets/framework.dart': flutter_framework_code,
+ });
+
+ addTestSource('''
+import 'package:flutter/src/widgets/framework.dart';
+
+build() => new Row(
+ key: null,
+ ^
+ );
+''');
+
+ await computeSuggestions(options: generateChildrenBoilerPlate);
+
+ assertSuggest('children: ,',
+ csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
+ relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ defaultArgListString: 'children: <Widget>[],',
+ selectionOffset: 10,
+ defaultArgumentListTextRanges: [10, 10]);
+ }
+
+ test_ArgumentList_Flutter_InstanceCreationExpression_2() async {
+ configureFlutterPkg({
+ 'src/widgets/framework.dart': flutter_framework_code,
+ });
+
+ addTestSource('''
+import 'package:flutter/src/widgets/framework.dart';
+
+build() => new Row(
+ ^
+ key: null,
+ );
+''');
+
+ await computeSuggestions(options: generateChildrenBoilerPlate);
+
+ assertSuggest('children: ,',
+ csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
+ relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ defaultArgListString: 'children: <Widget>[],',
+ selectionOffset: 10,
+ defaultArgumentListTextRanges: [10, 10]);
+ }
+
test_ArgumentList_Flutter_InstanceCreationExpression_children() async {
configureFlutterPkg({
'src/widgets/framework.dart': flutter_framework_code,
@@ -883,10 +955,11 @@ build() => new Container(
await computeSuggestions(options: generateChildrenBoilerPlate);
- assertSuggest('children: ',
+ assertSuggest('children: ,',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER,
- defaultArgListString: 'children: <Widget>[]',
+ defaultArgListString: 'children: <Widget>[],',
+ selectionOffset: 10,
defaultArgumentListTextRanges: [10, 10]);
}
@@ -908,10 +981,11 @@ build() => new Container(
await computeSuggestions(options: generateChildrenBoilerPlate);
- assertSuggest('children: ',
+ assertSuggest('children: ,',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER,
- defaultArgListString: 'children: []');
+ selectionOffset: 10,
+ defaultArgListString: 'children: [],');
}
test_ArgumentList_Flutter_InstanceCreationExpression_children_Map() async {
@@ -931,9 +1005,10 @@ build() => new Container(
await computeSuggestions(options: generateChildrenBoilerPlate);
- assertSuggest('children: ',
+ assertSuggest('children: ,',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ selectionOffset: 10,
defaultArgListString: null);
}

Powered by Google App Engine
This is Rietveld 408576698