| Index: pkg/analysis_server/test/services/correction/assist_test.dart
|
| diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
|
| index b52c25d46d1f7a7d3eb1f39d103d442afbfffcff..29b3920b0722f86837bf626cb9847791e130b65a 100644
|
| --- a/pkg/analysis_server/test/services/correction/assist_test.dart
|
| +++ b/pkg/analysis_server/test/services/correction/assist_test.dart
|
| @@ -1036,6 +1036,129 @@ class A {
|
| ''');
|
| }
|
|
|
| + test_convertFlutterChild_OK_multiLine() async {
|
| + _configureFlutterPkg({
|
| + 'src/widgets/framework.dart': _flutter_framework_code,
|
| + });
|
| + await resolveTestUnit('''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/child: new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + _setCaretLocation();
|
| + await assertHasAssist(
|
| + DartAssistKind.CONVERT_FLUTTER_CHILD,
|
| + '''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/children: <Widget>[
|
| + new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + ],
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + }
|
| +
|
| + test_convertFlutterChild_OK_newlineChild() async {
|
| + // This case could occur with deeply nested constructors, common in Flutter.
|
| + _configureFlutterPkg({
|
| + 'src/widgets/framework.dart': _flutter_framework_code,
|
| + });
|
| + await resolveTestUnit('''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/child:
|
| + new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + _setCaretLocation();
|
| + await assertHasAssist(
|
| + DartAssistKind.CONVERT_FLUTTER_CHILD,
|
| + '''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/children: <Widget>[
|
| + new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + ],
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + }
|
| +
|
| + test_convertFlutterChild_OK_singleLine() async {
|
| + _configureFlutterPkg({
|
| + 'src/widgets/framework.dart': _flutter_framework_code,
|
| + });
|
| + await resolveTestUnit('''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/child: new GestureDetector(),
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + _setCaretLocation();
|
| + await assertHasAssist(
|
| + DartAssistKind.CONVERT_FLUTTER_CHILD,
|
| + '''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + /*caret*/children: <Widget>[new GestureDetector()],
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +''');
|
| + }
|
| +
|
| test_convertToBlockBody_BAD_noEnclosingFunction() async {
|
| await resolveTestUnit('''
|
| var v = 123;
|
| @@ -3502,6 +3625,104 @@ main() {
|
| ''');
|
| }
|
|
|
| + test_moveFlutterWidgetDown_OK() async {
|
| + _configureFlutterPkg({
|
| + 'src/widgets/framework.dart': _flutter_framework_code,
|
| + });
|
| + await resolveTestUnit('''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new /*caret*/GestureDetector(
|
| + onTap: () => startResize(),
|
| + child: new Center(
|
| + child: new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + key: null,
|
| + ),
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +startResize() {}
|
| +''');
|
| + _setCaretLocation();
|
| + await assertHasAssist(
|
| + DartAssistKind.MOVE_FLUTTER_WIDGET_DOWN,
|
| + '''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + child: new /*caret*/GestureDetector(
|
| + onTap: () => startResize(),
|
| + child: new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + ),
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +startResize() {}
|
| +''');
|
| + }
|
| +
|
| + test_moveFlutterWidgetUp_OK() async {
|
| + _configureFlutterPkg({
|
| + 'src/widgets/framework.dart': _flutter_framework_code,
|
| + });
|
| + await resolveTestUnit('''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new Center(
|
| + child: new /*caret*/GestureDetector(
|
| + onTap: () => startResize(),
|
| + child: new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + ),
|
| + key: null,
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +startResize() {}
|
| +''');
|
| + _setCaretLocation();
|
| + await assertHasAssist(
|
| + DartAssistKind.MOVE_FLUTTER_WIDGET_UP,
|
| + '''
|
| +import 'package:flutter/src/widgets/framework.dart';
|
| +build() {
|
| + return new Scaffold(
|
| +// start
|
| + body: new /*caret*/GestureDetector(
|
| + onTap: () => startResize(),
|
| + child: new Center(
|
| + child: new Container(
|
| + width: 200.0,
|
| + height: 300.0,
|
| + ),
|
| + key: null,
|
| + ),
|
| + ),
|
| +// end
|
| + );
|
| +}
|
| +startResize() {}
|
| +''');
|
| + }
|
| +
|
| test_removeTypeAnnotation_classField_OK() async {
|
| await resolveTestUnit('''
|
| class A {
|
| @@ -3666,104 +3887,6 @@ class FakeFlutter {
|
| await assertNoAssist(DartAssistKind.REPARENT_FLUTTER_LIST);
|
| }
|
|
|
| - test_moveFlutterWidgetDown_OK() async {
|
| - _configureFlutterPkg({
|
| - 'src/widgets/framework.dart': _flutter_framework_code,
|
| - });
|
| - await resolveTestUnit('''
|
| -import 'package:flutter/src/widgets/framework.dart';
|
| -build() {
|
| - return new Scaffold(
|
| -// start
|
| - body: new /*caret*/GestureDetector(
|
| - onTap: () => startResize(),
|
| - child: new Center(
|
| - child: new Container(
|
| - width: 200.0,
|
| - height: 300.0,
|
| - ),
|
| - key: null,
|
| - ),
|
| - ),
|
| -// end
|
| - );
|
| -}
|
| -startResize() {}
|
| -''');
|
| - _setCaretLocation();
|
| - await assertHasAssist(
|
| - DartAssistKind.MOVE_FLUTTER_WIDGET_DOWN,
|
| - '''
|
| -import 'package:flutter/src/widgets/framework.dart';
|
| -build() {
|
| - return new Scaffold(
|
| -// start
|
| - body: new Center(
|
| - child: new /*caret*/GestureDetector(
|
| - onTap: () => startResize(),
|
| - child: new Container(
|
| - width: 200.0,
|
| - height: 300.0,
|
| - ),
|
| - ),
|
| - key: null,
|
| - ),
|
| -// end
|
| - );
|
| -}
|
| -startResize() {}
|
| -''');
|
| - }
|
| -
|
| - test_moveFlutterWidgetUp_OK() async {
|
| - _configureFlutterPkg({
|
| - 'src/widgets/framework.dart': _flutter_framework_code,
|
| - });
|
| - await resolveTestUnit('''
|
| -import 'package:flutter/src/widgets/framework.dart';
|
| -build() {
|
| - return new Scaffold(
|
| -// start
|
| - body: new Center(
|
| - child: new /*caret*/GestureDetector(
|
| - onTap: () => startResize(),
|
| - child: new Container(
|
| - width: 200.0,
|
| - height: 300.0,
|
| - ),
|
| - ),
|
| - key: null,
|
| - ),
|
| -// end
|
| - );
|
| -}
|
| -startResize() {}
|
| -''');
|
| - _setCaretLocation();
|
| - await assertHasAssist(
|
| - DartAssistKind.MOVE_FLUTTER_WIDGET_UP,
|
| - '''
|
| -import 'package:flutter/src/widgets/framework.dart';
|
| -build() {
|
| - return new Scaffold(
|
| -// start
|
| - body: new /*caret*/GestureDetector(
|
| - onTap: () => startResize(),
|
| - child: new Center(
|
| - child: new Container(
|
| - width: 200.0,
|
| - height: 300.0,
|
| - ),
|
| - key: null,
|
| - ),
|
| - ),
|
| -// end
|
| - );
|
| -}
|
| -startResize() {}
|
| -''');
|
| - }
|
| -
|
| test_reparentFlutterList_OK_multiLine() async {
|
| _configureFlutterPkg({
|
| 'src/widgets/framework.dart': _flutter_framework_code,
|
|
|