Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8359d99e
Unverified
Commit
8359d99e
authored
Jul 13, 2018
by
Jonah Williams
Committed by
GitHub
Jul 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
have text finder convert Text.rich to plain text for comparison (#19270)
parent
698bda6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
finders.dart
packages/flutter_test/lib/src/finders.dart
+3
-1
finders_test.dart
packages/flutter_test/test/finders_test.dart
+22
-0
No files found.
packages/flutter_test/lib/src/finders.dart
View file @
8359d99e
...
...
@@ -476,7 +476,9 @@ class _TextFinder extends MatchFinder {
bool
matches
(
Element
candidate
)
{
if
(
candidate
.
widget
is
Text
)
{
final
Text
textWidget
=
candidate
.
widget
;
return
textWidget
.
data
==
text
;
if
(
textWidget
.
data
!=
null
)
return
textWidget
.
data
==
text
;
return
textWidget
.
textSpan
.
toPlainText
()
==
text
;
}
else
if
(
candidate
.
widget
is
EditableText
)
{
final
EditableText
editable
=
candidate
.
widget
;
return
editable
.
controller
.
text
==
text
;
...
...
packages/flutter_test/test/finders_test.dart
View file @
8359d99e
...
...
@@ -7,6 +7,28 @@ import 'package:flutter/widgets.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
group
(
'text'
,
()
{
testWidgets
(
'finds Text widgets'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_boilerplate
(
const
Text
(
'test'
),
));
expect
(
find
.
text
(
'test'
),
findsOneWidget
);
});
testWidgets
(
'finds Text.rich widgets'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_boilerplate
(
const
Text
.
rich
(
TextSpan
(
text:
't'
,
children:
<
TextSpan
>[
const
TextSpan
(
text:
'e'
),
const
TextSpan
(
text:
'st'
),
]
),
)));
expect
(
find
.
text
(
'test'
),
findsOneWidget
);
});
});
group
(
'hitTestable'
,
()
{
testWidgets
(
'excludes non-hit-testable widgets'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment