Skip to content

Commit

Permalink
Test - Show magnifier on long tap with collapsed selection (mobile)
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Jan 1, 2024
1 parent 54ddf5d commit e118399
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions packages/fleather/test/widgets/editor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void main() {
});

group('Text selection', () {
testWidgets('Hides toolbar and selection handles when text changed',
testWidgets('hides toolbar and selection handles when text changed',
(tester) async {
const delta = TextEditingDeltaInsertion(
oldText: 'Add ',
Expand Down Expand Up @@ -441,7 +441,32 @@ void main() {
const TypeMatcher<MaterialTextSelectionControls>());
}, [TargetPlatform.android]);

testWidgets('drag selection end handle shows magnifier', (tester) async {
testWidgets('dragging collapsed selection shows magnifier',
(tester) async {
final document = ParchmentDocument.fromJson([
{'insert': 'Some piece of text\n'}
]);
final editor =
EditorSandBox(tester: tester, document: document, autofocus: true);
await editor.pump();
final gesture = await tester.startGesture(
tester.getBottomLeft(find.byType(FleatherEditor)) +
const Offset(10, -1));
await gesture.moveBy(
tester.getBottomLeft(find.byType(FleatherEditor)) +
const Offset(40, 0),
timeStamp: const Duration(seconds: 1));
tester.binding.scheduleWarmUpFrame();
await tester.pump();
final magnifier = find.byType(TextMagnifier);
expect(magnifier, findsOneWidget);
await gesture.up();
await tester.pump();
expect(magnifier, findsNothing);
});

testWidgets('dragging selection end handle shows magnifier',
(tester) async {
final document = ParchmentDocument.fromJson([
{'insert': 'Some piece of text\n'}
]);
Expand Down

0 comments on commit e118399

Please sign in to comment.