mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test: add node extension test
This commit is contained in:
parent
c0aa90b0b3
commit
4acce447f2
@ -0,0 +1,31 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:appflowy_editor/src/extensions/node_extensions.dart';
|
||||||
|
|
||||||
|
class MockNode extends Mock implements Node {}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
group('NodeExtensions::', () {
|
||||||
|
final mockNode = MockNode();
|
||||||
|
|
||||||
|
final selection = Selection(
|
||||||
|
start: Position(path: [0, 1]),
|
||||||
|
end: Position(path: [1, 0]),
|
||||||
|
);
|
||||||
|
|
||||||
|
test('rect - renderBox is null', () {
|
||||||
|
when(mockNode.renderBox).thenReturn(null);
|
||||||
|
final result = mockNode.rect;
|
||||||
|
expect(result, Rect.zero);
|
||||||
|
});
|
||||||
|
|
||||||
|
// test('inSelection', () {
|
||||||
|
// when(mockNode.path).thenAnswer((_) => [3, 3]);
|
||||||
|
// final result = mockNode.inSelection(selection);
|
||||||
|
// expect(result, true);
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user