From 68272259a3447e8eb73ac5126cbba565a4b78cdd Mon Sep 17 00:00:00 2001 From: Simone Scionti Date: Tue, 30 Jul 2024 12:21:15 +0200 Subject: [PATCH] simplify boolean check and add integration test for broken case --- KIF Tests/TappingTests_ViewTestActor.m | 13 +++++++++++++ Sources/KIF/Additions/UIView-KIFAdditions.m | 3 +-- Test Host/Base.lproj/MainStoryboard.storyboard | 10 +++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/KIF Tests/TappingTests_ViewTestActor.m b/KIF Tests/TappingTests_ViewTestActor.m index e7d164af7..120112e44 100644 --- a/KIF Tests/TappingTests_ViewTestActor.m +++ b/KIF Tests/TappingTests_ViewTestActor.m @@ -80,5 +80,18 @@ - (void)testTappingLabelWithLineBreaks [[viewTester usingLabel:@"A\nB\nC\n\n"] tap]; } +//TODO: simone scionti - this test will be modified to simulate the breaking circumstances +- (void)testIsSearchBarTappableUsingPlaceholderLabel +{ + if ([[[viewTester usingCurrentFrame] usingLabel:@"out of frame"] tryFindingTappableView]) + { + [tester fail]; + } + + if (![[[viewTester usingCurrentFrame] usingLabel:@"Search"] tryFindingTappableView]) + { + [tester fail]; + } +} @end diff --git a/Sources/KIF/Additions/UIView-KIFAdditions.m b/Sources/KIF/Additions/UIView-KIFAdditions.m index 05750ac4b..97e9c7076 100644 --- a/Sources/KIF/Additions/UIView-KIFAdditions.m +++ b/Sources/KIF/Additions/UIView-KIFAdditions.m @@ -873,8 +873,7 @@ - (BOOL)isProbablyTappable // Is this view currently on screen? - (BOOL)isTappable; { - return ([self isTappableInRect:self.bounds] || ([self hasTapGestureRecognizerAndIsControlEnabled] && - [self isTappableInRect:self.bounds])); + return [self isTappableInRect:self.bounds]; } - (BOOL)hasTapGestureRecognizerAndIsControlEnabled diff --git a/Test Host/Base.lproj/MainStoryboard.storyboard b/Test Host/Base.lproj/MainStoryboard.storyboard index 41ea444e8..8b38f103d 100644 --- a/Test Host/Base.lproj/MainStoryboard.storyboard +++ b/Test Host/Base.lproj/MainStoryboard.storyboard @@ -1588,7 +1588,7 @@ - + @@ -1752,6 +1752,14 @@ Line Break + + + + + + + +