Skip to content

Commit 6827225

Browse files
author
Simone Scionti
committed
simplify boolean check and add integration test for broken case
1 parent 49600ce commit 6827225

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

KIF Tests/TappingTests_ViewTestActor.m

+13
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,18 @@ - (void)testTappingLabelWithLineBreaks
8080
[[viewTester usingLabel:@"A\nB\nC\n\n"] tap];
8181
}
8282

83+
//TODO: simone scionti - this test will be modified to simulate the breaking circumstances
84+
- (void)testIsSearchBarTappableUsingPlaceholderLabel
85+
{
86+
if ([[[viewTester usingCurrentFrame] usingLabel:@"out of frame"] tryFindingTappableView])
87+
{
88+
[tester fail];
89+
}
90+
91+
if (![[[viewTester usingCurrentFrame] usingLabel:@"Search"] tryFindingTappableView])
92+
{
93+
[tester fail];
94+
}
95+
}
8396

8497
@end

Sources/KIF/Additions/UIView-KIFAdditions.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,7 @@ - (BOOL)isProbablyTappable
873873
// Is this view currently on screen?
874874
- (BOOL)isTappable;
875875
{
876-
return ([self isTappableInRect:self.bounds] || ([self hasTapGestureRecognizerAndIsControlEnabled] &&
877-
[self isTappableInRect:self.bounds]));
876+
return [self isTappableInRect:self.bounds];
878877
}
879878

880879
- (BOOL)hasTapGestureRecognizerAndIsControlEnabled

Test Host/Base.lproj/MainStoryboard.storyboard

+9-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@
15881588
<outlet property="delegate" destination="21" id="nKd-AR-TdK"/>
15891589
</connections>
15901590
</textField>
1591-
<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">
1591+
<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">
15921592
<rect key="frame" x="131" y="2000" width="152" height="29"/>
15931593
<autoresizingMask key="autoresizingMask" flexibleMinY="YES" flexibleMaxY="YES"/>
15941594
<accessibility key="accessibilityConfiguration" hint="" label="Greeting">
@@ -1752,6 +1752,14 @@ Line Break
17521752
</accessibility>
17531753
<state key="normal" title="Test Suite"/>
17541754
</button>
1755+
<searchBar contentMode="redraw" fixedFrame="YES" placeholder="Search" translatesAutoresizingMaskIntoConstraints="NO" id="2Mb-bR-KrW">
1756+
<rect key="frame" x="0.0" y="322" width="414" height="44"/>
1757+
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
1758+
<textInputTraits key="textInputTraits"/>
1759+
<connections>
1760+
<outlet property="delegate" destination="21" id="zHR-uq-6kB"/>
1761+
</connections>
1762+
</searchBar>
17551763
</subviews>
17561764
<color key="backgroundColor" red="1" green="0.99997437000274658" blue="0.99999129772186279" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17571765
</view>

0 commit comments

Comments
 (0)