Kaynağa Gözat

update deps, e2e works

Daniel Zlotin 8 yıl önce
ebeveyn
işleme
cc0c532860

+ 1
- 1
src/commands/Commands.js Dosyayı Görüntüle

@@ -7,6 +7,6 @@ export default class Commands {
7 7
   }
8 8
 
9 9
   startApp(simpleApi) {
10
-    this.nativeCommandsSender.startApp(this.layoutTreeParser.parseSimpleJSON(simpleApi));
10
+    this.nativeCommandsSender.startApp(this.layoutTreeParser.parseFromSimpleJSON(simpleApi));
11 11
   }
12 12
 }

+ 9
- 3
src/commands/LayoutTreeParser.js Dosyayı Görüntüle

@@ -5,9 +5,15 @@ export default class LayoutTreeParser {
5 5
     this.uniqueIdProvider = uniqueIdProvider;
6 6
   }
7 7
 
8
-  parseSimpleJSON(params) {
9
-    const layout = this.createContainerStackWithContainer(params.container);
10
-    return layout;
8
+  parseFromSimpleJSON(simpleJsonApi) {
9
+    if (simpleJsonApi.tabs) {
10
+      return {
11
+        type: 'Tabs',
12
+        id: this.uniqueIdProvider.generate(`Tabs`),
13
+        children: _.map(simpleJsonApi.tabs, (t) => this.createContainerStackWithContainer(t.container))
14
+      };
15
+    }
16
+    return this.createContainerStackWithContainer(simpleJsonApi.container);
11 17
   }
12 18
 
13 19
   createContainerStackWithContainer(container) {

+ 41
- 13
src/commands/LayoutTreeParser.test.js Dosyayı Görüntüle

@@ -10,7 +10,7 @@ describe('LayoutTreeParser', () => {
10 10
   });
11 11
 
12 12
   it('parses single screen', () => {
13
-    expect(uut.parseSimpleJSON(SimpleLayouts.singleScreenApp))
13
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
14 14
       .toEqual({
15 15
         type: 'ContainerStack',
16 16
         id: 'ContainerStack+UNIQUE_ID',
@@ -28,7 +28,7 @@ describe('LayoutTreeParser', () => {
28 28
   });
29 29
 
30 30
   it('parses single screen with props', () => {
31
-    expect(uut.parseSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams))
31
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams))
32 32
       .toEqual({
33 33
         type: 'ContainerStack',
34 34
         id: 'ContainerStack+UNIQUE_ID',
@@ -52,28 +52,56 @@ describe('LayoutTreeParser', () => {
52 52
           }
53 53
         ]
54 54
       });
55
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams).children[0].data.passProps.bar()).toEqual('Hello from a function');
55 56
   });
56 57
 
57
-  xit('parses tab based', () => {
58
-    expect(uut.parseSimpleJSON(SimpleLayouts.tabBasedApp))
58
+  it('parses tab based', () => {
59
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.tabBasedApp))
59 60
       .toEqual({
60 61
         type: 'Tabs',
61 62
         id: 'Tabs+UNIQUE_ID',
62 63
         children: [
63 64
           {
64
-            container: {
65
-              name: 'com.example.FirstTab'
66
-            }
65
+            type: 'ContainerStack',
66
+            id: 'ContainerStack+UNIQUE_ID',
67
+            children: [
68
+              {
69
+                type: 'Container',
70
+                id: 'Container+UNIQUE_ID',
71
+                children: [],
72
+                data: {
73
+                  name: 'com.example.ATab'
74
+                }
75
+              }
76
+            ]
67 77
           },
68 78
           {
69
-            container: {
70
-              name: 'com.example.SecondTab'
71
-            }
79
+            type: 'ContainerStack',
80
+            id: 'ContainerStack+UNIQUE_ID',
81
+            children: [
82
+              {
83
+                type: 'Container',
84
+                id: 'Container+UNIQUE_ID',
85
+                children: [],
86
+                data: {
87
+                  name: 'com.example.SecondTab'
88
+                }
89
+              }
90
+            ]
72 91
           },
73 92
           {
74
-            container: {
75
-              name: 'com.example.FirstTab'
76
-            }
93
+            type: 'ContainerStack',
94
+            id: 'ContainerStack+UNIQUE_ID',
95
+            children: [
96
+              {
97
+                type: 'Container',
98
+                id: 'Container+UNIQUE_ID',
99
+                children: [],
100
+                data: {
101
+                  name: 'com.example.ATab'
102
+                }
103
+              }
104
+            ]
77 105
           }
78 106
         ]
79 107
       });

+ 2
- 2
src/commands/SimpleLayouts.js Dosyayı Görüntüle

@@ -25,7 +25,7 @@ export const tabBasedApp = {
25 25
   tabs: [
26 26
     {
27 27
       container: {
28
-        name: 'com.example.FirstTab'
28
+        name: 'com.example.ATab'
29 29
       }
30 30
     },
31 31
     {
@@ -35,7 +35,7 @@ export const tabBasedApp = {
35 35
     },
36 36
     {
37 37
       container: {
38
-        name: 'com.example.FirstTab'
38
+        name: 'com.example.ATab'
39 39
       }
40 40
     }
41 41
   ]

+ 13
- 17
yarn.lock Dosyayı Görüntüle

@@ -227,9 +227,9 @@ ast-query@^2.0.0:
227 227
     lodash "^4.6.1"
228 228
     traverse "^0.6.6"
229 229
 
230
-ast-types@0.9.2:
231
-  version "0.9.2"
232
-  resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.2.tgz#2cc19979d15c655108bf565323b8e7ee38751f6b"
230
+ast-types@0.9.4:
231
+  version "0.9.4"
232
+  resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.4.tgz#410d1f81890aeb8e0a38621558ba5869ae53c91b"
233 233
 
234 234
 async-each@^1.0.0:
235 235
   version "1.0.1"
@@ -1684,11 +1684,7 @@ dom-walk@^0.1.0:
1684 1684
   version "0.1.1"
1685 1685
   resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
1686 1686
 
1687
-domelementtype@1:
1688
-  version "1.3.0"
1689
-  resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2"
1690
-
1691
-domelementtype@~1.1.1:
1687
+domelementtype@1, domelementtype@~1.1.1:
1692 1688
   version "1.1.3"
1693 1689
   resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b"
1694 1690
 
@@ -1925,8 +1921,8 @@ escope@^3.6.0:
1925 1921
     estraverse "^4.1.1"
1926 1922
 
1927 1923
 eslint-plugin-babel@4.x.x:
1928
-  version "4.0.0"
1929
-  resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.0.0.tgz#a92114e2c493ac3034b030d7ecf96e174a76ef3f"
1924
+  version "4.0.1"
1925
+  resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.0.1.tgz#77de74dabd67a6bef3b16bf258f5804e971e7349"
1930 1926
 
1931 1927
 eslint-plugin-react-native@2.x.x:
1932 1928
   version "2.2.1"
@@ -2728,7 +2724,7 @@ http-signature@~1.1.0:
2728 2724
     jsprim "^1.2.2"
2729 2725
     sshpk "^1.7.0"
2730 2726
 
2731
-iconv-lite@0.4.11, iconv-lite@^0.4.5:
2727
+iconv-lite@0.4.11:
2732 2728
   version "0.4.11"
2733 2729
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.11.tgz#2ecb42fd294744922209a2e7c404dac8793d8ade"
2734 2730
 
@@ -2736,7 +2732,7 @@ iconv-lite@0.4.13:
2736 2732
   version "0.4.13"
2737 2733
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
2738 2734
 
2739
-iconv-lite@^0.4.13, iconv-lite@~0.4.13:
2735
+iconv-lite@^0.4.13, iconv-lite@^0.4.5, iconv-lite@~0.4.13:
2740 2736
   version "0.4.15"
2741 2737
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
2742 2738
 
@@ -3084,8 +3080,8 @@ istanbul-api@^1.1.0-alpha.1:
3084 3080
     once "^1.4.0"
3085 3081
 
3086 3082
 istanbul-lib-coverage@^1.0.0, istanbul-lib-coverage@^1.0.0-alpha, istanbul-lib-coverage@^1.0.0-alpha.0:
3087
-  version "1.0.0"
3088
-  resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.0.tgz#c3f9b6d226da12424064cce87fce0fb57fdfa7a2"
3083
+  version "1.0.1"
3084
+  resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.1.tgz#f263efb519c051c5f1f3343034fc40e7b43ff212"
3089 3085
 
3090 3086
 istanbul-lib-hook@^1.0.0:
3091 3087
   version "1.0.0"
@@ -4577,10 +4573,10 @@ rebound@^0.0.13:
4577 4573
   resolved "https://registry.yarnpkg.com/rebound/-/rebound-0.0.13.tgz#4a225254caf7da756797b19c5817bf7a7941fac1"
4578 4574
 
4579 4575
 recast@^0.11.17:
4580
-  version "0.11.18"
4581
-  resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.18.tgz#07af6257ca769868815209401d4d60eef1b5b947"
4576
+  version "0.11.20"
4577
+  resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.20.tgz#2cb9bec269c03b36d0598118a936cd0a293ca3f3"
4582 4578
   dependencies:
4583
-    ast-types "0.9.2"
4579
+    ast-types "0.9.4"
4584 4580
     esprima "~3.1.0"
4585 4581
     private "~0.1.5"
4586 4582
     source-map "~0.5.0"