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
4b6cc473
Unverified
Commit
4b6cc473
authored
Aug 14, 2018
by
Jonah Williams
Committed by
GitHub
Aug 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add label to drawer and regression test cases (#20537)
parent
7bdd31f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+5
-2
drawer_test.dart
packages/flutter/test/material/drawer_test.dart
+54
-0
No files found.
packages/flutter/lib/src/material/drawer.dart
View file @
4b6cc473
...
@@ -401,8 +401,11 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -401,8 +401,11 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
// On Android, the back button is used to dismiss a modal.
// On Android, the back button is used to dismiss a modal.
excludeFromSemantics:
defaultTargetPlatform
==
TargetPlatform
.
android
,
excludeFromSemantics:
defaultTargetPlatform
==
TargetPlatform
.
android
,
onTap:
close
,
onTap:
close
,
child:
new
Semantics
(
label:
MaterialLocalizations
.
of
(
context
)?.
modalBarrierDismissLabel
,
child:
new
Container
(
child:
new
Container
(
color:
_color
.
evaluate
(
_controller
)
color:
_color
.
evaluate
(
_controller
),
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/drawer_test.dart
View file @
4b6cc473
...
@@ -2,9 +2,13 @@
...
@@ -2,9 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Drawer control test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Drawer control test'
,
(
WidgetTester
tester
)
async
{
const
Key
containerKey
=
Key
(
'container'
);
const
Key
containerKey
=
Key
(
'container'
);
...
@@ -52,4 +56,54 @@ void main() {
...
@@ -52,4 +56,54 @@ void main() {
expect
(
find
.
text
(
'header'
),
findsOneWidget
);
expect
(
find
.
text
(
'header'
),
findsOneWidget
);
});
});
testWidgets
(
'Drawer dismiss barrier has label on iOS'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
const
Scaffold
(
drawer:
Drawer
()
),
),
);
final
ScaffoldState
state
=
tester
.
firstState
(
find
.
byType
(
Scaffold
));
state
.
openDrawer
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
semantics
,
includesNodeWith
(
label:
const
DefaultMaterialLocalizations
().
modalBarrierDismissLabel
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
));
semantics
.
dispose
();
debugDefaultTargetPlatformOverride
=
null
;
});
testWidgets
(
'Drawer dismiss barrier has no label on Android'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
const
Scaffold
(
drawer:
Drawer
()
),
),
);
final
ScaffoldState
state
=
tester
.
firstState
(
find
.
byType
(
Scaffold
));
state
.
openDrawer
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
const
DefaultMaterialLocalizations
().
modalBarrierDismissLabel
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
)));
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