Skip to content

Commit e8889d8

Browse files
[material_ui] Remove !chrome in text_field_test.dart (flutter#12548)
Part of flutter#92134 It seems the issue is already closed and fixed, so I'm attempting to remove this TODO ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 7a7912f commit e8889d8

1 file changed

Lines changed: 67 additions & 63 deletions

File tree

‎packages/material_ui/test/text_field_test.dart‎

Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
// https://github.com/flutter/flutter/issues/122950
1212
// Fails with "flutter test --test-randomize-ordering-seed=20230318"
1313
@Tags(<String>['reduced-test-set', 'no-shuffle'])
14-
// TODO(188666): Fix web test failures and re-enable. See also:
15-
// https://github.com/flutter/flutter/issues/71604.
16-
@TestOn('!chrome')
1714
library;
1815

1916
import 'dart:async';
@@ -2134,6 +2131,8 @@ void main() {
21342131
TargetPlatform.linux,
21352132
TargetPlatform.windows,
21362133
}),
2134+
skip:
2135+
isContextMenuProvidedByPlatform, // [intended] only applies to platforms where we supply the context menu.
21372136
);
21382137

21392138
testWidgets('Swapping controllers should update selection', (WidgetTester tester) async {
@@ -3401,75 +3400,78 @@ void main() {
34013400
),
34023401
);
34033402

3404-
testWidgets('assertion error is not thrown when attempting to drag both selection handles', (
3405-
WidgetTester tester,
3406-
) async {
3407-
// Regression test for https://github.com/flutter/flutter/issues/168578.
3408-
final controller = TextEditingController(text: 'abc def ghi');
3409-
addTearDown(controller.dispose);
3403+
testWidgets(
3404+
'assertion error is not thrown when attempting to drag both selection handles',
3405+
(WidgetTester tester) async {
3406+
// Regression test for https://github.com/flutter/flutter/issues/168578.
3407+
final controller = TextEditingController(text: 'abc def ghi');
3408+
addTearDown(controller.dispose);
34103409

3411-
await tester.pumpWidget(
3412-
overlay(
3413-
child: Center(
3414-
child: TextField(
3415-
dragStartBehavior: DragStartBehavior.down,
3416-
controller: controller,
3417-
style: const TextStyle(fontSize: 10.0),
3410+
await tester.pumpWidget(
3411+
overlay(
3412+
child: Center(
3413+
child: TextField(
3414+
dragStartBehavior: DragStartBehavior.down,
3415+
controller: controller,
3416+
style: const TextStyle(fontSize: 10.0),
3417+
),
34183418
),
34193419
),
3420-
),
3421-
);
3420+
);
34223421

3423-
// Double tap on 'e' to select 'def'.
3424-
final Offset ePos = textOffsetToPosition(tester, 5);
3425-
await tester.tapAt(ePos, pointer: 7);
3426-
await tester.pump(const Duration(milliseconds: 50));
3427-
expect(controller.selection.isCollapsed, isTrue);
3428-
expect(controller.selection.baseOffset, 5);
3429-
await tester.tapAt(ePos, pointer: 7);
3430-
await tester.pumpAndSettle();
3431-
expect(controller.selection.baseOffset, 4);
3432-
expect(controller.selection.extentOffset, 7);
3422+
// Double tap on 'e' to select 'def'.
3423+
final Offset ePos = textOffsetToPosition(tester, 5);
3424+
await tester.tapAt(ePos, pointer: 7);
3425+
await tester.pump(const Duration(milliseconds: 50));
3426+
expect(controller.selection.isCollapsed, isTrue);
3427+
expect(controller.selection.baseOffset, 5);
3428+
await tester.tapAt(ePos, pointer: 7);
3429+
await tester.pumpAndSettle();
3430+
expect(controller.selection.baseOffset, 4);
3431+
expect(controller.selection.extentOffset, 7);
34333432

3434-
final RenderEditable renderEditable = findRenderEditable(tester);
3435-
final List<TextSelectionPoint> endpoints = globalize(
3436-
renderEditable.getEndpointsForSelection(controller.selection),
3437-
renderEditable,
3438-
);
3439-
expect(endpoints.length, 2);
3433+
final RenderEditable renderEditable = findRenderEditable(tester);
3434+
final List<TextSelectionPoint> endpoints = globalize(
3435+
renderEditable.getEndpointsForSelection(controller.selection),
3436+
renderEditable,
3437+
);
3438+
expect(endpoints.length, 2);
34403439

3441-
// Drag the end handle to 'g'.
3442-
final Offset endHandlePos = endpoints[1].point + const Offset(1.0, 1.0);
3443-
Offset newHandlePos = textOffsetToPosition(tester, 9); // Position of 'g'.
3444-
final TestGesture endHandleGesture = await tester.startGesture(endHandlePos, pointer: 7);
3445-
await tester.pump();
3446-
await endHandleGesture.moveTo(newHandlePos);
3447-
await tester.pump();
3448-
expect(controller.selection.baseOffset, 4);
3449-
expect(controller.selection.extentOffset, 9);
3440+
// Drag the end handle to 'g'.
3441+
final Offset endHandlePos = endpoints[1].point + const Offset(1.0, 1.0);
3442+
Offset newHandlePos = textOffsetToPosition(tester, 9); // Position of 'g'.
3443+
final TestGesture endHandleGesture = await tester.startGesture(endHandlePos, pointer: 7);
3444+
await tester.pump();
3445+
await endHandleGesture.moveTo(newHandlePos);
3446+
await tester.pump();
3447+
expect(controller.selection.baseOffset, 4);
3448+
expect(controller.selection.extentOffset, 9);
34503449

3451-
// Attempt to drag the start handle to the start of the text.
3452-
final Offset startHandlePos = endpoints[0].point + const Offset(1.0, 1.0);
3453-
newHandlePos = textOffsetToPosition(tester, 0);
3454-
final TestGesture startHandleGesture = await tester.startGesture(startHandlePos, pointer: 8);
3455-
await tester.pump();
3456-
await startHandleGesture.moveTo(newHandlePos);
3457-
await tester.pump();
3458-
await startHandleGesture.up();
3459-
await tester.pump();
3450+
// Attempt to drag the start handle to the start of the text.
3451+
final Offset startHandlePos = endpoints[0].point + const Offset(1.0, 1.0);
3452+
newHandlePos = textOffsetToPosition(tester, 0);
3453+
final TestGesture startHandleGesture = await tester.startGesture(startHandlePos, pointer: 8);
3454+
await tester.pump();
3455+
await startHandleGesture.moveTo(newHandlePos);
3456+
await tester.pump();
3457+
await startHandleGesture.up();
3458+
await tester.pump();
34603459

3461-
// Drag the end handle to the end of the text after releasing the start handle.
3462-
newHandlePos = textOffsetToPosition(tester, 11); // Position of 'i'.
3463-
await tester.pump();
3464-
await endHandleGesture.moveTo(newHandlePos);
3465-
await tester.pump();
3466-
await endHandleGesture.up();
3467-
await tester.pump();
3460+
// Drag the end handle to the end of the text after releasing the start handle.
3461+
newHandlePos = textOffsetToPosition(tester, 11); // Position of 'i'.
3462+
await tester.pump();
3463+
await endHandleGesture.moveTo(newHandlePos);
3464+
await tester.pump();
3465+
await endHandleGesture.up();
3466+
await tester.pump();
34683467

3469-
expect(tester.takeException(), isNull);
3470-
expect(controller.selection.baseOffset, 0);
3471-
expect(controller.selection.extentOffset, 11);
3472-
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
3468+
expect(tester.takeException(), isNull);
3469+
expect(controller.selection.baseOffset, 0);
3470+
expect(controller.selection.extentOffset, 11);
3471+
},
3472+
variant: TargetPlatformVariant.only(TargetPlatform.android),
3473+
skip: kIsWeb, // [intended] on web only one selection handle can be dragged at a time.
3474+
);
34733475

34743476
testWidgets('Can only drag one selection handle at a time on iOS', (WidgetTester tester) async {
34753477
final controller = TextEditingController(text: 'abc def ghi');
@@ -12738,6 +12740,8 @@ void main() {
1273812740
variant: TargetPlatformVariant.all(
1273912741
excluding: <TargetPlatform>{TargetPlatform.iOS, TargetPlatform.macOS},
1274012742
),
12743+
skip:
12744+
isContextMenuProvidedByPlatform, // [intended] only applies to platforms where we supply the context menu.
1274112745
);
1274212746

1274312747
testWidgets(

0 commit comments

Comments
 (0)