|
@@ -26,6 +26,12 @@ describe('LayoutTreeParser', () => {
|
26
|
26
|
});
|
27
|
27
|
});
|
28
|
28
|
|
|
29
|
+ it('deep clones to avoid mutations', () => {
|
|
30
|
+ const obj = {};
|
|
31
|
+ const result = uut.parseFromSimpleJSON({ container: { foo: obj } });
|
|
32
|
+ expect(result.children[0].data.foo).not.toBe(obj);
|
|
33
|
+ });
|
|
34
|
+
|
29
|
35
|
it('parses single screen', () => {
|
30
|
36
|
expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
|
31
|
37
|
.toEqual({
|
|
@@ -69,6 +75,7 @@ describe('LayoutTreeParser', () => {
|
69
|
75
|
}
|
70
|
76
|
]
|
71
|
77
|
});
|
|
78
|
+ expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams).children[0].data.passProps.bar).toBe(SimpleLayouts.passedFunction);
|
72
|
79
|
expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams).children[0].data.passProps.bar()).toEqual('Hello from a function');
|
73
|
80
|
});
|
74
|
81
|
|