Skip to content

Commit

Permalink
Rework text field deletions (big thanks to @kilink!)
Browse files Browse the repository at this point in the history
* Adds several integration (UI) tests
* closes #8
  • Loading branch information
rcdilorenzo committed May 6, 2014
2 parents 08a98d3 + c73fa57 commit ec6c416
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 107 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ profile
*.moved-aside
DerivedData
.idea/
Pods/
5 changes: 5 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
platform :ios, '6.0'

target 'RMSTokenViewTests', :exclusive => true do
pod 'KIF', '~> 3.0'
end
12 changes: 12 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PODS:
- KIF (3.0.3):
- KIF/XCTest
- KIF/XCTest (3.0.3)

DEPENDENCIES:
- KIF (~> 3.0)

SPEC CHECKSUMS:
KIF: 908d9a64faa939ad96581c90f9cc256649a2014a

COCOAPODS: 0.32.1
4 changes: 2 additions & 2 deletions RMSTokenView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Pod::Spec.new do |s|
s.author = { "Christian Di Lorenzo" => "rcddeveloper@icloud.com" }
s.source = { :git => "https://github.com/RoleModel/RMSTokenView.git", :tag => s.version.to_s }
s.platform = :ios, '6.0'
s.source_files = 'RMSTokenView/RMSTokenView.*', 'RMSTokenView/RMSTokenConstraintManager.*'
s.source_files = 'RMSTokenView/RMSTokenView.*', 'RMSTokenView/RMSTokenConstraintManager.*', 'RMSTokenView/RMSTextField.*'
s.requires_arc = true
end
end
63 changes: 53 additions & 10 deletions RMSTokenView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
1C9ACDDE17D243B200581B8F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C9ACDDD17D243B200581B8F /* Default@2x.png */; };
1C9ACDE017D243B200581B8F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C9ACDDF17D243B200581B8F /* Default-568h@2x.png */; };
1C9ACDE617D243B200581B8F /* RMSViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C9ACDE517D243B200581B8F /* RMSViewController.m */; };
1C9ACDEE17D243B200581B8F /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C9ACDED17D243B200581B8F /* SenTestingKit.framework */; };
1C9ACDEF17D243B200581B8F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C9ACDC917D243B100581B8F /* UIKit.framework */; };
1C9ACDF017D243B200581B8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C9ACDCB17D243B100581B8F /* Foundation.framework */; };
1C9ACDF817D243B200581B8F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1C9ACDF617D243B200581B8F /* InfoPlist.strings */; };
1C9ACDFB17D243B200581B8F /* RMSTokenViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C9ACDFA17D243B200581B8F /* RMSTokenViewTests.m */; };
1CE61D7A17D245500074FE6F /* RMSTokenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CE61D7917D245500074FE6F /* RMSTokenView.m */; };
1CE61D7B17D245500074FE6F /* RMSTokenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CE61D7917D245500074FE6F /* RMSTokenView.m */; };
1CEF0C42180C4B4B00F2532F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1CEF0C41180C4B4B00F2532F /* Main.storyboard */; };
30F03FDAD9A84DD1B0405BF2 /* libPods-RMSTokenViewTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A19B490C7AA44285A3F9955B /* libPods-RMSTokenViewTests.a */; };
C68B7213183052C9AECBC851 /* RMSTokenConstraintManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C68B70303BC5A274A77CB18B /* RMSTokenConstraintManager.m */; };
CDA30C35191814A6005FE6E5 /* RMSTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = CDA30C34191814A6005FE6E5 /* RMSTextField.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -39,6 +40,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1C72500FDBE646ADAF0F4CFB /* Pods-RMSTokenViewTests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RMSTokenViewTests.xcconfig"; path = "Pods/Pods-RMSTokenViewTests.xcconfig"; sourceTree = "<group>"; };
1C9ACDC617D243B100581B8F /* RMSTokenView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RMSTokenView.app; sourceTree = BUILT_PRODUCTS_DIR; };
1C9ACDC917D243B100581B8F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
1C9ACDCB17D243B100581B8F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand All @@ -54,17 +56,19 @@
1C9ACDDF17D243B200581B8F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
1C9ACDE417D243B200581B8F /* RMSViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RMSViewController.h; sourceTree = "<group>"; };
1C9ACDE517D243B200581B8F /* RMSViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RMSViewController.m; sourceTree = "<group>"; };
1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RMSTokenViewTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
1C9ACDED17D243B200581B8F /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RMSTokenViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1C9ACDF517D243B200581B8F /* RMSTokenViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RMSTokenViewTests-Info.plist"; sourceTree = "<group>"; };
1C9ACDF717D243B200581B8F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1C9ACDF917D243B200581B8F /* RMSTokenViewTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RMSTokenViewTests.h; sourceTree = "<group>"; };
1C9ACDFA17D243B200581B8F /* RMSTokenViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RMSTokenViewTests.m; sourceTree = "<group>"; };
1CE61D7817D245500074FE6F /* RMSTokenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMSTokenView.h; sourceTree = "<group>"; };
1CE61D7917D245500074FE6F /* RMSTokenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMSTokenView.m; sourceTree = "<group>"; };
1CEF0C41180C4B4B00F2532F /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
A19B490C7AA44285A3F9955B /* libPods-RMSTokenViewTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RMSTokenViewTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
C68B70303BC5A274A77CB18B /* RMSTokenConstraintManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMSTokenConstraintManager.m; sourceTree = "<group>"; };
C68B73B0C50BDDF7CA6B81A5 /* RMSTokenConstraintManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMSTokenConstraintManager.h; sourceTree = "<group>"; };
CDA30C33191814A6005FE6E5 /* RMSTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMSTextField.h; sourceTree = "<group>"; };
CDA30C34191814A6005FE6E5 /* RMSTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMSTextField.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -82,9 +86,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1C9ACDEE17D243B200581B8F /* SenTestingKit.framework in Frameworks */,
1C9ACDEF17D243B200581B8F /* UIKit.framework in Frameworks */,
1C9ACDF017D243B200581B8F /* Foundation.framework in Frameworks */,
30F03FDAD9A84DD1B0405BF2 /* libPods-RMSTokenViewTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -98,14 +102,15 @@
1C9ACDF317D243B200581B8F /* RMSTokenViewTests */,
1C9ACDC817D243B100581B8F /* Frameworks */,
1C9ACDC717D243B100581B8F /* Products */,
1C72500FDBE646ADAF0F4CFB /* Pods-RMSTokenViewTests.xcconfig */,
);
sourceTree = "<group>";
};
1C9ACDC717D243B100581B8F /* Products */ = {
isa = PBXGroup;
children = (
1C9ACDC617D243B100581B8F /* RMSTokenView.app */,
1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.octest */,
1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -116,7 +121,7 @@
1C9ACDC917D243B100581B8F /* UIKit.framework */,
1C9ACDCB17D243B100581B8F /* Foundation.framework */,
1C9ACDCD17D243B100581B8F /* CoreGraphics.framework */,
1C9ACDED17D243B200581B8F /* SenTestingKit.framework */,
A19B490C7AA44285A3F9955B /* libPods-RMSTokenViewTests.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -131,6 +136,8 @@
1C9ACDE517D243B200581B8F /* RMSViewController.m */,
1CE61D7817D245500074FE6F /* RMSTokenView.h */,
1CE61D7917D245500074FE6F /* RMSTokenView.m */,
CDA30C33191814A6005FE6E5 /* RMSTextField.h */,
CDA30C34191814A6005FE6E5 /* RMSTextField.m */,
1C9ACDD017D243B100581B8F /* Supporting Files */,
C68B73B0C50BDDF7CA6B81A5 /* RMSTokenConstraintManager.h */,
C68B70303BC5A274A77CB18B /* RMSTokenConstraintManager.m */,
Expand Down Expand Up @@ -195,10 +202,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 1C9ACE0117D243B200581B8F /* Build configuration list for PBXNativeTarget "RMSTokenViewTests" */;
buildPhases = (
38CC863464C54D9EA399A655 /* Check Pods Manifest.lock */,
1C9ACDE717D243B200581B8F /* Sources */,
1C9ACDE817D243B200581B8F /* Frameworks */,
1C9ACDE917D243B200581B8F /* Resources */,
1C9ACDEA17D243B200581B8F /* ShellScript */,
02E84147A7DF433D875E8EB5 /* Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -207,8 +216,8 @@
);
name = RMSTokenViewTests;
productName = RMSTokenViewTests;
productReference = 1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.octest */;
productType = "com.apple.product-type.bundle";
productReference = 1C9ACDEC17D243B200581B8F /* RMSTokenViewTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

Expand All @@ -217,6 +226,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = RMS;
LastTestingUpgradeCheck = 0510;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = "RoleModel Software";
};
Expand Down Expand Up @@ -262,6 +272,21 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
02E84147A7DF433D875E8EB5 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-RMSTokenViewTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
1C9ACDEA17D243B200581B8F /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -275,13 +300,29 @@
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
38CC863464C54D9EA399A655 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
1C9ACDC217D243B100581B8F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CDA30C35191814A6005FE6E5 /* RMSTextField.m in Sources */,
1C9ACDD617D243B100581B8F /* main.m in Sources */,
1C9ACDDA17D243B200581B8F /* RMSAppDelegate.m in Sources */,
1C9ACDE617D243B200581B8F /* RMSViewController.m in Sources */,
Expand Down Expand Up @@ -409,35 +450,37 @@
};
1C9ACE0217D243B200581B8F /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1C72500FDBE646ADAF0F4CFB /* Pods-RMSTokenViewTests.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RMSTokenView.app/RMSTokenView";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RMSTokenView/RMSTokenView-Prefix.pch";
INFOPLIST_FILE = "RMSTokenViewTests/RMSTokenViewTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
1C9ACE0317D243B200581B8F /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1C72500FDBE646ADAF0F4CFB /* Pods-RMSTokenViewTests.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RMSTokenView.app/RMSTokenView";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RMSTokenView/RMSTokenView-Prefix.pch";
INFOPLIST_FILE = "RMSTokenViewTests/RMSTokenViewTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
Expand Down
11 changes: 7 additions & 4 deletions RMSTokenView/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="BRA-6O-req">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="BRA-6O-req">
<dependencies>
<deployment defaultVersion="1552" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<scenes>
<!--View Controller - RMSTokenView-->
Expand All @@ -24,6 +24,9 @@
<constraint firstAttribute="height" constant="44" id="tU6-CP-8oD"/>
<constraint firstAttribute="width" constant="320" id="uR7-pe-yUn"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityLabel" value="tokenView"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="heightConstraint" destination="tU6-CP-8oD" id="J1f-z6-VKT"/>
</connections>
Expand All @@ -43,7 +46,6 @@
<!--Navigation Controller-->
<scene sceneID="NZX-Lo-BHg">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="cZC-ZH-qKk" userLabel="First Responder" sceneMemberID="firstResponder"/>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="BRA-6O-req" sceneMemberID="viewController">
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
<toolbarItems/>
Expand All @@ -56,6 +58,7 @@
<segue destination="ZWX-Pu-DxJ" kind="relationship" relationship="rootViewController" id="Rkv-rp-5Op"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cZC-ZH-qKk" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="212" y="-59"/>
</scene>
Expand All @@ -65,4 +68,4 @@
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
</document>
22 changes: 22 additions & 0 deletions RMSTokenView/RMSTextField.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// RMSTextField.h
// RMSTokenView
//
// Created by Patrick Strawderman on 5/5/14.
// Copyright (c) 2014 RoleModel Software. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol BackspaceDelegate <NSObject>

@optional
- (void)willDeleteBackward:(UITextField*)textField;
- (void)didDeleteBackward:(UITextField*)textField;

@end


@interface RMSTextField : UITextField
@property (nonatomic, weak) id<BackspaceDelegate>backspaceDelegate;
@end
23 changes: 23 additions & 0 deletions RMSTokenView/RMSTextField.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// RMSTextField.m
// RMSTokenView
//
// Created by Patrick Strawderman on 5/5/14.
// Copyright (c) 2014 RoleModel Software. All rights reserved.
//

#import "RMSTextField.h"

@implementation RMSTextField

- (void)deleteBackward {
if ([self.backspaceDelegate respondsToSelector:@selector(willDeleteBackward:)]) {
[self.backspaceDelegate willDeleteBackward:self];
}
[super deleteBackward];
if ([self.backspaceDelegate respondsToSelector:@selector(didDeleteBackward:)]) {
[self.backspaceDelegate didDeleteBackward:self];
}
}

@end
5 changes: 4 additions & 1 deletion RMSTokenView/RMSTokenView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

#import <UIKit/UIKit.h>

#import "RMSTextField.h"

@protocol RMSTokenDelegate;


@interface RMSTokenView : UIScrollView<UITextFieldDelegate>
@interface RMSTokenView : UIScrollView<UITextFieldDelegate, BackspaceDelegate>

@property (nonatomic, strong) UITextField *textField;
@property (nonatomic, strong) NSString *text;
@property (nonatomic, strong) NSString *placeholder;

@property (nonatomic) BOOL searching;

Expand Down
Loading

0 comments on commit ec6c416

Please sign in to comment.