Commit 65940718 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] fix badgetextview EGTest

The TextBadgeView need to be explicitly accessible. In addition,
it is better to use an identifier instead of label to validate.

Bug: 1100811
Change-Id: I5e4a58d177d62a0f69fb85d84d16bad60f444cc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283900
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787463}
parent 7c71626b
......@@ -63,6 +63,7 @@ const CGFloat kDefaultLabelHorizontalMargin = 8.5f;
[self activateConstraints];
[self setBackgroundColor:[UIColor colorNamed:kBlueHaloColor]];
[self setAccessibilityLabel:self.label.text];
self.isAccessibilityElement = YES;
}
[super willMoveToSuperview:newSuperview];
}
......
......@@ -16,6 +16,7 @@
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
TextBadgeView* textBadge = [[TextBadgeView alloc] initWithText:@"TEXT"];
textBadge.accessibilityIdentifier = @"TEXT";
[textBadge setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:textBadge];
// Center badge on screen.
......
......@@ -23,7 +23,7 @@ using ::showcase_utils::Close;
// Tests that the accessibility label matches the display text.
- (void)testTextBadgeAccessibilityLabel {
Open(@"TextBadgeView");
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"TEXT")]
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TEXT")]
assertWithMatcher:grey_notNil()];
Close();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment