Created
March 17, 2014 00:44
-
-
Save cspickert/9592047 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SAMTextViewTests.m | |
// SAMTextViewTests | |
// | |
// Created by Cameron Spickert on 3/16/14. | |
// Copyright (c) 2014 Cameron Spickert. All rights reserved. | |
// | |
#import <XCTest/XCTest.h> | |
#import <SAMTextView/SAMTextView.h> | |
@interface SAMTextViewTests : XCTestCase | |
@property (nonatomic) SAMTextView *textView; | |
@end | |
@implementation SAMTextViewTests | |
- (void)setUp | |
{ | |
[super setUp]; | |
self.textView = [[SAMTextView alloc] init]; | |
} | |
- (void)tearDown | |
{ | |
self.textView = nil; | |
[super tearDown]; | |
} | |
- (void)testSettingPlaceholderBeforeFont | |
{ | |
XCTAssertNil(self.textView.font); | |
XCTAssertNoThrow(self.textView.placeholder = @"foo"); | |
} | |
- (void)testSettingNilPlaceholder | |
{ | |
self.textView.font = [UIFont systemFontOfSize:12.0]; | |
self.textView.placeholder = @"foo"; | |
XCTAssertNoThrow(self.textView.placeholder = nil); | |
} | |
- (void)testSettingFontAfterPlaceholder | |
{ | |
self.textView.font = [UIFont systemFontOfSize:12.0]; | |
self.textView.placeholder = @"foo"; | |
self.textView.font = [UIFont fontWithName:@"Georgia" size:12.0]; | |
XCTAssertEqualObjects([self.textView.attributedPlaceholder attributesAtIndex:0 effectiveRange:NULL][NSFontAttributeName], self.textView.font); | |
} | |
- (void)testSettingNilFontAfterPlaceholder | |
{ | |
self.textView.font = [UIFont systemFontOfSize:12.0]; | |
self.textView.placeholder = @"foo"; | |
XCTAssertNoThrow(self.textView.font = nil); | |
XCTAssertNil([self.textView.attributedPlaceholder attributesAtIndex:0 effectiveRange:NULL][NSFontAttributeName]); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment