react-native-navigation的迁移库

RNNNavigationOptionsTest.m 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  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:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
  15. XCTAssertTrue(options.topBar.background.color);
  16. }
  17. - (void)testChangeRNNNavigationOptionsDynamically {
  18. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
  19. NSDictionary* dynamicOptions = @{@"topBar": @{@"textColor" : @(0xffff00ff), @"title" : @{@"text": @"hello"}}};
  20. [options mergeWith:dynamicOptions];
  21. XCTAssertTrue([options.topBar.title.text isEqual:@"hello"]);
  22. }
  23. - (void)testChangeRNNNavigationOptionsWithInvalidProperties {
  24. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
  25. NSDictionary* dynamicOptions = @{@"topBar": @{@"titleeeee" : @"hello"}};
  26. XCTAssertNoThrow([options mergeWith:dynamicOptions]);
  27. }
  28. @end