Browse Source

rename navigationOptions to Options

Daniel Zlotin 6 years ago
parent
commit
e16f025d03

+ 1
- 1
e2e/ScreenStyle.test.js View File

8
     await device.relaunchApp();
8
     await device.relaunchApp();
9
   });
9
   });
10
 
10
 
11
-  it('declare a navigationOptions on container component', async () => {
11
+  it('declare a options on container component', async () => {
12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
13
     await expect(element(by.label('Static Title'))).toBeVisible();
13
     await expect(element(by.label('Static Title'))).toBeVisible();
14
   });
14
   });

+ 3
- 3
lib/src/commands/Commands.test.js View File

31
         children: [],
31
         children: [],
32
         data: {
32
         data: {
33
           name: 'com.example.MyScreen',
33
           name: 'com.example.MyScreen',
34
-          navigationOptions: {}
34
+          options: {}
35
         }
35
         }
36
       });
36
       });
37
     });
37
     });
94
         id: 'Component+UNIQUE_ID',
94
         id: 'Component+UNIQUE_ID',
95
         data: {
95
         data: {
96
           name: 'com.example.MyScreen',
96
           name: 'com.example.MyScreen',
97
-          navigationOptions: {}
97
+          options: {}
98
         },
98
         },
99
         children: []
99
         children: []
100
       });
100
       });
176
         id: 'Component+UNIQUE_ID',
176
         id: 'Component+UNIQUE_ID',
177
         data: {
177
         data: {
178
           name: 'com.example.MyScreen',
178
           name: 'com.example.MyScreen',
179
-          navigationOptions: {}
179
+          options: {}
180
         },
180
         },
181
         children: []
181
         children: []
182
       });
182
       });

+ 5
- 5
lib/src/commands/LayoutTreeCrawler.js View File

23
   _handleContainer(node) {
23
   _handleContainer(node) {
24
     this._assertContainerDataName(node);
24
     this._assertContainerDataName(node);
25
     this._savePropsToStore(node);
25
     this._savePropsToStore(node);
26
-    this._applyStaticNavigationOptions(node);
27
-    OptionsProcessor.processOptions(node.data.navigationOptions);
26
+    this._applyStaticOptions(node);
27
+    OptionsProcessor.processOptions(node.data.options);
28
   }
28
   }
29
 
29
 
30
   _savePropsToStore(node) {
30
   _savePropsToStore(node) {
31
     this.store.setPropsForContainerId(node.id, node.data.passProps);
31
     this.store.setPropsForContainerId(node.id, node.data.passProps);
32
   }
32
   }
33
 
33
 
34
-  _applyStaticNavigationOptions(node) {
34
+  _applyStaticOptions(node) {
35
     const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
35
     const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
36
     const staticOptions = _.cloneDeep(clazz.navigationOptions) || {};
36
     const staticOptions = _.cloneDeep(clazz.navigationOptions) || {};
37
-    const passedOptions = _.cloneDeep(node.data.navigationOptions) || {};
38
-    node.data.navigationOptions = _.merge({}, staticOptions, passedOptions);
37
+    const passedOptions = node.data.options || {};
38
+    node.data.options = _.merge({}, staticOptions, passedOptions);
39
   }
39
   }
40
 
40
 
41
   _assertKnownLayoutType(type) {
41
   _assertKnownLayoutType(type) {

+ 42
- 42
lib/src/commands/LayoutTreeCrawler.test.js View File

47
     expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
47
     expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
48
   });
48
   });
49
 
49
 
50
-  it('Containers: injects navigationOptions from original container class static property', () => {
50
+  it('Containers: injects options from original container class static property', () => {
51
     const theStyle = {};
51
     const theStyle = {};
52
     const MyContainer = class {
52
     const MyContainer = class {
53
-      static get navigationOptions() {
53
+      static get options() {
54
         return theStyle;
54
         return theStyle;
55
       }
55
       }
56
     };
56
     };
58
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
58
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
59
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
59
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
60
     uut.crawl(node);
60
     uut.crawl(node);
61
-    expect(node.data.navigationOptions).toEqual(theStyle);
61
+    expect(node.data.options).toEqual(theStyle);
62
   });
62
   });
63
 
63
 
64
-  it('Containers: merges navigationOptions from container class static property with passed options, favoring passed options', () => {
64
+  it('Containers: merges options from container class static property with passed options, favoring passed options', () => {
65
     const theStyle = {
65
     const theStyle = {
66
       bazz: 123,
66
       bazz: 123,
67
       inner: {
67
       inner: {
83
       }
83
       }
84
     };
84
     };
85
 
85
 
86
-    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName', navigationOptions: passedOptions } };
86
+    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options: passedOptions } };
87
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
87
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
88
 
88
 
89
     uut.crawl(node);
89
     uut.crawl(node);
90
 
90
 
91
-    expect(node.data.navigationOptions).toEqual({
91
+    expect(node.data.options).toEqual({
92
       aaa: 'exists only in passed',
92
       aaa: 'exists only in passed',
93
       bazz: 789,
93
       bazz: 789,
94
       inner: {
94
       inner: {
98
     });
98
     });
99
   });
99
   });
100
 
100
 
101
-  it('Component: deepClones navigationOptions', () => {
101
+  it('Component: deepClones options', () => {
102
     const theStyle = {};
102
     const theStyle = {};
103
     const MyContainer = class {
103
     const MyContainer = class {
104
-      static get navigationOptions() {
104
+      static get options() {
105
         return theStyle;
105
         return theStyle;
106
       }
106
       }
107
     };
107
     };
109
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
109
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
110
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
110
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
111
     uut.crawl(node);
111
     uut.crawl(node);
112
-    expect(node.data.navigationOptions).not.toBe(theStyle);
112
+    expect(node.data.options).not.toBe(theStyle);
113
   });
113
   });
114
 
114
 
115
   it('Containers: must contain data name', () => {
115
   it('Containers: must contain data name', () => {
117
     expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
117
     expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
118
   });
118
   });
119
 
119
 
120
-  it('Containers: navigationOptions default obj', () => {
120
+  it('Containers: options default obj', () => {
121
     const MyContainer = class { };
121
     const MyContainer = class { };
122
 
122
 
123
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
123
     const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
124
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
124
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
125
     uut.crawl(node);
125
     uut.crawl(node);
126
-    expect(node.data.navigationOptions).toEqual({});
126
+    expect(node.data.options).toEqual({});
127
   });
127
   });
128
 
128
 
129
   describe('navigation options', () => {
129
   describe('navigation options', () => {
130
-    let navigationOptions;
130
+    let options;
131
     let node;
131
     let node;
132
 
132
 
133
     beforeEach(() => {
133
     beforeEach(() => {
134
-      navigationOptions = {};
135
-      node = { type: LayoutTypes.Component, data: { name: 'theContainerName', navigationOptions } };
134
+      options = {};
135
+      node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options } };
136
     });
136
     });
137
 
137
 
138
     it('processes colors into numeric AARRGGBB', () => {
138
     it('processes colors into numeric AARRGGBB', () => {
139
-      navigationOptions.someKeyColor = 'red';
139
+      options.someKeyColor = 'red';
140
       uut.crawl(node);
140
       uut.crawl(node);
141
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff0000);
141
+      expect(node.data.options.someKeyColor).toEqual(0xffff0000);
142
     });
142
     });
143
 
143
 
144
     it('processes colors into numeric AARRGGBB', () => {
144
     it('processes colors into numeric AARRGGBB', () => {
145
-      navigationOptions.someKeyColor = 'yellow';
145
+      options.someKeyColor = 'yellow';
146
       uut.crawl(node);
146
       uut.crawl(node);
147
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffff00);
147
+      expect(node.data.options.someKeyColor).toEqual(0xffffff00);
148
     });
148
     });
149
 
149
 
150
     it('processes numeric colors', () => {
150
     it('processes numeric colors', () => {
151
-      navigationOptions.someKeyColor = '#123456';
151
+      options.someKeyColor = '#123456';
152
       uut.crawl(node);
152
       uut.crawl(node);
153
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
153
+      expect(node.data.options.someKeyColor).toEqual(0xff123456);
154
     });
154
     });
155
 
155
 
156
     it('processes numeric colors with rrggbbAA', () => {
156
     it('processes numeric colors with rrggbbAA', () => {
157
-      navigationOptions.someKeyColor = 0x123456ff; // wut
157
+      options.someKeyColor = 0x123456ff; // wut
158
       uut.crawl(node);
158
       uut.crawl(node);
159
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
159
+      expect(node.data.options.someKeyColor).toEqual(0xff123456);
160
     });
160
     });
161
 
161
 
162
     it('process colors with rgb functions', () => {
162
     it('process colors with rgb functions', () => {
163
-      navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
163
+      options.someKeyColor = 'rgb(255, 0, 255)';
164
       uut.crawl(node);
164
       uut.crawl(node);
165
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
165
+      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
166
     });
166
     });
167
 
167
 
168
     it('process colors with special words', () => {
168
     it('process colors with special words', () => {
169
-      navigationOptions.someKeyColor = 'fuchsia';
169
+      options.someKeyColor = 'fuchsia';
170
       uut.crawl(node);
170
       uut.crawl(node);
171
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
171
+      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
172
     });
172
     });
173
 
173
 
174
     it('process colors with hsla functions', () => {
174
     it('process colors with hsla functions', () => {
175
-      navigationOptions.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
175
+      options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
176
       uut.crawl(node);
176
       uut.crawl(node);
177
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffffff);
177
+      expect(node.data.options.someKeyColor).toEqual(0xffffffff);
178
     });
178
     });
179
 
179
 
180
     it('unknown colors return undefined', () => {
180
     it('unknown colors return undefined', () => {
181
-      navigationOptions.someKeyColor = 'wut';
181
+      options.someKeyColor = 'wut';
182
       uut.crawl(node);
182
       uut.crawl(node);
183
-      expect(node.data.navigationOptions.someKeyColor).toEqual(undefined);
183
+      expect(node.data.options.someKeyColor).toEqual(undefined);
184
     });
184
     });
185
 
185
 
186
     it('any keys ending with Color', () => {
186
     it('any keys ending with Color', () => {
187
-      navigationOptions.otherKeyColor = 'red';
188
-      navigationOptions.yetAnotherColor = 'blue';
189
-      navigationOptions.andAnotherColor = 'rgb(0, 255, 0)';
187
+      options.otherKeyColor = 'red';
188
+      options.yetAnotherColor = 'blue';
189
+      options.andAnotherColor = 'rgb(0, 255, 0)';
190
       uut.crawl(node);
190
       uut.crawl(node);
191
-      expect(node.data.navigationOptions.otherKeyColor).toEqual(0xffff0000);
192
-      expect(node.data.navigationOptions.yetAnotherColor).toEqual(0xff0000ff);
193
-      expect(node.data.navigationOptions.andAnotherColor).toEqual(0xff00ff00);
191
+      expect(node.data.options.otherKeyColor).toEqual(0xffff0000);
192
+      expect(node.data.options.yetAnotherColor).toEqual(0xff0000ff);
193
+      expect(node.data.options.andAnotherColor).toEqual(0xff00ff00);
194
     });
194
     });
195
 
195
 
196
     it('keys ending with Color case sensitive', () => {
196
     it('keys ending with Color case sensitive', () => {
197
-      navigationOptions.otherKey_color = 'red'; // eslint-disable-line camelcase
197
+      options.otherKey_color = 'red'; // eslint-disable-line camelcase
198
       uut.crawl(node);
198
       uut.crawl(node);
199
-      expect(node.data.navigationOptions.otherKey_color).toEqual('red');
199
+      expect(node.data.options.otherKey_color).toEqual('red');
200
     });
200
     });
201
 
201
 
202
     it('any nested recursive keys ending with Color', () => {
202
     it('any nested recursive keys ending with Color', () => {
203
-      navigationOptions.innerObj = { theKeyColor: 'red' };
204
-      navigationOptions.innerObj.innerMostObj = { anotherColor: 'yellow' };
203
+      options.innerObj = { theKeyColor: 'red' };
204
+      options.innerObj.innerMostObj = { anotherColor: 'yellow' };
205
       uut.crawl(node);
205
       uut.crawl(node);
206
-      expect(node.data.navigationOptions.innerObj.theKeyColor).toEqual(0xffff0000);
207
-      expect(node.data.navigationOptions.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
206
+      expect(node.data.options.innerObj.theKeyColor).toEqual(0xffff0000);
207
+      expect(node.data.options.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
208
     });
208
     });
209
   });
209
   });
210
 });
210
 });

+ 4
- 4
lib/src/commands/OptionsProcessor.js View File

3
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
3
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
4
 
4
 
5
 class OptionsProcessor {
5
 class OptionsProcessor {
6
-  static processOptions(navigationOptions) {
7
-    _.forEach(navigationOptions, (value, key) => {
6
+  static processOptions(options) {
7
+    _.forEach(options, (value, key) => {
8
       if (value) {
8
       if (value) {
9
         if (_.endsWith(key, 'Color')) {
9
         if (_.endsWith(key, 'Color')) {
10
-          navigationOptions[key] = processColor(value);
10
+          options[key] = processColor(value);
11
         }
11
         }
12
         if (_.isEqual(key, 'icon') || _.endsWith(key, 'Icon') || _.endsWith(key, 'Image')) {
12
         if (_.isEqual(key, 'icon') || _.endsWith(key, 'Icon') || _.endsWith(key, 'Image')) {
13
-          navigationOptions[key] = resolveAssetSource(navigationOptions[key]);
13
+          options[key] = resolveAssetSource(options[key]);
14
         }
14
         }
15
         if (_.isObject(value) || _.isArray(value)) {
15
         if (_.isObject(value) || _.isArray(value)) {
16
           OptionsProcessor.processOptions(value);
16
           OptionsProcessor.processOptions(value);

+ 55
- 55
lib/src/commands/OptionsProcessor.test.js View File

1
 const OptionsProcessor = require('./OptionsProcessor');
1
 const OptionsProcessor = require('./OptionsProcessor');
2
-const NavigationOptions = require('./../params/options/NavigationOptions');
2
+const Options = require('./../params/options/Options');
3
 
3
 
4
 describe('navigation options', () => {
4
 describe('navigation options', () => {
5
-  let navigationOptions;
5
+  let options;
6
 
6
 
7
   beforeEach(() => {
7
   beforeEach(() => {
8
-    navigationOptions = {};
8
+    options = {};
9
   });
9
   });
10
 
10
 
11
   it('processes colors into numeric AARRGGBB', () => {
11
   it('processes colors into numeric AARRGGBB', () => {
12
-    navigationOptions.someKeyColor = 'red';
13
-    OptionsProcessor.processOptions(navigationOptions);
14
-    expect(navigationOptions.someKeyColor).toEqual(0xffff0000);
12
+    options.someKeyColor = 'red';
13
+    OptionsProcessor.processOptions(options);
14
+    expect(options.someKeyColor).toEqual(0xffff0000);
15
 
15
 
16
-    navigationOptions.someKeyColor = 'yellow';
17
-    OptionsProcessor.processOptions(navigationOptions);
18
-    expect(navigationOptions.someKeyColor).toEqual(0xffffff00);
16
+    options.someKeyColor = 'yellow';
17
+    OptionsProcessor.processOptions(options);
18
+    expect(options.someKeyColor).toEqual(0xffffff00);
19
   });
19
   });
20
 
20
 
21
   it('processes numeric colors', () => {
21
   it('processes numeric colors', () => {
22
-    navigationOptions.someKeyColor = '#123456';
23
-    OptionsProcessor.processOptions(navigationOptions);
24
-    expect(navigationOptions.someKeyColor).toEqual(0xff123456);
22
+    options.someKeyColor = '#123456';
23
+    OptionsProcessor.processOptions(options);
24
+    expect(options.someKeyColor).toEqual(0xff123456);
25
 
25
 
26
-    navigationOptions.someKeyColor = 0x123456ff; // wut
27
-    OptionsProcessor.processOptions(navigationOptions);
28
-    expect(navigationOptions.someKeyColor).toEqual(0xff123456);
26
+    options.someKeyColor = 0x123456ff; // wut
27
+    OptionsProcessor.processOptions(options);
28
+    expect(options.someKeyColor).toEqual(0xff123456);
29
   });
29
   });
30
 
30
 
31
   it('process colors with rgb functions', () => {
31
   it('process colors with rgb functions', () => {
32
-    navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
33
-    OptionsProcessor.processOptions(navigationOptions);
34
-    expect(navigationOptions.someKeyColor).toEqual(0xffff00ff);
32
+    options.someKeyColor = 'rgb(255, 0, 255)';
33
+    OptionsProcessor.processOptions(options);
34
+    expect(options.someKeyColor).toEqual(0xffff00ff);
35
   });
35
   });
36
 
36
 
37
   it('process colors with special words', () => {
37
   it('process colors with special words', () => {
38
-    navigationOptions.someKeyColor = 'fuchsia';
39
-    OptionsProcessor.processOptions(navigationOptions);
40
-    expect(navigationOptions.someKeyColor).toEqual(0xffff00ff);
38
+    options.someKeyColor = 'fuchsia';
39
+    OptionsProcessor.processOptions(options);
40
+    expect(options.someKeyColor).toEqual(0xffff00ff);
41
   });
41
   });
42
 
42
 
43
   it('process colors with hsla functions', () => {
43
   it('process colors with hsla functions', () => {
44
-    navigationOptions.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
45
-    OptionsProcessor.processOptions(navigationOptions);
44
+    options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
45
+    OptionsProcessor.processOptions(options);
46
 
46
 
47
-    expect(navigationOptions.someKeyColor).toEqual(0xffffffff);
47
+    expect(options.someKeyColor).toEqual(0xffffffff);
48
   });
48
   });
49
 
49
 
50
   it('unknown colors return undefined', () => {
50
   it('unknown colors return undefined', () => {
51
-    navigationOptions.someKeyColor = 'wut';
52
-    OptionsProcessor.processOptions(navigationOptions);
53
-    expect(navigationOptions.someKeyColor).toEqual(undefined);
51
+    options.someKeyColor = 'wut';
52
+    OptionsProcessor.processOptions(options);
53
+    expect(options.someKeyColor).toEqual(undefined);
54
   });
54
   });
55
 
55
 
56
   it('any keys ending with Color', () => {
56
   it('any keys ending with Color', () => {
57
-    navigationOptions.otherKeyColor = 'red';
58
-    navigationOptions.yetAnotherColor = 'blue';
59
-    navigationOptions.andAnotherColor = 'rgb(0, 255, 0)';
60
-    OptionsProcessor.processOptions(navigationOptions);
61
-    expect(navigationOptions.otherKeyColor).toEqual(0xffff0000);
62
-    expect(navigationOptions.yetAnotherColor).toEqual(0xff0000ff);
63
-    expect(navigationOptions.andAnotherColor).toEqual(0xff00ff00);
57
+    options.otherKeyColor = 'red';
58
+    options.yetAnotherColor = 'blue';
59
+    options.andAnotherColor = 'rgb(0, 255, 0)';
60
+    OptionsProcessor.processOptions(options);
61
+    expect(options.otherKeyColor).toEqual(0xffff0000);
62
+    expect(options.yetAnotherColor).toEqual(0xff0000ff);
63
+    expect(options.andAnotherColor).toEqual(0xff00ff00);
64
   });
64
   });
65
 
65
 
66
   it('keys ending with Color case sensitive', () => {
66
   it('keys ending with Color case sensitive', () => {
67
-    navigationOptions.otherKey_color = 'red'; // eslint-disable-line camelcase
68
-    OptionsProcessor.processOptions(navigationOptions);
69
-    expect(navigationOptions.otherKey_color).toEqual('red');
67
+    options.otherKey_color = 'red'; // eslint-disable-line camelcase
68
+    OptionsProcessor.processOptions(options);
69
+    expect(options.otherKey_color).toEqual('red');
70
   });
70
   });
71
 
71
 
72
   it('any nested recursive keys ending with Color', () => {
72
   it('any nested recursive keys ending with Color', () => {
73
-    navigationOptions.topBar = { textColor: 'red' };
74
-    navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
75
-    OptionsProcessor.processOptions(navigationOptions);
76
-    expect(navigationOptions.topBar.textColor).toEqual(0xffff0000);
77
-    expect(navigationOptions.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
73
+    options.topBar = { textColor: 'red' };
74
+    options.topBar.innerMostObj = { anotherColor: 'yellow' };
75
+    OptionsProcessor.processOptions(options);
76
+    expect(options.topBar.textColor).toEqual(0xffff0000);
77
+    expect(options.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
78
   });
78
   });
79
 
79
 
80
   it('resolve image sources with name/ending with icon', () => {
80
   it('resolve image sources with name/ending with icon', () => {
81
-    navigationOptions.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
82
-    navigationOptions.topBar = {
81
+    options.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
82
+    options.topBar = {
83
       myIcon: 'require("https://wix.github.io/react-native-navigation/_images/logo.png");',
83
       myIcon: 'require("https://wix.github.io/react-native-navigation/_images/logo.png");',
84
       myOtherValue: 'value'
84
       myOtherValue: 'value'
85
     };
85
     };
86
-    OptionsProcessor.processOptions(navigationOptions);
86
+    OptionsProcessor.processOptions(options);
87
 
87
 
88
     // As we can't import external images and we don't want to add an image here
88
     // As we can't import external images and we don't want to add an image here
89
     // I assign the icons to strings (what the require would generally look like)
89
     // I assign the icons to strings (what the require would generally look like)
90
     // and expect the value to be resovled, in this case it doesn't find anything and returns null
90
     // and expect the value to be resovled, in this case it doesn't find anything and returns null
91
-    expect(navigationOptions.icon).toEqual(null);
92
-    expect(navigationOptions.topBar.myIcon).toEqual(null);
93
-    expect(navigationOptions.topBar.myOtherValue).toEqual('value');
91
+    expect(options.icon).toEqual(null);
92
+    expect(options.topBar.myIcon).toEqual(null);
93
+    expect(options.topBar.myOtherValue).toEqual('value');
94
   });
94
   });
95
 
95
 
96
   it('processes NavigationOptions jsDoc object', () => {
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);
97
+    options.someKeyColor = 'rgb(255, 0, 255)';
98
+    options.topBar = { textColor: 'red' };
99
+    options.topBar.innerMostObj = { anotherColor: 'yellow' };
100
+    const navigationOptionsObj = new Options(options);
101
 
101
 
102
     OptionsProcessor.processOptions(navigationOptionsObj);
102
     OptionsProcessor.processOptions(navigationOptionsObj);
103
 
103
 
105
   });
105
   });
106
 
106
 
107
   it('undefined value return undefined ', () => {
107
   it('undefined value return undefined ', () => {
108
-    navigationOptions.someImage = undefined;
109
-    OptionsProcessor.processOptions(navigationOptions);
108
+    options.someImage = undefined;
109
+    OptionsProcessor.processOptions(options);
110
 
110
 
111
-    expect(navigationOptions.someImage).toEqual(undefined);
111
+    expect(options.someImage).toEqual(undefined);
112
   });
112
   });
113
 });
113
 });

+ 3
- 3
lib/src/params/containers/Container.js View File

1
-const NavigationOptions = require('./../options/NavigationOptions');
1
+const Options = require('./../options/Options');
2
 
2
 
3
 class Container {
3
 class Container {
4
   /**
4
   /**
5
    * @property {string} name The container's registered name
5
    * @property {string} name The container's registered name
6
    * @property {Container[]} [topTabs]
6
    * @property {Container[]} [topTabs]
7
    * @property {object} [passProps] props
7
    * @property {object} [passProps] props
8
-   * @property {NavigationOptions} navigationOptions
8
+   * @property {Options} options
9
    */
9
    */
10
   constructor(params) {
10
   constructor(params) {
11
     this.name = params.name;
11
     this.name = params.name;
14
       this.topTabs = params.topTabs;
14
       this.topTabs = params.topTabs;
15
     }
15
     }
16
     this.passProps = params.passProps;
16
     this.passProps = params.passProps;
17
-    this.navigationOptions = params.navigationOptions && new NavigationOptions(params.navigationOptions);
17
+    this.options = params.options && new Options(params.options);
18
   }
18
   }
19
 }
19
 }
20
 
20
 

+ 2
- 2
lib/src/params/containers/Container.test.js View File

6
 const CONTAINER = {
6
 const CONTAINER = {
7
   name: 'myScreen',
7
   name: 'myScreen',
8
   passProps: PASS_PROPS,
8
   passProps: PASS_PROPS,
9
-  navigationOptions: {}
9
+  options: {}
10
 };
10
 };
11
 const TOP_TABS_CONTAINER = {
11
 const TOP_TABS_CONTAINER = {
12
   topTabs: [
12
   topTabs: [
20
     const uut = new Container(CONTAINER);
20
     const uut = new Container(CONTAINER);
21
     expect(uut.name).toBe('myScreen');
21
     expect(uut.name).toBe('myScreen');
22
     expect(uut.passProps).toEqual(PASS_PROPS);
22
     expect(uut.passProps).toEqual(PASS_PROPS);
23
-    expect(uut.navigationOptions).toEqual({});
23
+    expect(uut.options).toEqual({});
24
   });
24
   });
25
 
25
 
26
   it('parses TopTabs container', () => {
26
   it('parses TopTabs container', () => {

lib/src/params/options/NavigationOptions.js → lib/src/params/options/Options.js View File


lib/src/params/options/NavigationOptions.test.js → lib/src/params/options/Options.test.js View File

1
-const NavigationOptions = require('./NavigationOptions');
1
+const NavigationOptions = require('./Options');
2
 const BottomTabs = require('./BottomTabs');
2
 const BottomTabs = require('./BottomTabs');
3
 const TopBar = require('./TopBar');
3
 const TopBar = require('./TopBar');
4
 const BottomTab = require('./BottomTab');
4
 const BottomTab = require('./BottomTab');
38
 };
38
 };
39
 
39
 
40
 describe('NavigationOptions', () => {
40
 describe('NavigationOptions', () => {
41
-  it('parses navigationOptions correctly', () => {
41
+  it('parses options correctly', () => {
42
     const uut = new NavigationOptions(NAVIGATION_OPTIONS);
42
     const uut = new NavigationOptions(NAVIGATION_OPTIONS);
43
     expect(uut.bottomTabs).toBeInstanceOf(BottomTabs);
43
     expect(uut.bottomTabs).toBeInstanceOf(BottomTabs);
44
     expect(uut.topBar).toBeInstanceOf(TopBar);
44
     expect(uut.topBar).toBeInstanceOf(TopBar);