appflowy-editor/test/editor/editor_test.dart
Mayur Mahajan 4b1a3d5307
fix: check if header exists for footer (#559)
* fix: check if header exists for footer

* test: add tests and refactor if statement

---------

Co-authored-by: Mathias Mogensen <mathiasrieckm@gmail.com>
2023-11-02 14:11:37 +01:00

60 lines
1.6 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("AppFlowyEditor tests", () {
testWidgets('can render', (tester) async {
await tester.buildAndPump(
AppFlowyEditor(
editorState: EditorState.blank(),
),
);
await tester.pumpAndSettle();
expect(find.byType(AppFlowyEditor), findsOneWidget);
});
testWidgets('can render with footer', (tester) async {
await tester.buildAndPump(
AppFlowyEditor(
editorState: EditorState(
document: Document(root: pageNode(children: [])),
),
footer: const Icon(Icons.abc),
),
);
await tester.pumpAndSettle();
expect(find.byIcon(Icons.abc), findsOneWidget);
});
testWidgets('can render with header', (tester) async {
await tester.buildAndPump(
AppFlowyEditor(
editorState: EditorState.blank(),
header: const Icon(Icons.abc),
),
);
await tester.pumpAndSettle();
expect(find.byIcon(Icons.abc), findsOneWidget);
});
testWidgets('can render with header and footer', (tester) async {
await tester.buildAndPump(
AppFlowyEditor(
editorState: EditorState.blank(),
header: const Icon(Icons.abc),
footer: const Icon(Icons.abc_outlined),
),
);
await tester.pumpAndSettle();
expect(find.byIcon(Icons.abc), findsOneWidget);
expect(find.byIcon(Icons.abc_outlined), findsOneWidget);
});
});
}