Fix context menu web examples (#120104)
The context menu examples on the docs site now work on the web.
This commit is contained in:
committed by
GitHub
parent
ec524ed068
commit
575ced6c5a
@@ -2,8 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_api_samples/material/context_menu/context_menu_controller.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -13,6 +15,8 @@ void main() {
|
||||
const example.MyApp(),
|
||||
);
|
||||
|
||||
expect(BrowserContextMenu.enabled, !kIsWeb);
|
||||
|
||||
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
|
||||
|
||||
// Right clicking the middle of the app shows the custom context menu.
|
||||
|
||||
@@ -3,16 +3,20 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_builder.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('showing and hiding the context menu in TextField with custom buttons', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
example.MyApp(),
|
||||
const example.MyApp(),
|
||||
);
|
||||
|
||||
expect(BrowserContextMenu.enabled, !kIsWeb);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -2,17 +2,21 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_builder.1.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('showing and hiding the custom context menu in TextField with a specific selection', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
example.MyApp(),
|
||||
const example.MyApp(),
|
||||
);
|
||||
|
||||
expect(BrowserContextMenu.enabled, !kIsWeb);
|
||||
|
||||
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
|
||||
|
||||
// Right clicking the Text in the TextField shows the custom context menu,
|
||||
|
||||
@@ -5,15 +5,18 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_builder.2.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('showing and hiding the context menu in TextField with a custom toolbar', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
example.MyApp(),
|
||||
const example.MyApp(),
|
||||
);
|
||||
|
||||
expect(BrowserContextMenu.enabled, !kIsWeb);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_api_samples/material/context_menu/selectable_region_toolbar_builder.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -13,6 +15,8 @@ void main() {
|
||||
const example.MyApp(),
|
||||
);
|
||||
|
||||
expect(BrowserContextMenu.enabled, !kIsWeb);
|
||||
|
||||
// Allow the selection overlay geometry to be created.
|
||||
await tester.pump();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user