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

Unified Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 2724473002: Add assists to move Flutter widgets up and down one level (Closed)
Patch Set: Add TODO per review comment Created 3 years, 10 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80a79399923bd100a464fc8866a8a6aeecb15649..b52c25d46d1f7a7d3eb1f39d103d442afbfffcff 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -54,9 +54,12 @@ class SingleChildRenderObjectWidget extends RenderObjectWidget {}
class Transform extends SingleChildRenderObjectWidget {}
class ClipRect extends SingleChildRenderObjectWidget { ClipRect.rect(){} }
class AspectRatio extends SingleChildRenderObjectWidget {}
-class Container extends StatelessWidget { Container({child: null}){}}
+class Container extends StatelessWidget { Container({child: null, width: null, height: null}){}}
+class Center extends StatelessWidget { Center({child: null, key: null}){}}
class DefaultTextStyle extends StatelessWidget { DefaultTextStyle({child: null}){}}
class Row extends Widget { Row({children: null}){}}
+class GestureDetector extends SingleChildRenderObjectWidget { GestureDetector({child: null, onTap: null}){}}
+class Scaffold extends Widget { Scaffold({body: null}){}}
''';
/**
@@ -3663,6 +3666,104 @@ 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,
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698