appflowy-editor/test/render/action_menu/action_menu_item_test.dart
Ali Hassan 865195f8c6
feat : allow developer to change toolbar color as well as option to show default toolbar items and html to document converter added (#58)
* change toolbar and added export so developer can modify according to its need

* revert some chages from examples

* html to document convertion added

* test added

* code formated

* node to html added image parameter

* toolbar color and elevation added in editor stylee

* code formated

* remove duplicated exports

* fix test improts and formating
2023-04-14 10:10:03 +08:00

46 lines
1.3 KiB
Dart

import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../test_helper.dart';
void main() {
group('ActionMenuItem tests', () {
testWidgets('ActionMenuItem.icon()', (tester) async {
int count = 0;
final item = ActionMenuItem.icon(
iconData: Icons.abc,
onPressed: () => count++,
);
await tester.buildAndPump(item.iconBuilder());
await tester.pumpAndSettle();
item.onPressed!.call();
expect(count, 1);
expect(find.byType(Icon), findsOneWidget);
});
testWidgets('ActionMenuItem.svg()', (tester) async {
final item = ActionMenuItem.svg(name: 'check', onPressed: () {});
await tester.buildAndPump(item.iconBuilder());
await tester.pumpAndSettle();
expect(find.byType(FlowySvg), findsOneWidget);
});
testWidgets('ActionMenuItem.separator()', (tester) async {
final item = ActionMenuItem.separator();
await tester.buildAndPump(item.iconBuilder());
await tester.pumpAndSettle();
expect(find.byType(FlowySvg), findsOneWidget);
final svg = tester.widget<FlowySvg>(find.byType(FlowySvg));
expect(svg.name, 'image_toolbar/divider');
});
});
}