瀏覽代碼

continue rename

Daniel Zlotin 6 年之前
父節點
當前提交
ab7f295042

+ 13
- 13
lib/src/adapters/NativeCommandsSender.js 查看文件

@@ -13,25 +13,25 @@ class NativeCommandsSender {
13 13
     this.nativeCommandsModule.setDefaultOptions(options);
14 14
   }
15 15
 
16
-  setOptions(containerId, options) {
17
-    this.nativeCommandsModule.setOptions(containerId, options);
16
+  setOptions(componentId, options) {
17
+    this.nativeCommandsModule.setOptions(componentId, options);
18 18
   }
19 19
 
20
-  async push(onContainerId, layout) {
21
-    const pushedContainerId = await this.nativeCommandsModule.push(onContainerId, layout);
22
-    return pushedContainerId;
20
+  async push(onComponentId, layout) {
21
+    const pushedComponentId = await this.nativeCommandsModule.push(onComponentId, layout);
22
+    return pushedComponentId;
23 23
   }
24 24
 
25
-  pop(containerId, options) {
26
-    return this.nativeCommandsModule.pop(containerId, options);
25
+  pop(componentId, options) {
26
+    return this.nativeCommandsModule.pop(componentId, options);
27 27
   }
28 28
 
29
-  popTo(containerId) {
30
-    return this.nativeCommandsModule.popTo(containerId);
29
+  popTo(componentId) {
30
+    return this.nativeCommandsModule.popTo(componentId);
31 31
   }
32 32
 
33
-  popToRoot(containerId) {
34
-    return this.nativeCommandsModule.popToRoot(containerId);
33
+  popToRoot(componentId) {
34
+    return this.nativeCommandsModule.popToRoot(componentId);
35 35
   }
36 36
 
37 37
   async showModal(layout) {
@@ -39,8 +39,8 @@ class NativeCommandsSender {
39 39
     return completed;
40 40
   }
41 41
 
42
-  dismissModal(containerId) {
43
-    return this.nativeCommandsModule.dismissModal(containerId);
42
+  dismissModal(componentId) {
43
+    return this.nativeCommandsModule.dismissModal(componentId);
44 44
   }
45 45
 
46 46
   dismissAllModals() {

+ 4
- 4
lib/src/adapters/NativeEventsReceiver.js 查看文件

@@ -5,12 +5,12 @@ class NativeEventsReceiver {
5 5
     this.emitter = new NativeEventEmitter(NativeModules.RNNEventEmitter);
6 6
   }
7 7
 
8
-  containerDidAppear(callback) {
9
-    this.emitter.addListener('RNN.containerDidAppear', callback);
8
+  componentDidAppear(callback) {
9
+    this.emitter.addListener('RNN.componentDidAppear', callback);
10 10
   }
11 11
 
12
-  containerDidDisappear(callback) {
13
-    this.emitter.addListener('RNN.containerDidDisappear', callback);
12
+  componentDidDisappear(callback) {
13
+    this.emitter.addListener('RNN.componentDidDisappear', callback);
14 14
   }
15 15
 
16 16
   appLaunched(callback) {

+ 12
- 12
lib/src/commands/Commands.js 查看文件

@@ -21,10 +21,10 @@ class Commands {
21 21
     this.nativeCommandsSender.setDefaultOptions(input);
22 22
   }
23 23
 
24
-  setOptions(containerId, options) {
24
+  setOptions(componentId, options) {
25 25
     const input = _.cloneDeep(options);
26 26
     OptionsProcessor.processOptions(input);
27
-    this.nativeCommandsSender.setOptions(containerId, input);
27
+    this.nativeCommandsSender.setOptions(componentId, input);
28 28
   }
29 29
 
30 30
   showModal(simpleApi) {
@@ -42,30 +42,30 @@ class Commands {
42 42
     return this.nativeCommandsSender.dismissAllModals();
43 43
   }
44 44
 
45
-  push(onContainerId, containerData) {
46
-    const input = _.cloneDeep(containerData);
45
+  push(onComponentId, componentData) {
46
+    const input = _.cloneDeep(componentData);
47 47
     OptionsProcessor.processOptions(input);
48 48
     const layout = this.layoutTreeParser.parse(input);
49 49
     this.layoutTreeCrawler.crawl(layout);
50
-    return this.nativeCommandsSender.push(onContainerId, layout);
50
+    return this.nativeCommandsSender.push(onComponentId, layout);
51 51
   }
52 52
 
53
-  pop(containerId, options) {
54
-    return this.nativeCommandsSender.pop(containerId, options);
53
+  pop(componentId, options) {
54
+    return this.nativeCommandsSender.pop(componentId, options);
55 55
   }
56 56
 
57
-  popTo(containerId) {
58
-    return this.nativeCommandsSender.popTo(containerId);
57
+  popTo(componentId) {
58
+    return this.nativeCommandsSender.popTo(componentId);
59 59
   }
60 60
 
61
-  popToRoot(containerId) {
62
-    return this.nativeCommandsSender.popToRoot(containerId);
61
+  popToRoot(componentId) {
62
+    return this.nativeCommandsSender.popToRoot(componentId);
63 63
   }
64 64
 
65 65
   // showOverlay(type, options) {
66 66
     // let promise;
67 67
     // if (type === 'custom') {
68
-    //   const layout = this.layoutTreeParser.createDialogContainer({ name: options });
68
+    //   const layout = this.layoutTreeParser.createDialogComponent({ name: options });
69 69
     //   this.layoutTreeCrawler.crawl(layout);
70 70
     //   promise = this.nativeCommandsSender.showOverlay(type, layout);
71 71
     // } else {

+ 38
- 38
lib/src/commands/Commands.test.js 查看文件

@@ -1,6 +1,6 @@
1 1
 const LayoutTreeParser = require('./LayoutTreeParser');
2 2
 const LayoutTreeCrawler = require('./LayoutTreeCrawler');
3
-const Store = require('../containers/Store');
3
+const Store = require('../components/Store');
4 4
 const UniqueIdProvider = require('../adapters/UniqueIdProvider.mock');
5 5
 const NativeCommandsSender = require('../adapters/NativeCommandsSender.mock');
6 6
 const Commands = require('./Commands');
@@ -42,14 +42,14 @@ describe('Commands', () => {
42 42
       expect(mockCommandsSender.setRoot.mock.calls[0][0].data.inner).not.toBe(obj);
43 43
     });
44 44
 
45
-    it('passProps into containers', () => {
45
+    it('passProps into components', () => {
46 46
       const passProps = {
47 47
         fn: () => 'Hello'
48 48
       };
49
-      expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({});
49
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
50 50
       uut.setRoot({ component: { name: 'asd', passProps } });
51
-      expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual(passProps);
52
-      expect(store.getPropsForContainerId('Component+UNIQUE_ID').fn()).toEqual('Hello');
51
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual(passProps);
52
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID').fn()).toEqual('Hello');
53 53
     });
54 54
 
55 55
     it('returns a promise with the resolved layout', async () => {
@@ -62,14 +62,14 @@ describe('Commands', () => {
62 62
   describe('setOptions', () => {
63 63
     it('deep clones input to avoid mutation errors', () => {
64 64
       const obj = { title: 'test' };
65
-      uut.setOptions('theContainerId', obj);
65
+      uut.setOptions('theComponentId', obj);
66 66
       expect(mockCommandsSender.setOptions.mock.calls[0][1]).not.toBe(obj);
67 67
     });
68 68
 
69
-    it('passes options for container', () => {
70
-      uut.setOptions('theContainerId', { title: '1' });
69
+    it('passes options for component', () => {
70
+      uut.setOptions('theComponentId', { title: '1' });
71 71
       expect(mockCommandsSender.setOptions).toHaveBeenCalledTimes(1);
72
-      expect(mockCommandsSender.setOptions).toHaveBeenCalledWith('theContainerId', { title: '1' });
72
+      expect(mockCommandsSender.setOptions).toHaveBeenCalledWith('theComponentId', { title: '1' });
73 73
     });
74 74
   });
75 75
 
@@ -106,18 +106,18 @@ describe('Commands', () => {
106 106
       expect(mockCommandsSender.showModal.mock.calls[0][0].data.inner).not.toBe(obj);
107 107
     });
108 108
 
109
-    it('passProps into containers', () => {
109
+    it('passProps into components', () => {
110 110
       const passProps = {
111 111
         fn: () => 'hello'
112 112
       };
113
-      expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({});
113
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
114 114
       uut.showModal({
115 115
         component: {
116 116
           name: 'com.example.MyScreen',
117 117
           passProps
118 118
         }
119 119
       });
120
-      expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual(passProps);
120
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual(passProps);
121 121
     });
122 122
 
123 123
     it('returns a promise with the resolved layout', async () => {
@@ -158,20 +158,20 @@ describe('Commands', () => {
158 158
   describe('push', () => {
159 159
     it('deep clones input to avoid mutation errors', () => {
160 160
       const obj = {};
161
-      uut.push('theContainerId', { component: { name: 'name', passProps: { foo: obj } } });
161
+      uut.push('theComponentId', { component: { name: 'name', passProps: { foo: obj } } });
162 162
       expect(mockCommandsSender.push.mock.calls[0][1].data.passProps.foo).not.toBe(obj);
163 163
     });
164 164
 
165 165
     it('resolves with the parsed layout', async () => {
166 166
       mockCommandsSender.push.mockReturnValue(Promise.resolve('the resolved layout'));
167
-      const result = await uut.push('theContainerId', { component: { name: 'com.example.MyScreen' } });
167
+      const result = await uut.push('theComponentId', { component: { name: 'com.example.MyScreen' } });
168 168
       expect(result).toEqual('the resolved layout');
169 169
     });
170 170
 
171 171
     it('parses into correct layout node and sends to native', () => {
172
-      uut.push('theContainerId', { component: { name: 'com.example.MyScreen' } });
172
+      uut.push('theComponentId', { component: { name: 'com.example.MyScreen' } });
173 173
       expect(mockCommandsSender.push).toHaveBeenCalledTimes(1);
174
-      expect(mockCommandsSender.push).toHaveBeenCalledWith('theContainerId', {
174
+      expect(mockCommandsSender.push).toHaveBeenCalledWith('theComponentId', {
175 175
         type: 'Component',
176 176
         id: 'Component+UNIQUE_ID',
177 177
         data: {
@@ -184,12 +184,12 @@ describe('Commands', () => {
184 184
   });
185 185
 
186 186
   describe('pop', () => {
187
-    it('pops a container, passing containerId', () => {
188
-      uut.pop('theContainerId');
187
+    it('pops a component, passing componentId', () => {
188
+      uut.pop('theComponentId');
189 189
       expect(mockCommandsSender.pop).toHaveBeenCalledTimes(1);
190
-      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theContainerId', undefined);
190
+      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theComponentId', undefined);
191 191
     });
192
-    it('pops a container, passing containerId and options', () => {
192
+    it('pops a component, passing componentId and options', () => {
193 193
       const options = {
194 194
         customTransition: {
195 195
           animations: [
@@ -198,43 +198,43 @@ describe('Commands', () => {
198 198
           duration: 0.8
199 199
         }
200 200
       };
201
-      uut.pop('theContainerId', options);
201
+      uut.pop('theComponentId', options);
202 202
       expect(mockCommandsSender.pop).toHaveBeenCalledTimes(1);
203
-      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theContainerId', options);
203
+      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theComponentId', options);
204 204
     });
205 205
 
206
-    it('pop returns a promise that resolves to containerId', async () => {
207
-      mockCommandsSender.pop.mockReturnValue(Promise.resolve('theContainerId'));
208
-      const result = await uut.pop('theContainerId');
209
-      expect(result).toEqual('theContainerId');
206
+    it('pop returns a promise that resolves to componentId', async () => {
207
+      mockCommandsSender.pop.mockReturnValue(Promise.resolve('theComponentId'));
208
+      const result = await uut.pop('theComponentId');
209
+      expect(result).toEqual('theComponentId');
210 210
     });
211 211
   });
212 212
 
213 213
   describe('popTo', () => {
214
-    it('pops all containers until the passed Id is top', () => {
215
-      uut.popTo('theContainerId');
214
+    it('pops all components until the passed Id is top', () => {
215
+      uut.popTo('theComponentId');
216 216
       expect(mockCommandsSender.popTo).toHaveBeenCalledTimes(1);
217
-      expect(mockCommandsSender.popTo).toHaveBeenCalledWith('theContainerId');
217
+      expect(mockCommandsSender.popTo).toHaveBeenCalledWith('theComponentId');
218 218
     });
219 219
 
220 220
     it('returns a promise that resolves to targetId', async () => {
221
-      mockCommandsSender.popTo.mockReturnValue(Promise.resolve('theContainerId'));
222
-      const result = await uut.popTo('theContainerId');
223
-      expect(result).toEqual('theContainerId');
221
+      mockCommandsSender.popTo.mockReturnValue(Promise.resolve('theComponentId'));
222
+      const result = await uut.popTo('theComponentId');
223
+      expect(result).toEqual('theComponentId');
224 224
     });
225 225
   });
226 226
 
227 227
   describe('popToRoot', () => {
228
-    it('pops all containers to root', () => {
229
-      uut.popToRoot('theContainerId');
228
+    it('pops all components to root', () => {
229
+      uut.popToRoot('theComponentId');
230 230
       expect(mockCommandsSender.popToRoot).toHaveBeenCalledTimes(1);
231
-      expect(mockCommandsSender.popToRoot).toHaveBeenCalledWith('theContainerId');
231
+      expect(mockCommandsSender.popToRoot).toHaveBeenCalledWith('theComponentId');
232 232
     });
233 233
 
234 234
     it('returns a promise that resolves to targetId', async () => {
235
-      mockCommandsSender.popToRoot.mockReturnValue(Promise.resolve('theContainerId'));
236
-      const result = await uut.popToRoot('theContainerId');
237
-      expect(result).toEqual('theContainerId');
235
+      mockCommandsSender.popToRoot.mockReturnValue(Promise.resolve('theComponentId'));
236
+      const result = await uut.popToRoot('theComponentId');
237
+      expect(result).toEqual('theComponentId');
238 238
     });
239 239
   });
240 240
 

+ 8
- 8
lib/src/commands/LayoutTreeCrawler.js 查看文件

@@ -15,24 +15,24 @@ class LayoutTreeCrawler {
15 15
     node.data = node.data || {};
16 16
     node.children = node.children || [];
17 17
     if (_.isEqual(node.type, LayoutTypes.Component)) {
18
-      this._handleContainer(node);
18
+      this._handleComponent(node);
19 19
     }
20 20
     _.forEach(node.children, this.crawl);
21 21
   }
22 22
 
23
-  _handleContainer(node) {
24
-    this._assertContainerDataName(node);
23
+  _handleComponent(node) {
24
+    this._assertComponentDataName(node);
25 25
     this._savePropsToStore(node);
26 26
     this._applyStaticOptions(node);
27 27
     OptionsProcessor.processOptions(node.data.options);
28 28
   }
29 29
 
30 30
   _savePropsToStore(node) {
31
-    this.store.setPropsForContainerId(node.id, node.data.passProps);
31
+    this.store.setPropsForComponentId(node.id, node.data.passProps);
32 32
   }
33 33
 
34 34
   _applyStaticOptions(node) {
35
-    const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
35
+    const clazz = this.store.getOriginalComponentClassForName(node.data.name) || {};
36 36
     const staticOptions = _.cloneDeep(clazz.options) || {};
37 37
     const passedOptions = node.data.options || {};
38 38
     node.data.options = _.merge({}, staticOptions, passedOptions);
@@ -44,9 +44,9 @@ class LayoutTreeCrawler {
44 44
     }
45 45
   }
46 46
 
47
-  _assertContainerDataName(container) {
48
-    if (!container.data.name) {
49
-      throw new Error('Missing container data.name');
47
+  _assertComponentDataName(component) {
48
+    if (!component.data.name) {
49
+      throw new Error('Missing component data.name');
50 50
     }
51 51
   }
52 52
 }

+ 21
- 21
lib/src/commands/LayoutTreeCrawler.test.js 查看文件

@@ -1,6 +1,6 @@
1 1
 const LayoutTypes = require('./LayoutTypes');
2 2
 const LayoutTreeCrawler = require('./LayoutTreeCrawler');
3
-const Store = require('../containers/Store');
3
+const Store = require('../components/Store');
4 4
 const UniqueIdProvider = require('../adapters/UniqueIdProvider.mock');
5 5
 
6 6
 describe('LayoutTreeCrawler', () => {
@@ -42,26 +42,26 @@ describe('LayoutTreeCrawler', () => {
42 42
       type: LayoutTypes.BottomTabs, children: [
43 43
         { type: LayoutTypes.Component, data: { name: 'the name', passProps: { myProp: 123 } } }]
44 44
     };
45
-    expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({});
45
+    expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
46 46
     uut.crawl(node);
47
-    expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
47
+    expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
48 48
   });
49 49
 
50
-  it('Containers: injects options from original container class static property', () => {
50
+  it('Components: injects options from original component class static property', () => {
51 51
     const theStyle = {};
52
-    const MyContainer = class {
52
+    const MyComponent = class {
53 53
       static get options() {
54 54
         return theStyle;
55 55
       }
56 56
     };
57 57
 
58
-    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
59
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
58
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
59
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
60 60
     uut.crawl(node);
61 61
     expect(node.data.options).toEqual(theStyle);
62 62
   });
63 63
 
64
-  it('Containers: merges options from container class static property with passed options, favoring passed options', () => {
64
+  it('Components: merges options from component class static property with passed options, favoring passed options', () => {
65 65
     const theStyle = {
66 66
       bazz: 123,
67 67
       inner: {
@@ -69,7 +69,7 @@ describe('LayoutTreeCrawler', () => {
69 69
       },
70 70
       opt: 'exists only in static'
71 71
     };
72
-    const MyContainer = class {
72
+    const MyComponent = class {
73 73
       static get options() {
74 74
         return theStyle;
75 75
       }
@@ -83,8 +83,8 @@ describe('LayoutTreeCrawler', () => {
83 83
       }
84 84
     };
85 85
 
86
-    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options: passedOptions } };
87
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
86
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName', options: passedOptions } };
87
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
88 88
 
89 89
     uut.crawl(node);
90 90
 
@@ -100,28 +100,28 @@ describe('LayoutTreeCrawler', () => {
100 100
 
101 101
   it('Component: deepClones options', () => {
102 102
     const theStyle = {};
103
-    const MyContainer = class {
103
+    const MyComponent = class {
104 104
       static get options() {
105 105
         return theStyle;
106 106
       }
107 107
     };
108 108
 
109
-    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
110
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
109
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
110
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
111 111
     uut.crawl(node);
112 112
     expect(node.data.options).not.toBe(theStyle);
113 113
   });
114 114
 
115
-  it('Containers: must contain data name', () => {
115
+  it('Components: must contain data name', () => {
116 116
     const node = { type: LayoutTypes.Component, data: {} };
117
-    expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
117
+    expect(() => uut.crawl(node)).toThrow(new Error('Missing component data.name'));
118 118
   });
119 119
 
120
-  it('Containers: options default obj', () => {
121
-    const MyContainer = class { };
120
+  it('Components: options default obj', () => {
121
+    const MyComponent = class { };
122 122
 
123
-    const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
124
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
123
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
124
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
125 125
     uut.crawl(node);
126 126
     expect(node.data.options).toEqual({});
127 127
   });
@@ -132,7 +132,7 @@ describe('LayoutTreeCrawler', () => {
132 132
 
133 133
     beforeEach(() => {
134 134
       options = {};
135
-      node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options } };
135
+      node = { type: LayoutTypes.Component, data: { name: 'theComponentName', options } };
136 136
     });
137 137
 
138 138
     it('processes colors into numeric AARRGGBB', () => {

+ 15
- 15
lib/src/components/ComponentRegistry.test.js 查看文件

@@ -3,14 +3,14 @@ const { Component } = require('react');
3 3
 const { AppRegistry, Text } = require('react-native');
4 4
 
5 5
 const renderer = require('react-test-renderer');
6
-const ContainerRegistry = require('./ContainerRegistry');
6
+const ComponentRegistry = require('./ComponentRegistry');
7 7
 const Store = require('./Store');
8 8
 
9
-describe('ContainerRegistry', () => {
9
+describe('ComponentRegistry', () => {
10 10
   let uut;
11 11
   let store;
12 12
 
13
-  class MyContainer extends Component {
13
+  class MyComponent extends Component {
14 14
     render() {
15 15
       return <Text>{'Hello, World!'}</Text>;
16 16
     }
@@ -19,29 +19,29 @@ describe('ContainerRegistry', () => {
19 19
   beforeEach(() => {
20 20
     store = new Store();
21 21
     AppRegistry.registerComponent = jest.fn(AppRegistry.registerComponent);
22
-    uut = new ContainerRegistry(store);
22
+    uut = new ComponentRegistry(store);
23 23
   });
24 24
 
25
-  it('registers container component by containerName into AppRegistry', () => {
25
+  it('registers component component by componentName into AppRegistry', () => {
26 26
     expect(AppRegistry.registerComponent).not.toHaveBeenCalled();
27
-    uut.registerContainer('example.MyContainer.name', () => MyContainer);
27
+    uut.registerComponent('example.MyComponent.name', () => MyComponent);
28 28
     expect(AppRegistry.registerComponent).toHaveBeenCalledTimes(1);
29
-    expect(AppRegistry.registerComponent.mock.calls[0][0]).toEqual('example.MyContainer.name');
29
+    expect(AppRegistry.registerComponent.mock.calls[0][0]).toEqual('example.MyComponent.name');
30 30
   });
31 31
 
32
-  it('saves the original container into the store', () => {
33
-    expect(store.getOriginalContainerClassForName('example.MyContainer.name')).toBeUndefined();
34
-    uut.registerContainer('example.MyContainer.name', () => MyContainer);
35
-    const Class = store.getOriginalContainerClassForName('example.MyContainer.name');
32
+  it('saves the original component into the store', () => {
33
+    expect(store.getOriginalComponentClassForName('example.MyComponent.name')).toBeUndefined();
34
+    uut.registerComponent('example.MyComponent.name', () => MyComponent);
35
+    const Class = store.getOriginalComponentClassForName('example.MyComponent.name');
36 36
     expect(Class).not.toBeUndefined();
37
-    expect(Class).toEqual(MyContainer);
37
+    expect(Class).toEqual(MyComponent);
38 38
     expect(Object.getPrototypeOf(Class)).toEqual(Component);
39 39
   });
40 40
 
41 41
   it('resulting in a normal component', () => {
42
-    uut.registerContainer('example.MyContainer.name', () => MyContainer);
43
-    const Container = AppRegistry.registerComponent.mock.calls[0][1]();
44
-    const tree = renderer.create(<Container containerId="123" />);
42
+    uut.registerComponent('example.MyComponent.name', () => MyComponent);
43
+    const Component = AppRegistry.registerComponent.mock.calls[0][1]();
44
+    const tree = renderer.create(<Component componentId="123" />);
45 45
     expect(tree.toJSON().children).toEqual(['Hello, World!']);
46 46
   });
47 47
 });

+ 3
- 3
lib/src/events/PrivateEventsListener.js 查看文件

@@ -1,4 +1,4 @@
1
-const Lifecycle = require('../containers/Lifecycle');
1
+const Lifecycle = require('../components/Lifecycle');
2 2
 
3 3
 class PrivateEventsListener {
4 4
   constructor(nativeEventsReceiver, store) {
@@ -7,8 +7,8 @@ class PrivateEventsListener {
7 7
   }
8 8
 
9 9
   listenAndHandlePrivateEvents() {
10
-    this.nativeEventsReceiver.containerDidAppear(this.lifecycle.containerDidAppear);
11
-    this.nativeEventsReceiver.containerDidDisappear(this.lifecycle.containerDidDisappear);
10
+    this.nativeEventsReceiver.componentDidAppear(this.lifecycle.componentDidAppear);
11
+    this.nativeEventsReceiver.componentDidDisappear(this.lifecycle.componentDidDisappear);
12 12
     this.nativeEventsReceiver.navigationButtonPressed(this.lifecycle.onNavigationButtonPressed);
13 13
   }
14 14
 }

+ 10
- 10
lib/src/events/PrivateEventsListener.test.js 查看文件

@@ -1,6 +1,6 @@
1 1
 const PrivateEventsListener = require('./PrivateEventsListener');
2 2
 const NativeEventsReceiver = require('../adapters/NativeEventsReceiver.mock');
3
-const Store = require('../containers/Store');
3
+const Store = require('../components/Store');
4 4
 
5 5
 describe('PrivateEventsListener', () => {
6 6
   let uut;
@@ -13,39 +13,39 @@ describe('PrivateEventsListener', () => {
13 13
     uut = new PrivateEventsListener(nativeEventsReceiver, store);
14 14
   });
15 15
 
16
-  it('register and handle containerDidAppear', () => {
16
+  it('register and handle componentDidAppear', () => {
17 17
     const mockRef = {
18 18
       didAppear: jest.fn()
19 19
     };
20
-    store.setRefForContainerId('myContainerId', mockRef);
20
+    store.setRefForComponentId('myComponentId', mockRef);
21 21
     uut.listenAndHandlePrivateEvents();
22
-    expect(nativeEventsReceiver.containerDidAppear).toHaveBeenCalledTimes(1);
23
-    const callbackFunction = nativeEventsReceiver.containerDidAppear.mock.calls[0][0];
22
+    expect(nativeEventsReceiver.componentDidAppear).toHaveBeenCalledTimes(1);
23
+    const callbackFunction = nativeEventsReceiver.componentDidAppear.mock.calls[0][0];
24 24
     expect(callbackFunction).toBeInstanceOf(Function);
25 25
 
26 26
     expect(mockRef.didAppear).not.toHaveBeenCalled();
27
-    callbackFunction('myContainerId');
27
+    callbackFunction('myComponentId');
28 28
 
29 29
     expect(mockRef.didAppear).toHaveBeenCalledTimes(1);
30 30
   });
31 31
 
32
-  it('register and listen containerDidDisappear', () => {
32
+  it('register and listen componentDidDisappear', () => {
33 33
     uut.listenAndHandlePrivateEvents();
34
-    expect(nativeEventsReceiver.containerDidDisappear).toHaveBeenCalledTimes(1);
34
+    expect(nativeEventsReceiver.componentDidDisappear).toHaveBeenCalledTimes(1);
35 35
   });
36 36
 
37 37
   it('register and handle onNavigationButtonPressed', () => {
38 38
     const mockRef = {
39 39
       onNavigationButtonPressed: jest.fn()
40 40
     };
41
-    store.setRefForContainerId('myContainerId', mockRef);
41
+    store.setRefForComponentId('myComponentId', mockRef);
42 42
     uut.listenAndHandlePrivateEvents();
43 43
     expect(nativeEventsReceiver.navigationButtonPressed).toHaveBeenCalledTimes(1);
44 44
     const callbackFunction = nativeEventsReceiver.navigationButtonPressed.mock.calls[0][0];
45 45
     expect(callbackFunction).toBeInstanceOf(Function);
46 46
 
47 47
     expect(mockRef.onNavigationButtonPressed).not.toHaveBeenCalled();
48
-    callbackFunction({ containerId: 'myContainerId', buttonId: 'myButtonId' });
48
+    callbackFunction({ componentId: 'myComponentId', buttonId: 'myButtonId' });
49 49
 
50 50
     expect(mockRef.onNavigationButtonPressed).toHaveBeenCalledTimes(1);
51 51
   });

+ 0
- 23
lib/src/xparams/containers/Container.js 查看文件

@@ -1,23 +0,0 @@
1
-const Options = require('./../options/Options');
2
-
3
-class Container {
4
-  /**
5
-   * @property {string} name The container's registered name
6
-   * @property {Container[]} [topTabs]
7
-   * @property {object} [passProps] props
8
-   * @property {object} [customTransition]
9
-   * @property {Options} options
10
-   */
11
-  constructor(params) {
12
-    this.name = params.name;
13
-    if (params.topTabs) {
14
-      params.topTabs.map((t) => new Container(t));
15
-      this.topTabs = params.topTabs;
16
-    }
17
-    this.passProps = params.passProps;
18
-    this.customTransition = params.customTransition;
19
-    this.options = params.options && new Options(params.options);
20
-  }
21
-}
22
-
23
-module.exports = Container;

+ 0
- 30
lib/src/xparams/containers/Container.test.js 查看文件

@@ -1,30 +0,0 @@
1
-const Container = require('./Container');
2
-
3
-const PASS_PROPS = {
4
-  number: 9
5
-};
6
-const CONTAINER = {
7
-  name: 'myScreen',
8
-  passProps: PASS_PROPS,
9
-  options: {}
10
-};
11
-const TOP_TABS_CONTAINER = {
12
-  topTabs: [
13
-    CONTAINER,
14
-    CONTAINER
15
-  ]
16
-};
17
-
18
-describe('ContainerRegistry', () => {
19
-  it('parses container correctly', () => {
20
-    const uut = new Container(CONTAINER);
21
-    expect(uut.name).toBe('myScreen');
22
-    expect(uut.passProps).toEqual(PASS_PROPS);
23
-    expect(uut.options).toEqual({});
24
-  });
25
-
26
-  it('parses TopTabs container', () => {
27
-    const uut = new Container(TOP_TABS_CONTAINER);
28
-    expect(uut.topTabs).toEqual([CONTAINER, CONTAINER]);
29
-  });
30
-});

+ 0
- 20
lib/src/xparams/containers/Root.js 查看文件

@@ -1,20 +0,0 @@
1
-const Container = require('./Container');
2
-const SideMenu = require('./SideMenu');
3
-
4
-class Root {
5
-  /**
6
-   * @property {Container} component
7
-   * @property {SideMenu} [sideMenu]
8
-   * @property {Container[]} [bottomTabs]
9
-   */
10
-  constructor(root) {
11
-    this.component = root.container && new Container(root.component);
12
-    this.sideMenu = root.sideMenu && new SideMenu(root.sideMenu);
13
-    if (root.bottomTabs) {
14
-      root.bottomTabs.map((t) => new Container(t.component));
15
-      this.bottomTabs = root.bottomTabs;
16
-    }
17
-  }
18
-}
19
-
20
-module.exports = Root;

+ 0
- 83
lib/src/xparams/containers/Root.test.js 查看文件

@@ -1,83 +0,0 @@
1
-const Root = require('./Root');
2
-
3
-const COMPONENT = { name: 'myScreen' };
4
-const SIDE_MENU = {
5
-  left: {
6
-    component: {
7
-      name: 'navigation.playground.TextScreen',
8
-      passProps: {
9
-        text: 'This is a left side menu screen'
10
-      }
11
-    }
12
-  },
13
-  right: {
14
-    component: {
15
-      name: 'navigation.playground.TextScreen',
16
-      passProps: {
17
-        text: 'This is a right side menu screen'
18
-      }
19
-    }
20
-  }
21
-};
22
-const BOTTOM_TABS = [
23
-  {
24
-    component: {
25
-      name: 'navigation.playground.TextScreen',
26
-      passProps: {
27
-        text: 'This is a side menu center screen tab 1'
28
-      }
29
-    }
30
-  },
31
-  {
32
-    component: {
33
-      name: 'navigation.playground.TextScreen',
34
-      passProps: {
35
-        text: 'This is a side menu center screen tab 2'
36
-      }
37
-    }
38
-  },
39
-  {
40
-    component: {
41
-      name: 'navigation.playground.TextScreen',
42
-      passProps: {
43
-        text: 'This is a side menu center screen tab 3'
44
-      }
45
-    }
46
-  }
47
-];
48
-
49
-describe('Root', () => {
50
-  it('Parses Root', () => {
51
-    const uut = new Root(simpleRoot());
52
-    expect(uut.component.name).toEqual(COMPONENT.name);
53
-  });
54
-
55
-  it('parses root with sideMenu', () => {
56
-    const uut = new Root(rootWithSideMenu());
57
-    expect(uut.component.name).toEqual(COMPONENT.name);
58
-    expect(uut.sideMenu).toEqual(SIDE_MENU);
59
-  });
60
-
61
-  it('parses root with BottomTabs', () => {
62
-    const uut = new Root(rootWithBottomTabs());
63
-    expect(uut.bottomTabs).toEqual(BOTTOM_TABS);
64
-  });
65
-});
66
-
67
-function rootWithBottomTabs() {
68
-  return {
69
-    component: COMPONENT,
70
-    bottomTabs: BOTTOM_TABS
71
-  };
72
-}
73
-
74
-function simpleRoot() {
75
-  return { component: COMPONENT };
76
-}
77
-
78
-function rootWithSideMenu() {
79
-  return {
80
-    component: COMPONENT,
81
-    sideMenu: SIDE_MENU
82
-  };
83
-}

+ 0
- 14
lib/src/xparams/containers/SideMenu.js 查看文件

@@ -1,14 +0,0 @@
1
-const Container = require('./Container');
2
-
3
-class SideMenu {
4
-  /**
5
-  * @property {Container} [left]
6
-  * @property {Container} [right]
7
-  */
8
-  constructor(params) {
9
-    this.left = params.left && { component: new Container(params.left.component) };
10
-    this.right = params.right && { component: new Container(params.right.component) };
11
-  }
12
-}
13
-
14
-module.exports = SideMenu;

+ 0
- 13
lib/src/xparams/containers/SideMenu.test.js 查看文件

@@ -1,13 +0,0 @@
1
-const SideMenu = require('./SideMenu');
2
-
3
-const LEFT = { component: { name: 'myLeftScreen' } };
4
-const RIGHT = { component: { name: 'myRightScreen' } };
5
-const SIDE_MENU = { left: LEFT, right: RIGHT };
6
-
7
-describe('SideMenu', () => {
8
-  it('parses SideMenu', () => {
9
-    const uut = new SideMenu(SIDE_MENU);
10
-    expect(uut.left).toEqual(LEFT);
11
-    expect(uut.right).toEqual(RIGHT);
12
-  });
13
-});

+ 0
- 26
lib/src/xparams/options/BottomTab.js 查看文件

@@ -1,26 +0,0 @@
1
-const { isEmpty } = require('lodash');
2
-
3
-class BottomTab {
4
-  /**
5
-   * @property {string} [title]
6
-   * @property {number} [tag]
7
-   * @property {object} [icon]
8
-   * @property {boolean} [visible]
9
-   * @property {string} [badge]
10
-   * @property {string} [testID]
11
-   */
12
-  constructor(params) {
13
-    if (isEmpty(params)) {
14
-      return;
15
-    }
16
-
17
-    this.badge = params.badge;
18
-    this.title = params.title;
19
-    this.icon = params.icon;
20
-    this.visible = params.visible;
21
-    this.testID = params.testID;
22
-    this.tag = params.tag;
23
-  }
24
-}
25
-
26
-module.exports = BottomTab;

+ 0
- 18
lib/src/xparams/options/BottomTab.test.js 查看文件

@@ -1,18 +0,0 @@
1
-const BottomTab = require('./BottomTab');
2
-
3
-const BOTTOM_TAB = {
4
-  title: 'title',
5
-  badge: 3,
6
-  visible: true,
7
-  icon: { uri: '' }
8
-};
9
-
10
-describe('BottomTab', () => {
11
-  it('parses BottomTab options', () => {
12
-    const uut = new BottomTab(BOTTOM_TAB);
13
-    expect(uut.title).toEqual('title');
14
-    expect(uut.badge).toEqual(3);
15
-    expect(uut.visible).toEqual(true);
16
-    expect(uut.icon).toEqual({ uri: '' });
17
-  });
18
-});

+ 0
- 25
lib/src/xparams/options/BottomTabs.js 查看文件

@@ -1,25 +0,0 @@
1
-const { isEmpty } = require('lodash');
2
-
3
-class BottomTabs {
4
-  /**
5
-   * @property {string} [currentTabId]
6
-   * @property {number} [currentTabIndex]
7
-   * @property {boolean} [hidden]
8
-   * @property {boolean} [animateHide]
9
-   * @property {string} [testID]
10
-   * @property {boolean} [drawUnder]
11
-   */
12
-  constructor(params) {
13
-    if (isEmpty(params)) {
14
-      return;
15
-    }
16
-    this.currentTabId = params.currentTabId;
17
-    this.currentTabIndex = params.currentTabIndex;
18
-    this.hidden = params.hidden;
19
-    this.animateHide = params.animateHide;
20
-    this.testID = params.testID;
21
-    this.drawUnder = params.drawUnder;
22
-  }
23
-}
24
-
25
-module.exports = BottomTabs;

+ 0
- 18
lib/src/xparams/options/BottomTabs.test.js 查看文件

@@ -1,18 +0,0 @@
1
-const BottomTabs = require('./BottomTabs');
2
-
3
-const BOTTOM_TABS = {
4
-  currentTabId: 1,
5
-  currentTabIndex: 2,
6
-  hidden: true,
7
-  animateHide: true
8
-};
9
-
10
-describe('BottomTabs', () => {
11
-  it('parses BottomTabs options', () => {
12
-    const uut = new BottomTabs(BOTTOM_TABS);
13
-    expect(uut.currentTabId).toEqual(1);
14
-    expect(uut.currentTabIndex).toEqual(2);
15
-    expect(uut.hidden).toEqual(true);
16
-    expect(uut.animateHide).toEqual(true);
17
-  });
18
-});

+ 0
- 25
lib/src/xparams/options/Button.js 查看文件

@@ -1,25 +0,0 @@
1
-class Button {
2
-  /**
3
-   * @property {string} id
4
-   * @property {string} [testID]
5
-   * @property {string} [title]
6
-   * @property {string} [buttonColor]
7
-   * @property {string} [showAsAction]
8
-   * @property {int} [buttonFontWeight]
9
-   * @property {boolean} [disableIconTint]
10
-   * @property {boolean} [disabled]
11
-   */
12
-  constructor(params) {
13
-    this.id = params.id;
14
-    this.testID = params.testID;
15
-    this.title = params.title;
16
-    this.buttonColor = params.buttonColor;
17
-    this.showAsAction = params.showAsAction;
18
-    this.buttonFontWeight = params.buttonFontWeight;
19
-    this.buttonFontSize = params.buttonFontSize;
20
-    this.disableIconTint = params.disableIconTint;
21
-    this.disabled = params.disabled;
22
-  }
23
-}
24
-
25
-module.exports = Button;

+ 0
- 28
lib/src/xparams/options/Button.test.js 查看文件

@@ -1,28 +0,0 @@
1
-const Button = require('./Button');
2
-
3
-const BUTTON = {
4
-  id: 'myBtn',
5
-  testID: 'BTN',
6
-  title: 'My Button',
7
-  buttonColor: 'red',
8
-  buttonFontSize: 16,
9
-  buttonFontWeight: 300,
10
-  showAsAction: 'never',
11
-  disableIconTint: true,
12
-  disabled: true
13
-};
14
-
15
-describe('Button', () => {
16
-  it('parses button', () => {
17
-    const uut = new Button(BUTTON);
18
-    expect(uut.id).toEqual('myBtn');
19
-    expect(uut.testID).toEqual('BTN');
20
-    expect(uut.title).toEqual('My Button');
21
-    expect(uut.buttonColor).toEqual('red');
22
-    expect(uut.showAsAction).toEqual('never');
23
-    expect(uut.buttonFontWeight).toEqual(300);
24
-    expect(uut.buttonFontSize).toEqual(16);
25
-    expect(uut.disableIconTint).toEqual(true);
26
-    expect(uut.disabled).toEqual(true);
27
-  });
28
-});

+ 0
- 27
lib/src/xparams/options/Options.js 查看文件

@@ -1,27 +0,0 @@
1
-const TopBar = require('./TopBar');
2
-const BottomTabs = require('./BottomTabs');
3
-const BottomTab = require('./BottomTab');
4
-const TopTabs = require('./TopTabs');
5
-
6
-class Options {
7
-  /**
8
-   * @property {options:TopBar} [topBar]
9
-   * @property {options:BottomTabs} [bottomTabs]
10
-   * @property {options:BottomTab} [bottomTab]
11
-   * @property {string} [orientation]
12
-   * @property {options:TopTabs} [topTabs]
13
-   */
14
-  constructor(options) {
15
-    this.topBar = options.topBar && new TopBar(options.topBar);
16
-    this.bottomTabs = options.bottomTabs && new BottomTabs(options.bottomTabs);
17
-    this.bottomTab = options.bottomTab && new BottomTab(options.bottomTab);
18
-    this.orientation = options.orientation;
19
-    this.sideMenu = options.sideMenu;
20
-    this.backgroundImage = options.backgroundImage;
21
-    this.rootBackgroundImage = options.rootBackgroundImage;
22
-    this.screenBackgroundColor = options.screenBackgroundColor;
23
-    this.topTabs = options.topTabs && new TopTabs(options.topTabs);
24
-  }
25
-}
26
-
27
-module.exports = Options;

+ 0
- 31
lib/src/xparams/options/Options.test.js 查看文件

@@ -1,31 +0,0 @@
1
-const Options = require('./Options');
2
-const BottomTabs = require('./BottomTabs');
3
-const TopBar = require('./TopBar');
4
-const BottomTab = require('./BottomTab');
5
-const TopTabs = require('./TopTabs');
6
-
7
-const TAB_BAR = {};
8
-const TOP_BAR = {};
9
-const TAB_ITEM = {};
10
-const TOP_TABS = {
11
-  selectedTabColor: 'blue',
12
-  unselectedTabColor: 'red'
13
-};
14
-const NAVIGATION_OPTIONS = {
15
-  topBar: TOP_BAR,
16
-  bottomTabs: TAB_BAR,
17
-  bottomTab: TAB_ITEM,
18
-  orientation: 'portrait',
19
-  topTabs: TOP_TABS
20
-};
21
-
22
-describe('Options', () => {
23
-  it('parses options correctly', () => {
24
-    const uut = new Options(NAVIGATION_OPTIONS);
25
-    expect(uut.bottomTabs).toBeInstanceOf(BottomTabs);
26
-    expect(uut.topBar).toBeInstanceOf(TopBar);
27
-    expect(uut.bottomTab).toBeInstanceOf(BottomTab);
28
-    expect(uut.orientation).toEqual('portrait');
29
-    expect(uut.topTabs).toBeInstanceOf(TopTabs);
30
-  });
31
-});

+ 0
- 46
lib/src/xparams/options/TopBar.js 查看文件

@@ -1,46 +0,0 @@
1
-const Button = require('./Button');
2
-
3
-class TopBar {
4
-  /**
5
-   * @property {string} [title]
6
-   * @property {string} [backgroundColor]
7
-   * @property {string} [textColor]
8
-   * @property {string} [buttonColor]
9
-   * @property {number} [textFontSize]
10
-   * @property {string} [textFontFamily]
11
-   * @property {string} [testID]
12
-   * @property {boolean} [hidden]
13
-   * @property {boolean} [animateHide]
14
-   * @property {boolean} [hideOnScroll]
15
-   * @property {boolean} [transparent]
16
-   * @property {boolean} [translucent]
17
-   * @property {boolean} [blur]
18
-   * @property {boolean} [noBorder]
19
-   * @property {boolean} [largeTitle]
20
-   * @property {boolean} [drawUnder]
21
-   * @property {options:Button[]} [rightButtons]
22
-   * @property {options:Button[]} [leftButtons]
23
-   */
24
-  constructor(options) {
25
-    this.title = options.title;
26
-    this.backgroundColor = options.backgroundColor;
27
-    this.textColor = options.textColor;
28
-    this.textFontSize = options.textFontSize;
29
-    this.textFontFamily = options.textFontFamily;
30
-    this.hidden = options.hidden;
31
-    this.animateHide = options.animateHide;
32
-    this.hideOnScroll = options.hideOnScroll;
33
-    this.transparent = options.transparent;
34
-    this.translucent = options.translucent;
35
-    this.buttonColor = options.buttonColor;
36
-    this.blur = options.blur;
37
-    this.noBorder = options.noBorder;
38
-    this.largeTitle = options.largeTitle;
39
-    this.testID = options.testID;
40
-    this.drawUnder = options.drawUnder;
41
-    this.rightButtons = options.rightButtons && options.rightButtons.map((button) => new Button(button));
42
-    this.leftButtons = options.leftButtons && options.leftButtons.map((button) => new Button(button));
43
-  }
44
-}
45
-
46
-module.exports = TopBar;

+ 0
- 49
lib/src/xparams/options/TopBar.test.js 查看文件

@@ -1,49 +0,0 @@
1
-const TopBar = require('./TopBar');
2
-const Button = require('./Button');
3
-
4
-const RIGHT_BUTTONS = [
5
-  {
6
-    id: 'myBtn',
7
-    testID: 'BTN',
8
-    title: 'My Button',
9
-    buttonColor: 'red'
10
-  }
11
-];
12
-const LEFT_BUTTONS = [
13
-  {
14
-    id: 'myBtn',
15
-    testID: 'BTN',
16
-    title: 'My Button',
17
-    buttonColor: 'red'
18
-  }
19
-];
20
-
21
-const TOP_BAR = {
22
-  title: 'something',
23
-  backgroundColor: 'red',
24
-  textColor: 'green',
25
-  textFontSize: 13,
26
-  textFontFamily: 'guttmanYadBrush',
27
-  hidden: true,
28
-  animateHide: true,
29
-  hideOnScroll: true,
30
-  transparent: true,
31
-  rightButtons: RIGHT_BUTTONS,
32
-  leftButtons: LEFT_BUTTONS
33
-};
34
-
35
-describe('TopBar', () => {
36
-  it('Parses TopBar', () => {
37
-    const uut = new TopBar(TOP_BAR);
38
-    expect(uut.title).toEqual('something');
39
-    expect(uut.backgroundColor).toEqual('red');
40
-    expect(uut.textColor).toEqual('green');
41
-    expect(uut.textFontSize).toEqual(13);
42
-    expect(uut.textFontFamily).toEqual('guttmanYadBrush');
43
-    expect(uut.hidden).toEqual(true);
44
-    expect(uut.animateHide).toEqual(true);
45
-    expect(uut.hideOnScroll).toEqual(true);
46
-    expect(uut.transparent).toEqual(true);
47
-    expect(uut.leftButtons[0]).toBeInstanceOf(Button);
48
-  });
49
-});

+ 0
- 13
lib/src/xparams/options/TopTab.js 查看文件

@@ -1,13 +0,0 @@
1
-class TopTab {
2
-  /**
3
-   * @property {string} title The tab's title in the TopTabs view
4
-   * @property {string} [titleFontFamily] Change the tab's title font family
5
-   */
6
-  constructor(topTab) {
7
-    this.title = topTab.title;
8
-    this.titleFontFamily = topTab.titleFontFamily;
9
-  }
10
-
11
-}
12
-
13
-module.exports = TopTab;

+ 0
- 14
lib/src/xparams/options/TopTab.test.js 查看文件

@@ -1,14 +0,0 @@
1
-const TopTab = require('./TopTab');
2
-
3
-const TOP_TAB = {
4
-  title: 'something',
5
-  titleFontFamily: 'Dosis-Regular'
6
-};
7
-
8
-describe('TopBar', () => {
9
-  it('Parses TopBar', () => {
10
-    const uut = new TopTab(TOP_TAB);
11
-    expect(uut.title).toEqual('something');
12
-    expect(uut.titleFontFamily).toEqual('Dosis-Regular');
13
-  });
14
-});

+ 0
- 14
lib/src/xparams/options/TopTabs.js 查看文件

@@ -1,14 +0,0 @@
1
-class TopTabs {
2
-  /**
3
-   * @property {string} [selectedTabColor] Selected tab color
4
-   * @property {string} unselectedTabColor Unselected tab color
5
-   * @property {int} fontSize
6
-   */
7
-  constructor(topTabs) {
8
-    this.selectedTabColor = topTabs.selectedTabColor;
9
-    this.unselectedTabColor = topTabs.unselectedTabColor;
10
-    this.fontSize = topTabs.fontSize;
11
-  }
12
-}
13
-
14
-module.exports = TopTabs;

+ 0
- 16
lib/src/xparams/options/TopTabs.test.js 查看文件

@@ -1,16 +0,0 @@
1
-const TopTabs = require('./TopTabs');
2
-
3
-const TOP_TABS = {
4
-  selectedTabColor: 'red',
5
-  unselectedTabColor: 'blue',
6
-  fontSize: 11
7
-};
8
-
9
-describe('TopTabs', () => {
10
-  it('Parses TopTabs', () => {
11
-    const uut = new TopTabs(TOP_TABS);
12
-    expect(uut.selectedTabColor).toEqual('red');
13
-    expect(uut.unselectedTabColor).toEqual('blue');
14
-    expect(uut.fontSize).toEqual(11);
15
-  });
16
-});