|
@@ -22,7 +22,8 @@ describe('LayoutTreeParser', () => {
|
22
|
22
|
data: {},
|
23
|
23
|
children: []
|
24
|
24
|
}
|
25
|
|
- ]
|
|
25
|
+ ],
|
|
26
|
+ data: {}
|
26
|
27
|
});
|
27
|
28
|
});
|
28
|
29
|
|
|
@@ -37,6 +38,7 @@ describe('LayoutTreeParser', () => {
|
37
|
38
|
.toEqual({
|
38
|
39
|
type: 'ContainerStack',
|
39
|
40
|
id: 'ContainerStack+UNIQUE_ID',
|
|
41
|
+ data: {},
|
40
|
42
|
children: [
|
41
|
43
|
{
|
42
|
44
|
type: 'Container',
|
|
@@ -55,6 +57,7 @@ describe('LayoutTreeParser', () => {
|
55
|
57
|
.toEqual({
|
56
|
58
|
type: 'ContainerStack',
|
57
|
59
|
id: 'ContainerStack+UNIQUE_ID',
|
|
60
|
+ data: {},
|
58
|
61
|
children: [
|
59
|
62
|
{
|
60
|
63
|
type: 'Container',
|
|
@@ -62,21 +65,17 @@ describe('LayoutTreeParser', () => {
|
62
|
65
|
children: [],
|
63
|
66
|
data: {
|
64
|
67
|
name: 'com.example.MyScreen',
|
65
|
|
- passProps: {
|
66
|
|
- foo: {
|
67
|
|
- number: 1,
|
68
|
|
- string: 'Hello!'
|
69
|
|
- },
|
70
|
|
- bar: SimpleLayouts.passedFunction
|
71
|
|
- },
|
|
68
|
+ passProps: SimpleLayouts.passProps,
|
72
|
69
|
style: {},
|
73
|
70
|
buttons: {}
|
74
|
71
|
}
|
75
|
72
|
}
|
76
|
73
|
]
|
77
|
74
|
});
|
78
|
|
- expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams).children[0].data.passProps.bar).toBe(SimpleLayouts.passedFunction);
|
79
|
|
- expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams).children[0].data.passProps.bar()).toEqual('Hello from a function');
|
|
75
|
+ const parsedPropsFn = uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams)
|
|
76
|
+ .children[0].data.passProps.fnProp;
|
|
77
|
+ expect(parsedPropsFn).toBe(SimpleLayouts.passProps.fnProp);
|
|
78
|
+ expect(parsedPropsFn()).toEqual('Hello from a function');
|
80
|
79
|
});
|
81
|
80
|
|
82
|
81
|
it('parses tab based', () => {
|
|
@@ -84,10 +83,12 @@ describe('LayoutTreeParser', () => {
|
84
|
83
|
.toEqual({
|
85
|
84
|
type: 'Tabs',
|
86
|
85
|
id: 'Tabs+UNIQUE_ID',
|
|
86
|
+ data: {},
|
87
|
87
|
children: [
|
88
|
88
|
{
|
89
|
89
|
type: 'ContainerStack',
|
90
|
90
|
id: 'ContainerStack+UNIQUE_ID',
|
|
91
|
+ data: {},
|
91
|
92
|
children: [
|
92
|
93
|
{
|
93
|
94
|
type: 'Container',
|
|
@@ -102,6 +103,7 @@ describe('LayoutTreeParser', () => {
|
102
|
103
|
{
|
103
|
104
|
type: 'ContainerStack',
|
104
|
105
|
id: 'ContainerStack+UNIQUE_ID',
|
|
106
|
+ data: {},
|
105
|
107
|
children: [
|
106
|
108
|
{
|
107
|
109
|
type: 'Container',
|
|
@@ -116,6 +118,7 @@ describe('LayoutTreeParser', () => {
|
116
|
118
|
{
|
117
|
119
|
type: 'ContainerStack',
|
118
|
120
|
id: 'ContainerStack+UNIQUE_ID',
|
|
121
|
+ data: {},
|
119
|
122
|
children: [
|
120
|
123
|
{
|
121
|
124
|
type: 'Container',
|
|
@@ -136,10 +139,12 @@ describe('LayoutTreeParser', () => {
|
136
|
139
|
.toEqual({
|
137
|
140
|
type: 'SideMenuRoot',
|
138
|
141
|
id: 'SideMenuRoot+UNIQUE_ID',
|
|
142
|
+ data: {},
|
139
|
143
|
children: [
|
140
|
144
|
{
|
141
|
145
|
type: 'SideMenuLeft',
|
142
|
146
|
id: 'SideMenuLeft+UNIQUE_ID',
|
|
147
|
+ data: {},
|
143
|
148
|
children: [
|
144
|
149
|
{
|
145
|
150
|
type: 'Container',
|
|
@@ -154,10 +159,12 @@ describe('LayoutTreeParser', () => {
|
154
|
159
|
{
|
155
|
160
|
type: 'SideMenuCenter',
|
156
|
161
|
id: 'SideMenuCenter+UNIQUE_ID',
|
|
162
|
+ data: {},
|
157
|
163
|
children: [
|
158
|
164
|
{
|
159
|
165
|
type: 'ContainerStack',
|
160
|
166
|
id: 'ContainerStack+UNIQUE_ID',
|
|
167
|
+ data: {},
|
161
|
168
|
children: [
|
162
|
169
|
{
|
163
|
170
|
type: 'Container',
|
|
@@ -180,14 +187,17 @@ describe('LayoutTreeParser', () => {
|
180
|
187
|
.toEqual({
|
181
|
188
|
type: 'SideMenuRoot',
|
182
|
189
|
id: 'SideMenuRoot+UNIQUE_ID',
|
|
190
|
+ data: {},
|
183
|
191
|
children: [
|
184
|
192
|
{
|
185
|
193
|
type: 'SideMenuCenter',
|
186
|
194
|
id: 'SideMenuCenter+UNIQUE_ID',
|
|
195
|
+ data: {},
|
187
|
196
|
children: [
|
188
|
197
|
{
|
189
|
198
|
type: 'ContainerStack',
|
190
|
199
|
id: 'ContainerStack+UNIQUE_ID',
|
|
200
|
+ data: {},
|
191
|
201
|
children: [
|
192
|
202
|
{
|
193
|
203
|
type: 'Container',
|
|
@@ -204,6 +214,7 @@ describe('LayoutTreeParser', () => {
|
204
|
214
|
{
|
205
|
215
|
type: 'SideMenuRight',
|
206
|
216
|
id: 'SideMenuRight+UNIQUE_ID',
|
|
217
|
+ data: {},
|
207
|
218
|
children: [
|
208
|
219
|
{
|
209
|
220
|
type: 'Container',
|
|
@@ -224,10 +235,12 @@ describe('LayoutTreeParser', () => {
|
224
|
235
|
.toEqual({
|
225
|
236
|
type: 'SideMenuRoot',
|
226
|
237
|
id: 'SideMenuRoot+UNIQUE_ID',
|
|
238
|
+ data: {},
|
227
|
239
|
children: [
|
228
|
240
|
{
|
229
|
241
|
type: 'SideMenuLeft',
|
230
|
242
|
id: 'SideMenuLeft+UNIQUE_ID',
|
|
243
|
+ data: {},
|
231
|
244
|
children: [
|
232
|
245
|
{
|
233
|
246
|
type: 'Container',
|
|
@@ -242,10 +255,12 @@ describe('LayoutTreeParser', () => {
|
242
|
255
|
{
|
243
|
256
|
type: 'SideMenuCenter',
|
244
|
257
|
id: 'SideMenuCenter+UNIQUE_ID',
|
|
258
|
+ data: {},
|
245
|
259
|
children: [
|
246
|
260
|
{
|
247
|
261
|
type: 'ContainerStack',
|
248
|
262
|
id: 'ContainerStack+UNIQUE_ID',
|
|
263
|
+ data: {},
|
249
|
264
|
children: [
|
250
|
265
|
{
|
251
|
266
|
type: 'Container',
|
|
@@ -262,6 +277,7 @@ describe('LayoutTreeParser', () => {
|
262
|
277
|
{
|
263
|
278
|
type: 'SideMenuRight',
|
264
|
279
|
id: 'SideMenuRight+UNIQUE_ID',
|
|
280
|
+ data: {},
|
265
|
281
|
children: [
|
266
|
282
|
{
|
267
|
283
|
type: 'Container',
|
|
@@ -282,10 +298,12 @@ describe('LayoutTreeParser', () => {
|
282
|
298
|
.toEqual({
|
283
|
299
|
type: 'SideMenuRoot',
|
284
|
300
|
id: 'SideMenuRoot+UNIQUE_ID',
|
|
301
|
+ data: {},
|
285
|
302
|
children: [
|
286
|
303
|
{
|
287
|
304
|
type: 'SideMenuLeft',
|
288
|
305
|
id: 'SideMenuLeft+UNIQUE_ID',
|
|
306
|
+ data: {},
|
289
|
307
|
children: [
|
290
|
308
|
{
|
291
|
309
|
type: 'Container',
|
|
@@ -300,14 +318,17 @@ describe('LayoutTreeParser', () => {
|
300
|
318
|
{
|
301
|
319
|
type: 'SideMenuCenter',
|
302
|
320
|
id: 'SideMenuCenter+UNIQUE_ID',
|
|
321
|
+ data: {},
|
303
|
322
|
children: [
|
304
|
323
|
{
|
305
|
324
|
type: 'Tabs',
|
306
|
325
|
id: 'Tabs+UNIQUE_ID',
|
|
326
|
+ data: {},
|
307
|
327
|
children: [
|
308
|
328
|
{
|
309
|
329
|
type: 'ContainerStack',
|
310
|
330
|
id: 'ContainerStack+UNIQUE_ID',
|
|
331
|
+ data: {},
|
311
|
332
|
children: [
|
312
|
333
|
{
|
313
|
334
|
type: 'Container',
|
|
@@ -322,6 +343,7 @@ describe('LayoutTreeParser', () => {
|
322
|
343
|
{
|
323
|
344
|
type: 'ContainerStack',
|
324
|
345
|
id: 'ContainerStack+UNIQUE_ID',
|
|
346
|
+ data: {},
|
325
|
347
|
children: [
|
326
|
348
|
{
|
327
|
349
|
type: 'Container',
|
|
@@ -340,6 +362,7 @@ describe('LayoutTreeParser', () => {
|
340
|
362
|
{
|
341
|
363
|
type: 'SideMenuRight',
|
342
|
364
|
id: 'SideMenuRight+UNIQUE_ID',
|
|
365
|
+ data: {},
|
343
|
366
|
children: [
|
344
|
367
|
{
|
345
|
368
|
type: 'Container',
|