forked from AppFlowy-IO/appflowy-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check if header exists for footer (AppFlowy-IO#559)
* fix: check if header exists for footer * test: add tests and refactor if statement --------- Co-authored-by: Mathias Mogensen <mathiasrieckm@gmail.com>
- Loading branch information
1 parent
9b8d855
commit 4b1a3d5
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
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); | ||
}); | ||
}); | ||
} |