Skip to content

Commit e03aa66

Browse files
[SuperEditor] Make iOS overlay controls test use iOS selection heuristics (Resolves #2470) (#2553)
1 parent 1604d4b commit e03aa66

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

super_editor/test/super_editor/mobile/super_editor_ios_overlay_controls_test.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ void main() {
2626
testWidgetsOnIos("shows toolbar when tapping on caret", (tester) async {
2727
await _pumpSingleParagraphApp(tester);
2828

29-
// Place the caret.
30-
await tester.tapInParagraph("1", 200);
29+
// Place the caret at the end of a word, because iOS snaps the caret
30+
// to word boundaries by default.
31+
await tester.tapInParagraph("1", 207);
3132

3233
// Ensure all controls are hidden.
3334
expect(SuperEditorInspector.isMobileMagnifierVisible(), isFalse);
3435
expect(SuperEditorInspector.isMobileToolbarVisible(), isFalse);
3536

3637
// Tap again on the caret.
37-
await tester.tapInParagraph("1", 200);
38+
await tester.tapInParagraph("1", 207);
3839

3940
// Ensure that the toolbar is visible.
4041
expect(SuperEditorInspector.isMobileToolbarVisible(), isTrue);
@@ -218,7 +219,7 @@ void main() {
218219
});
219220

220221
testWidgetsOnIos("keeps current selection when tapping on caret", (tester) async {
221-
await _pumpSingleParagraphApp(tester, useIosSelectionHeuristics: true);
222+
await _pumpSingleParagraphApp(tester);
222223

223224
// Tap at "consectetur|" to place the caret.
224225
await tester.tapInParagraph("1", 39);
@@ -373,15 +374,12 @@ void main() {
373374
});
374375
}
375376

376-
Future<void> _pumpSingleParagraphApp(
377-
WidgetTester tester, {
378-
bool useIosSelectionHeuristics = false,
379-
}) async {
377+
Future<void> _pumpSingleParagraphApp(WidgetTester tester) async {
380378
await tester
381379
.createDocument()
382380
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor...
383381
.withSingleParagraph()
384382
.simulateSoftwareKeyboardInsets(true)
385-
.useIosSelectionHeuristics(useIosSelectionHeuristics)
383+
.useIosSelectionHeuristics(true)
386384
.pump();
387385
}

0 commit comments

Comments
 (0)