Reland "Update PopupMenuButton to match Material Design spec" (#74620)
This commit is contained in:
@@ -409,8 +409,14 @@ void main() {
|
||||
});
|
||||
|
||||
test('Popup Menu has correct Android semantics', () async {
|
||||
final SerializableFinder button = find.descendant(
|
||||
of: find.byValueKey(popupButtonKeyValue),
|
||||
matching: find.byType('Semantics'),
|
||||
firstMatchOnly: true,
|
||||
);
|
||||
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(popupButtonKeyValue)),
|
||||
await getSemantics(button),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
@@ -432,20 +438,21 @@ void main() {
|
||||
|
||||
for (final String item in popupItems) {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
if (item == popupItems.first) AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
if (item != popupItems.first) AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Popup $item doesn't have the right semantics");
|
||||
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
if (item == popupItems.first) AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
if (item != popupItems.first) AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Popup $item doesn't have the right semantics",
|
||||
);
|
||||
}
|
||||
await driver.tap(find.byValueKey('$popupKeyValue.${popupItems.first}'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user