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
8098b5e6
Unverified
Commit
8098b5e6
authored
Jan 22, 2019
by
xster
Committed by
GitHub
Jan 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fill editable_text.dart test coverage (#26793)
parent
33cd720d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
2 deletions
+50
-2
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+50
-2
No files found.
packages/flutter/test/widgets/editable_text_test.dart
View file @
8098b5e6
...
...
@@ -1980,7 +1980,7 @@ testWidgets(
expect
(
called
,
2
);
});
testWidgets
(
'default keyboardAppearance is res
ep
cted'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'default keyboardAppearance is res
pe
cted'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/22212.
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
...
...
@@ -2008,7 +2008,7 @@ testWidgets(
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.light'
);
});
testWidgets
(
'custom keyboardAppearance is res
ep
cted'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'custom keyboardAppearance is res
pe
cted'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/22212.
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
...
...
@@ -2036,6 +2036,54 @@ testWidgets(
expect
(
setClient
.
method
,
'TextInput.setClient'
);
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.dark'
);
});
testWidgets
(
'Composing text is underlined and underline is cleared when losing focus'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
.
fromValue
(
const
TextEditingValue
(
text:
'text composing text'
,
selection:
TextSelection
.
collapsed
(
offset:
14
),
composing:
TextRange
(
start:
5
,
end:
14
),
),
);
final
GlobalKey
<
EditableTextState
>
editableTextKey
=
GlobalKey
<
EditableTextState
>();
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
MaterialApp
(
// So we can show overlays.
home:
EditableText
(
autofocus:
true
,
backgroundCursorColor:
Colors
.
grey
,
key:
editableTextKey
,
controller:
controller
,
focusNode:
focusNode
,
style:
textStyle
,
cursorColor:
cursorColor
,
selectionControls:
materialTextSelectionControls
,
keyboardType:
TextInputType
.
text
,
onEditingComplete:
()
{
// This prevents the default focus change behavior on submission.
},
),
));
assert
(
focusNode
.
hasFocus
);
final
RenderEditable
renderEditable
=
findRenderEditable
(
tester
);
// The actual text span is split into 3 parts with the middle part underlined.
expect
(
renderEditable
.
text
.
children
.
length
,
3
);
expect
(
renderEditable
.
text
.
children
[
1
].
text
,
'composing'
);
expect
(
renderEditable
.
text
.
children
[
1
].
style
.
decoration
,
TextDecoration
.
underline
);
focusNode
.
unfocus
();
await
tester
.
pump
();
expect
(
renderEditable
.
text
.
children
,
isNull
);
// Everything's just formated the same way now.
expect
(
renderEditable
.
text
.
text
,
'text composing text'
);
expect
(
renderEditable
.
text
.
style
.
decoration
,
isNull
);
});
}
class
MockTextSelectionControls
extends
Mock
implements
TextSelectionControls
{}
...
...
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