react-native-navigation的迁移库

RNNNavigationOptionsTest.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #import <XCTest/XCTest.h>
  2. #import "RNNNavigationOptions.h"
  3. @interface RNNNavigationOptionsTest : XCTestCase
  4. @end
  5. @implementation RNNNavigationOptionsTest
  6. - (void)setUp {
  7. [super setUp];
  8. }
  9. -(void)testInitCreatesInstanceType{
  10. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{}];
  11. XCTAssertTrue([options isKindOfClass:[RNNNavigationOptions class]]);
  12. }
  13. -(void)testAddsStyleFromDictionaryWithInit{
  14. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
  15. XCTAssertTrue(options.topBarBackgroundColor);
  16. }
  17. -(void)testReturnsNilWhenStyleDoesNotExist{
  18. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
  19. XCTAssertNil(options.topBarTextColor);
  20. }
  21. -(void)testChangeRNNNavigationOptionsDynamically{
  22. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
  23. NSDictionary* dynamicOptions = @{@"topBarTextColor" : @(0xffff00ff), @"title" : @"hello"};
  24. [options mergeWith:dynamicOptions];
  25. XCTAssertTrue([options.title isEqual:@"hello"]);
  26. }
  27. -(void)testChangeRNNNavigationOptionsWithInvalidProperties{
  28. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
  29. NSDictionary* dynamicOptions = @{@"titleeeee" : @"hello"};
  30. XCTAssertThrows([options mergeWith:dynamicOptions]);
  31. }
  32. @end