Unverified Commit 8e704219 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "Add RichText support to find.text" (#22046)

parent 02e87334
......@@ -498,22 +498,6 @@ class _TextFinder extends MatchFinder {
} else if (candidate.widget is EditableText) {
final EditableText editable = candidate.widget;
return editable.controller.text == text;
} else if (candidate.widget is RichText) {
bool parentIsText = false;
// check if the direct parent is a Text widget. if so, do not match it
// twice. We make an exception for semantics since those may be placed
// between a Text and Rich text.
candidate.visitAncestorElements((Element parent) {
if (parent.widget is Text) {
parentIsText = true;
return false;
} else if (parent.widget is ExcludeSemantics || parent.widget is Semantics) {
return true;
}
return false;
});
final RichText richText = candidate.widget;
return !parentIsText && richText.text.toPlainText() == text;
}
return false;
}
......
......@@ -27,33 +27,6 @@ void main() {
expect(find.text('test'), findsOneWidget);
});
testWidgets('finds RichText widgets', (WidgetTester tester) async {
await tester.pumpWidget(_boilerplate(
const RichText(text: TextSpan(text: 't', children: <TextSpan>[
TextSpan(text: 'est'),
]))
));
expect(find.text('test'), findsOneWidget);
});
testWidgets('Does not find Text and RichText widgets', (WidgetTester tester) async {
await tester.pumpWidget(_boilerplate(
const Text('test'),
));
expect(find.text('test'), findsOneWidget);
});
testWidgets('Does not find Text and RichText separated by semantics widgets', (WidgetTester tester) async {
// If rich: true found both Text and RichText, this would find two widgets.
await tester.pumpWidget(_boilerplate(
const Text('test', semanticsLabel: 'foo'),
));
expect(find.text('test'), findsOneWidget);
});
});
group('hitTestable', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment