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,6 +4,7 @@ import { registerContainers } from './containers';
4 4
 
5 5
 export function start() {
6 6
   registerContainers();
7
+
7 8
   Navigation.onAppLaunched(() => {
8 9
     Navigation.startApp({
9 10
       container: {

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

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

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

@@ -9,6 +9,23 @@ describe('LayoutTreeParser', () => {
9 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 29
   it('parses single screen', () => {
13 30
     expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
14 31
       .toEqual({
@@ -107,11 +124,6 @@ describe('LayoutTreeParser', () => {
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 127
   xit('parses side menus', () => {
116 128
     //const result2 = {
117 129
     //  type: 'Menus',