mirror of
https://github.com/foss42/apidash.git
synced 2025-05-31 06:08:09 +08:00
Merge pull request #477 from ClementBeal/feat-open-menu-with-right-click
feat: open ItemCardMenu with a right click
This commit is contained in:
@ -13,6 +13,7 @@ import 'package:apidash/screens/settings_page.dart';
|
||||
import 'package:apidash/screens/history/history_page.dart';
|
||||
import 'package:apidash/widgets/widgets.dart';
|
||||
import 'package:extended_text_field/extended_text_field.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_portal/flutter_portal.dart';
|
||||
@ -279,7 +280,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'selectedIdEditStateProvider should not be null after rename button has been tapped',
|
||||
'selectedIdEditStateProvider should not be null after Duplicate button has been tapped',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
@ -304,7 +305,11 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.tap(find.byType(RequestItem));
|
||||
await tester.pump();
|
||||
await tester.tap(find.byIcon(Icons.more_vert).at(1));
|
||||
//await tester.tap(find.byIcon(Icons.more_vert).at(1));
|
||||
await tester.tap(
|
||||
find.byType(RequestItem),
|
||||
buttons: kSecondaryButton,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Tap on the "Duplicate" option in the menu
|
||||
|
@ -49,4 +49,32 @@ void main() {
|
||||
|
||||
expect(changedValue, ItemMenuOption.duplicate);
|
||||
});
|
||||
|
||||
testWidgets('showItemCardMenu shows the menu at the right position',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTapUp: (details) {
|
||||
showItemCardMenu(
|
||||
context, details, (ItemMenuOption option) {});
|
||||
},
|
||||
child: const Text('Show Menu'),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Menu'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
for (var option in ItemMenuOption.values) {
|
||||
expect(find.text(option.label), findsOneWidget);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user