|
@@ -1,4 +1,5 @@
|
1
|
1
|
const OptionsProcessor = require('./OptionsProcessor');
|
|
2
|
+const NavigationOptions = require('./../params/NavigationOptions');
|
2
|
3
|
|
3
|
4
|
describe('navigation options', () => {
|
4
|
5
|
let navigationOptions;
|
|
@@ -69,16 +70,16 @@ describe('navigation options', () => {
|
69
|
70
|
});
|
70
|
71
|
|
71
|
72
|
it('any nested recursive keys ending with Color', () => {
|
72
|
|
- navigationOptions.innerObj = { theKeyColor: 'red' };
|
73
|
|
- navigationOptions.innerObj.innerMostObj = { anotherColor: 'yellow' };
|
|
73
|
+ navigationOptions.topBar = { textColor: 'red' };
|
|
74
|
+ navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
|
74
|
75
|
OptionsProcessor.processOptions(navigationOptions);
|
75
|
|
- expect(navigationOptions.innerObj.theKeyColor).toEqual(0xffff0000);
|
76
|
|
- expect(navigationOptions.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
|
|
76
|
+ expect(navigationOptions.topBar.textColor).toEqual(0xffff0000);
|
|
77
|
+ expect(navigationOptions.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
|
77
|
78
|
});
|
78
|
79
|
|
79
|
80
|
it('resolve image sources with name/ending with icon', () => {
|
80
|
81
|
navigationOptions.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
|
81
|
|
- navigationOptions.innerObj = {
|
|
82
|
+ navigationOptions.topBar = {
|
82
|
83
|
myIcon: 'require("https://wix.github.io/react-native-navigation/_images/logo.png");',
|
83
|
84
|
myOtherValue: 'value'
|
84
|
85
|
};
|
|
@@ -88,7 +89,18 @@ describe('navigation options', () => {
|
88
|
89
|
// I assign the icons to strings (what the require would generally look like)
|
89
|
90
|
// and expect the value to be resovled, in this case it doesn't find anything and returns null
|
90
|
91
|
expect(navigationOptions.icon).toEqual(null);
|
91
|
|
- expect(navigationOptions.innerObj.myIcon).toEqual(null);
|
92
|
|
- expect(navigationOptions.innerObj.myOtherValue).toEqual('value');
|
|
92
|
+ expect(navigationOptions.topBar.myIcon).toEqual(null);
|
|
93
|
+ expect(navigationOptions.topBar.myOtherValue).toEqual('value');
|
|
94
|
+ });
|
|
95
|
+
|
|
96
|
+ it('processes NavigationOptions jsDoc object', () => {
|
|
97
|
+ navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
|
|
98
|
+ navigationOptions.topBar = { textColor: 'red' };
|
|
99
|
+ navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
|
|
100
|
+ const navigationOptionsObj = new NavigationOptions(navigationOptions);
|
|
101
|
+
|
|
102
|
+ OptionsProcessor.processOptions(navigationOptionsObj);
|
|
103
|
+
|
|
104
|
+ expect(navigationOptionsObj.topBar.textColor).toEqual(0xffff0000);
|
93
|
105
|
});
|
94
|
106
|
});
|