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
dcb47f62
Unverified
Commit
dcb47f62
authored
May 09, 2018
by
Michael Goderbauer
Committed by
GitHub
May 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A11y fixes and tests for PopUpMenu (#17446)
parent
5d8d14b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
13 deletions
+58
-13
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+4
-6
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+54
-7
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
dcb47f62
...
...
@@ -262,12 +262,10 @@ class PopupMenuItemState<T, W extends PopupMenuItem<T>> extends State<W> {
return
new
InkWell
(
onTap:
widget
.
enabled
?
handleTap
:
null
,
child:
new
MergeSemantics
(
child:
new
Container
(
height:
widget
.
height
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
_kMenuHorizontalPadding
),
child:
item
,
),
child:
new
Container
(
height:
widget
.
height
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
_kMenuHorizontalPadding
),
child:
item
,
),
);
}
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
dcb47f62
...
...
@@ -430,15 +430,18 @@ void main() {
expect
(
MediaQuery
.
of
(
popupContext
).
padding
,
EdgeInsets
.
zero
);
});
testWidgets
(
'
PopupMenu includes route
semantics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
open PopupMenu has correct
semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
Material
(
child:
new
PopupMenuButton
<
int
>(
itemBuilder:
(
BuildContext
context
)
{
return
<
PopupMenuItem
<
int
>>[
const
PopupMenuItem
<
int
>(
value:
1
,
child:
const
Text
(
'1'
)),
const
PopupMenuItem
<
int
>(
value:
2
,
child:
const
Text
(
'2'
)),
const
PopupMenuItem
<
int
>(
value:
3
,
child:
const
Text
(
'3'
)),
const
PopupMenuItem
<
int
>(
value:
4
,
child:
const
Text
(
'4'
)),
const
PopupMenuItem
<
int
>(
value:
5
,
child:
const
Text
(
'5'
)),
];
},
child:
const
SizedBox
(
...
...
@@ -452,12 +455,56 @@ void main() {
await
tester
.
tap
(
find
.
text
(
'XXX'
));
await
tester
.
pumpAndSettle
();
expect
(
semantics
,
includesNodeWith
(
label:
'Popup menu'
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
,
SemanticsFlag
.
scopesRoute
,
],
expect
(
semantics
,
hasSemantics
(
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
new
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
,
SemanticsFlag
.
namesRoute
,
],
label:
'Popup menu'
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
new
TestSemantics
(
children:
<
TestSemantics
>[
new
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'1'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'2'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'3'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'4'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'5'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
],
),
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
,
));
semantics
.
dispose
();
...
...
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