Browse Source

support right side menu

Daniel Zlotin 7 years ago
parent
commit
5774b6b75a

+ 9
- 0
src/commands/LayoutTreeParser.js View File

@@ -39,6 +39,15 @@ export default class LayoutTreeParser {
39 39
         this.createContainerStackWithContainer(layout.container)
40 40
       ]
41 41
     });
42
+    if (layout.sideMenu.right) {
43
+      children.push({
44
+        type: 'SideMenuRight',
45
+        id: this.uniqueIdProvider.generate('SideMenuRight'),
46
+        children: [
47
+          this.createContainer(layout.sideMenu.right.container)
48
+        ]
49
+      });
50
+    }
42 51
     return children;
43 52
   }
44 53
 

+ 44
- 0
src/commands/LayoutTreeParser.test.js View File

@@ -167,4 +167,48 @@ describe('LayoutTreeParser', () => {
167 167
         ]
168 168
       });
169 169
   });
170
+
171
+  it('parses side menu right', () => {
172
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.singleWithRightSideMenu))
173
+      .toEqual({
174
+        type: 'SideMenuRoot',
175
+        id: 'SideMenuRoot+UNIQUE_ID',
176
+        children: [
177
+          {
178
+            type: 'SideMenuCenter',
179
+            id: 'SideMenuCenter+UNIQUE_ID',
180
+            children: [
181
+              {
182
+                type: 'ContainerStack',
183
+                id: 'ContainerStack+UNIQUE_ID',
184
+                children: [
185
+                  {
186
+                    type: 'Container',
187
+                    id: 'Container+UNIQUE_ID',
188
+                    data: {
189
+                      name: 'com.example.MyScreen'
190
+                    },
191
+                    children: []
192
+                  }
193
+                ]
194
+              }
195
+            ]
196
+          },
197
+          {
198
+            type: 'SideMenuRight',
199
+            id: 'SideMenuRight+UNIQUE_ID',
200
+            children: [
201
+              {
202
+                type: 'Container',
203
+                id: 'Container+UNIQUE_ID',
204
+                data: {
205
+                  name: 'com.example.SideMenu'
206
+                },
207
+                children: []
208
+              }
209
+            ]
210
+          }
211
+        ]
212
+      });
213
+  });
170 214
 });

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

@@ -60,7 +60,9 @@ export const singleWithRightSideMenu = {
60 60
   },
61 61
   sideMenu: {
62 62
     right: {
63
-      name: 'com.example.Menu'
63
+      container: {
64
+        name: 'com.example.SideMenu'
65
+      }
64 66
     }
65 67
   }
66 68
 };