Browse Source

fixed tests

Daniel Zlotin 8 years ago
parent
commit
0e014b8b0a
3 changed files with 19 additions and 8 deletions
  1. 1
    0
      playground/src/app.js
  2. 1
    3
      src/commands/LayoutTreeParser.js
  3. 17
    5
      src/commands/LayoutTreeParser.test.js

+ 1
- 0
playground/src/app.js View File

4
 
4
 
5
 export function start() {
5
 export function start() {
6
   registerContainers();
6
   registerContainers();
7
+
7
   Navigation.onAppLaunched(() => {
8
   Navigation.onAppLaunched(() => {
8
     Navigation.startApp({
9
     Navigation.startApp({
9
       container: {
10
       container: {

+ 1
- 3
src/commands/LayoutTreeParser.js View File

28
 
28
 
29
   createContainer(container) {
29
   createContainer(container) {
30
     return {
30
     return {
31
-      data: {
32
-        ...container
33
-      },
31
+      data: _.merge({}, container),
34
       type: 'Container',
32
       type: 'Container',
35
       id: this.uniqueIdProvider.generate(`Container`),
33
       id: this.uniqueIdProvider.generate(`Container`),
36
       children: []
34
       children: []

+ 17
- 5
src/commands/LayoutTreeParser.test.js View File

9
     uut = new LayoutTreeParser(uniqueIdProvider);
9
     uut = new LayoutTreeParser(uniqueIdProvider);
10
   });
10
   });
11
 
11
 
12
+  it('adds uniqueId to containers', () => {
13
+    const input = { container: {} };
14
+    expect(uut.parseFromSimpleJSON(input))
15
+      .toEqual({
16
+        type: 'ContainerStack',
17
+        id: 'ContainerStack+UNIQUE_ID',
18
+        children: [
19
+          {
20
+            type: 'Container',
21
+            id: 'Container+UNIQUE_ID',
22
+            data: {},
23
+            children: []
24
+          }
25
+        ]
26
+      });
27
+  });
28
+
12
   it('parses single screen', () => {
29
   it('parses single screen', () => {
13
     expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
30
     expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
14
       .toEqual({
31
       .toEqual({
107
       });
124
       });
108
   });
125
   });
109
 
126
 
110
-  xit('adds uniqueId to containers', () => {
111
-    const input = { container: {} };
112
-    expect(uut.parse(input)).toEqual({ container: { id: 'Container+UNIQUE_ID' } });
113
-  });
114
-
115
   xit('parses side menus', () => {
127
   xit('parses side menus', () => {
116
     //const result2 = {
128
     //const result2 = {
117
     //  type: 'Menus',
129
     //  type: 'Menus',