-
-
Save yas375/7801725 to your computer and use it in GitHub Desktop.
This file contains 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
#import <Kiwi/Kiwi.h> | |
#import "WGTitleView.h" | |
@interface WGTitleView () | |
@property (strong, nonatomic) UILabel *titleLabel; | |
@property (strong, nonatomic) UILabel *subtitleLabel; | |
- (void)onTap:(id)sender; | |
@end | |
SPEC_BEGIN(WGTitleViewSpec) | |
describe(@"WGTitleView", ^{ | |
it(@"can be created without title and subtitle", ^{ | |
WGTitleView *titleView = [WGTitleView titleView]; | |
[[titleView.title should] beNil]; | |
[[titleView.subtitle should] beNil]; | |
}); | |
it(@"can be created with title only", ^{ | |
WGTitleView *titleView = [WGTitleView titleViewWithTitle:@"title"]; | |
[[titleView.title should] equal:@"title"]; | |
[[titleView.subtitle should] beNil]; | |
}); | |
context(@"when created with title and subtitle", ^{ | |
__block WGTitleView *titleView = nil; | |
beforeEach(^{ | |
titleView = [WGTitleView titleViewWithTitle:@"title" subtitle:@"subtitle"]; | |
}); | |
it(@"has title and subtitle", ^{ | |
[[titleView.title should] equal:@"title"]; | |
[[titleView.subtitle should] equal:@"subtitle"]; | |
}); | |
it(@"has appropriate title and subtitle on the labels labels", ^{ | |
[[titleView.titleLabel.text should] equal:@"title"]; | |
[[titleView.subtitleLabel.text should] equal:@"subtitle"]; | |
}); | |
it(@"call tap handle on tap", ^{ | |
__block BOOL tapped = NO; | |
titleView.tapHandler = ^(){ | |
tapped = YES; | |
}; | |
[titleView onTap:nil]; | |
[[theValue(tapped) should] beTrue]; | |
}); | |
}); | |
}); | |
SPEC_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment