-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return `NoColor` object when `NoColor` string is passed as the color from JS.
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#import <XCTest/XCTest.h> | ||
#import "ColorParser.h" | ||
#import "NullColor.h" | ||
#import "NoColor.h" | ||
|
||
@interface ColorParserTest : XCTestCase | ||
@end | ||
|
||
@implementation ColorParserTest | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
} | ||
|
||
- (void)testParse_NSNumberColor { | ||
UIColor* expectedColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0]; | ||
NSDictionary* colorDict = @{@"colorKey": @(0xffffffff)}; | ||
Color* color = [ColorParser parse:colorDict key:@"colorKey"]; | ||
XCTAssertTrue([color.get isEqual:expectedColor]); | ||
} | ||
|
||
- (void)testParse_nilColor { | ||
NSDictionary* colorDict = @{}; | ||
Color* color = [ColorParser parse:colorDict key:@"colorKey"]; | ||
XCTAssertTrue([color isKindOfClass:NullColor.class]); | ||
} | ||
|
||
- (void)testParse_NoColor { | ||
NSDictionary* colorDict = @{@"colorKey": @"NoColor"}; | ||
Color* color = [ColorParser parse:colorDict key:@"colorKey"]; | ||
XCTAssertTrue([color isKindOfClass:NoColor.class]); | ||
} | ||
|
||
@end |
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