Skip to content

Commit

Permalink
simplify boolean check and add integration test for broken case
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Scionti committed Jul 30, 2024
1 parent 49600ce commit 6827225
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
13 changes: 13 additions & 0 deletions KIF Tests/TappingTests_ViewTestActor.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions Sources/KIF/Additions/UIView-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion Test Host/Base.lproj/MainStoryboard.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@
<outlet property="delegate" destination="21" id="nKd-AR-TdK"/>
</connections>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Hello" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Qs0-rL-Yva" userLabel="Out of frame view">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Hello" borderStyle="roundedRect" placeholder="out of frame" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Qs0-rL-Yva" userLabel="Out of frame view">
<rect key="frame" x="131" y="2000" width="152" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" hint="" label="Greeting">
Expand Down Expand Up @@ -1752,6 +1752,14 @@ Line Break
</accessibility>
<state key="normal" title="Test Suite"/>
</button>
<searchBar contentMode="redraw" fixedFrame="YES" placeholder="Search" translatesAutoresizingMaskIntoConstraints="NO" id="2Mb-bR-KrW">
<rect key="frame" x="0.0" y="322" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="21" id="zHR-uq-6kB"/>
</connections>
</searchBar>
</subviews>
<color key="backgroundColor" red="1" green="0.99997437000274658" blue="0.99999129772186279" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
Expand Down

0 comments on commit 6827225

Please sign in to comment.