Browse Source

fix tests

Daniel Zlotin 7 years ago
parent
commit
0df3b8b32c

+ 3
- 3
lib/src/xparams/containers/Root.js View File

3
 
3
 
4
 class Root {
4
 class Root {
5
   /**
5
   /**
6
-   * @property {Container} container
6
+   * @property {Container} component
7
    * @property {SideMenu} [sideMenu]
7
    * @property {SideMenu} [sideMenu]
8
    * @property {Container[]} [bottomTabs]
8
    * @property {Container[]} [bottomTabs]
9
    */
9
    */
10
   constructor(root) {
10
   constructor(root) {
11
-    this.container = root.container && new Container(root.container);
11
+    this.component = root.container && new Container(root.component);
12
     this.sideMenu = root.sideMenu && new SideMenu(root.sideMenu);
12
     this.sideMenu = root.sideMenu && new SideMenu(root.sideMenu);
13
     if (root.bottomTabs) {
13
     if (root.bottomTabs) {
14
-      root.bottomTabs.map((t) => new Container(t.container));
14
+      root.bottomTabs.map((t) => new Container(t.component));
15
       this.bottomTabs = root.bottomTabs;
15
       this.bottomTabs = root.bottomTabs;
16
     }
16
     }
17
   }
17
   }

+ 11
- 11
lib/src/xparams/containers/Root.test.js View File

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

+ 2
- 2
lib/src/xparams/containers/SideMenu.js View File

6
   * @property {Container} [right]
6
   * @property {Container} [right]
7
   */
7
   */
8
   constructor(params) {
8
   constructor(params) {
9
-    this.left = params.left && { container: new Container(params.left.container) };
10
-    this.right = params.right && { container: new Container(params.right.container) };
9
+    this.left = params.left && { component: new Container(params.left.component) };
10
+    this.right = params.right && { component: new Container(params.right.component) };
11
   }
11
   }
12
 }
12
 }
13
 
13
 

+ 2
- 2
lib/src/xparams/containers/SideMenu.test.js View File

1
 const SideMenu = require('./SideMenu');
1
 const SideMenu = require('./SideMenu');
2
 
2
 
3
-const LEFT = { container: { name: 'myLeftScreen' } };
4
-const RIGHT = { container: { name: 'myRightScreen' } };
3
+const LEFT = { component: { name: 'myLeftScreen' } };
4
+const RIGHT = { component: { name: 'myRightScreen' } };
5
 const SIDE_MENU = { left: LEFT, right: RIGHT };
5
 const SIDE_MENU = { left: LEFT, right: RIGHT };
6
 
6
 
7
 describe('SideMenu', () => {
7
 describe('SideMenu', () => {

+ 1
- 1
playground/src/containers/ModalScreen.js View File

45
 
45
 
46
   onClickShowModal() {
46
   onClickShowModal() {
47
     Navigation.showModal({
47
     Navigation.showModal({
48
-      container: {
48
+      component: {
49
         name: 'navigation.playground.ModalScreen',
49
         name: 'navigation.playground.ModalScreen',
50
         passProps: {
50
         passProps: {
51
           modalPosition: this.getModalPosition() + 1,
51
           modalPosition: this.getModalPosition() + 1,

+ 1
- 1
playground/src/containers/OrientationSelectScreen.js View File

21
 
21
 
22
   onClickOrientationScreen(orientation) {
22
   onClickOrientationScreen(orientation) {
23
     Navigation.showModal({
23
     Navigation.showModal({
24
-      container: {
24
+      component: {
25
         name: 'navigation.playground.OrientationDetectScreen',
25
         name: 'navigation.playground.OrientationDetectScreen',
26
         passProps: {
26
         passProps: {
27
           orientation
27
           orientation