Skip to content

Instantly share code, notes, and snippets.

@wearhere
Created August 12, 2014 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wearhere/92b8d15983a8699ca665 to your computer and use it in GitHub Desktop.
Save wearhere/92b8d15983a8699ca665 to your computer and use it in GitHub Desktop.
Attempting to match a table view cell detail disclosure button using Subliminal. Patch on https://github.com/inkling/Subliminal/commit/29c7c9692d8df1f5e79196a02b5bebe027a150fb. Test passes.
diff --git a/Integration Tests/Tests/SLElementMatchingTest.m b/Integration Tests/Tests/SLElementMatchingTest.m
index 3c61e55..7bf2412 100644
--- a/Integration Tests/Tests/SLElementMatchingTest.m
+++ b/Integration Tests/Tests/SLElementMatchingTest.m
@@ -284,6 +284,17 @@
SLAssertTrue([rightLabel isValid], @"Could not match UITableView header child element.");
}
+- (void)focus_testMatchingTableViewCellDetailDisclosureButton {
+ // Detail disclosure buttons take their accessibility labels from those of
+ // their cells, prefixed with "More info, "
+ NSString *buttonLabel = @"More info, fooLabel";
+ SLElement *button = [SLElement elementWithAccessibilityLabel:buttonLabel];
+ SLAssertTrue([[UIAElement(button) label] isEqualToString:buttonLabel],
+ @"Could not match UITableViewCell detail disclosure button.");
+
+ SLAssertTrue([button isValidAndVisible], @"The button should be visible.");
+}
+
#pragma mark - Collection views
- (void)testMatchingCollectionViewCellChildElement {
diff --git a/Integration Tests/Tests/SLElementMatchingTestViewController.m b/Integration Tests/Tests/SLElementMatchingTestViewController.m
index 21ef08e..e463dda 100644
--- a/Integration Tests/Tests/SLElementMatchingTestViewController.m
+++ b/Integration Tests/Tests/SLElementMatchingTestViewController.m
@@ -268,6 +268,7 @@
(testCase == @selector(testMatchingNonLabelTableViewCellChildElement)) ||
(testCase == @selector(testMatchingTableViewHeader)) ||
(testCase == @selector(testMatchingTableViewHeaderChildElements)) ||
+ (testCase == @selector(testMatchingTableViewCellDetailDisclosureButton)) ||
(testCase == @selector(testSubliminalReloadsTheAccessibilityHierarchyAsNecessaryWhenMatching))) {
return @"SLTableViewChildElementMatchingTestViewController";
} else {
@@ -363,6 +364,7 @@
if ((self.testCase == @selector(testMatchingTableViewCellTextLabel)) ||
(self.testCase == @selector(testMatchingTableViewHeader)) ||
(self.testCase == @selector(testMatchingTableViewHeaderChildElements)) ||
+ (self.testCase == @selector(testMatchingTableViewCellDetailDisclosureButton)) ||
(self.testCase == @selector(testSubliminalReloadsTheAccessibilityHierarchyAsNecessaryWhenMatching))) {
_testTableViewCellClass = [UITableViewCell class];
} else if ((self.testCase == @selector(testMatchingNonLabelTableViewCellChildElement)) ||
@@ -406,8 +408,13 @@
if ((self.testCase == @selector(testMatchingTableViewCellTextLabel)) ||
(self.testCase == @selector(testMatchingTableViewHeader)) ||
(self.testCase == @selector(testMatchingTableViewHeaderChildElements)) ||
+ (self.testCase == @selector(testMatchingTableViewCellDetailDisclosureButton)) ||
(self.testCase == @selector(testSubliminalReloadsTheAccessibilityHierarchyAsNecessaryWhenMatching))) {
cell.textLabel.text = @"fooLabel";
+
+ if (self.testCase == @selector(testMatchingTableViewCellDetailDisclosureButton)) {
+ cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
+ }
} else {
NSAssert([cell isKindOfClass:[SLElementMatchingTestTableViewCell class]],
@"Unexpected table view cell class for test case: %@.", NSStringFromSelector(self.testCase));
@wearhere
Copy link
Author

General information about running the tests is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment