Permalink
Browse files

should be isDescendantOfFirstResponder, not isAncestorOfFirstResponder

  • Loading branch information...
1 parent cf6dcc9 commit 15bcce19884d00d685eb9b3d9d22649e512a1cd4 @asarazan asarazan committed Jul 21, 2011
Showing with 6 additions and 14 deletions.
  1. +1 −1 Additions/UIView-KIFAdditions.h
  2. +3 −11 Additions/UIView-KIFAdditions.m
  3. +2 −2 Classes/KIFTestStep.m
@@ -13,7 +13,7 @@
@property (nonatomic, readonly, getter=isTappable) BOOL tappable;
-- (BOOL)isAncestorOfFirstResponder;
+- (BOOL)isDescendantOfFirstResponder;
- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label;
- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label accessibilityValue:(NSString *)value traits:(UIAccessibilityTraits)traits;
@@ -194,20 +194,12 @@ - (UIView *)subviewWithClassNameOrSuperClassNamePrefix:(NSString *)prefix;
return nil;
}
-- (BOOL)isAncestorOfFirstResponder;
+- (BOOL)isDescendantOfFirstResponder;
{
if ([self isFirstResponder]) {
return YES;
}
- return [self.superview isAncestorOfFirstResponder];
-}
-
-- (BOOL)isAncestorOfView:(UIView *)view;
-{
- if (view == self) {
- return YES;
- }
- return [self.superview isAncestorOfView:view];
+ return [self.superview isDescendantOfFirstResponder];
}
- (void)flash;
@@ -269,7 +261,7 @@ - (void)tapAtPoint:(CGPoint)point;
[[UIApplication sharedApplication] sendEvent:event];
// Dispatching the event doesn't actually update the first responder, so fake it
- if ([touch.view isAncestorOfView:self] && [touch.view canBecomeFirstResponder]) {
+ if ([touch.view isDescendantOfView:self] && [touch.view canBecomeFirstResponder]) {
[touch.view becomeFirstResponder];
}
View
@@ -201,7 +201,7 @@ + (id)stepToTapViewWithAccessibilityLabel:(NSString *)label value:(NSString *)va
return KIFTestStepResultSuccess;
}
- KIFTestCondition([view isAncestorOfFirstResponder], error, @"Failed to make the view %@ which contains the accessibility element \"%@\" into the first responder", view, label);
+ KIFTestCondition([view isDescendantOfFirstResponder], error, @"Failed to make the view %@ which contains the accessibility element \"%@\" into the first responder", view, label);
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5, false);
@@ -262,7 +262,7 @@ + (id)stepToEnterText:(NSString *)text intoViewWithAccessibilityLabel:(NSString
KIFTestCondition(!isnan(tappablePointInElement.x), error, @"The element with accessibility label %@ is not tappable", label);
[view tapAtPoint:tappablePointInElement];
- KIFTestCondition([view isAncestorOfFirstResponder], error, @"Failed to make the view with accessibility label \"%@\" the first responder. First responder is %@", label, [[[UIApplication sharedApplication] keyWindow] firstResponder]);
+ KIFTestCondition([view isDescendantOfFirstResponder], error, @"Failed to make the view with accessibility label \"%@\" the first responder. First responder is %@", label, [[[UIApplication sharedApplication] keyWindow] firstResponder]);
// Wait for the keyboard
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5, false);

0 comments on commit 15bcce1

Please sign in to comment.