|
@@ -61,7 +61,8 @@ describe('LayoutTreeParser', () => {
|
61
|
61
|
|
62
|
62
|
it('bottom tabs', () => {
|
63
|
63
|
const result = uut.parse(LayoutExamples.bottomTabs);
|
64
|
|
- expect(_.keys(result)).toEqual(['type', 'data', 'children']);
|
|
64
|
+ expect(_.keys(result)).toEqual(['id', 'type', 'data', 'children']);
|
|
65
|
+ expect(result.id).toEqual(undefined);
|
65
|
66
|
expect(result.type).toEqual(LayoutType.BottomTabs);
|
66
|
67
|
expect(result.data).toEqual({});
|
67
|
68
|
expect(result.children.length).toEqual(3);
|
|
@@ -72,7 +73,8 @@ describe('LayoutTreeParser', () => {
|
72
|
73
|
|
73
|
74
|
it('side menus', () => {
|
74
|
75
|
const result = uut.parse(LayoutExamples.sideMenu);
|
75
|
|
- expect(_.keys(result)).toEqual(['type', 'data', 'children']);
|
|
76
|
+ expect(_.keys(result)).toEqual(['id', 'type', 'data', 'children']);
|
|
77
|
+ expect(result.id).toEqual(undefined);
|
76
|
78
|
expect(result.type).toEqual(LayoutType.SideMenuRoot);
|
77
|
79
|
expect(result.data).toEqual({});
|
78
|
80
|
expect(result.children.length).toEqual(3);
|
|
@@ -93,7 +95,8 @@ describe('LayoutTreeParser', () => {
|
93
|
95
|
|
94
|
96
|
it('top tabs', () => {
|
95
|
97
|
const result = uut.parse(LayoutExamples.topTabs);
|
96
|
|
- expect(_.keys(result)).toEqual(['type', 'data', 'children']);
|
|
98
|
+ expect(_.keys(result)).toEqual(['id', 'type', 'data', 'children']);
|
|
99
|
+ expect(result.id).toEqual(undefined);
|
97
|
100
|
expect(result.type).toEqual(LayoutType.TopTabs);
|
98
|
101
|
expect(result.data).toEqual({ options: LayoutExamples.options });
|
99
|
102
|
expect(result.children.length).toEqual(5);
|
|
@@ -124,6 +127,21 @@ describe('LayoutTreeParser', () => {
|
124
|
127
|
expect(uut.parse({ topTabs: { options } }).data.options).toBe(options);
|
125
|
128
|
expect(uut.parse({ sideMenu: { options, center: { component: {} } } }).data.options).toBe(options);
|
126
|
129
|
});
|
|
130
|
+
|
|
131
|
+ it('pass user provided id as is', () => {
|
|
132
|
+ const component = { id: 'compId' };
|
|
133
|
+ expect(uut.parse({ component }).id).toEqual('compId');
|
|
134
|
+ expect(uut.parse({ stack: { id: 'stackId' } }).id).toEqual('stackId');
|
|
135
|
+ expect(uut.parse({ stack: { children: [{ component }] } }).children[0].id).toEqual('compId');
|
|
136
|
+ expect(uut.parse({ bottomTabs: { id: 'myId' } }).id).toEqual('myId');
|
|
137
|
+ expect(uut.parse({ bottomTabs: { children: [{ component }] } }).children[0].id).toEqual('compId');
|
|
138
|
+ expect(uut.parse({ topTabs: { id: 'myId' } }).id).toEqual('myId');
|
|
139
|
+ expect(uut.parse({ topTabs: { children: [{ component }] } }).children[0].id).toEqual('compId');
|
|
140
|
+ expect(uut.parse({ sideMenu: { id: 'myId', center: { component } } }).id).toEqual('myId');
|
|
141
|
+ expect(uut.parse({ sideMenu: { center: { id: 'myId', component } } }).children[0].id).toEqual('myId');
|
|
142
|
+ expect(uut.parse({ sideMenu: { center: { component }, left: { id: 'theId', component } } }).children[0].id).toEqual('theId');
|
|
143
|
+ expect(uut.parse({ sideMenu: { center: { component }, right: { id: 'theId', component } } }).children[1].id).toEqual('theId');
|
|
144
|
+ });
|
127
|
145
|
});
|
128
|
146
|
|
129
|
147
|
/* Layout Examples: */
|