|
@@ -47,10 +47,10 @@ describe('LayoutTreeCrawler', () => {
|
47
|
47
|
expect(store.getPropsForContainerId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
|
48
|
48
|
});
|
49
|
49
|
|
50
|
|
- it('Containers: injects navigationOptions from original container class static property', () => {
|
|
50
|
+ it('Containers: injects options from original container class static property', () => {
|
51
|
51
|
const theStyle = {};
|
52
|
52
|
const MyContainer = class {
|
53
|
|
- static get navigationOptions() {
|
|
53
|
+ static get options() {
|
54
|
54
|
return theStyle;
|
55
|
55
|
}
|
56
|
56
|
};
|
|
@@ -58,10 +58,10 @@ describe('LayoutTreeCrawler', () => {
|
58
|
58
|
const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
|
59
|
59
|
store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
60
|
60
|
uut.crawl(node);
|
61
|
|
- expect(node.data.navigationOptions).toEqual(theStyle);
|
|
61
|
+ expect(node.data.options).toEqual(theStyle);
|
62
|
62
|
});
|
63
|
63
|
|
64
|
|
- it('Containers: merges navigationOptions from container class static property with passed options, favoring passed options', () => {
|
|
64
|
+ it('Containers: merges options from container class static property with passed options, favoring passed options', () => {
|
65
|
65
|
const theStyle = {
|
66
|
66
|
bazz: 123,
|
67
|
67
|
inner: {
|
|
@@ -83,12 +83,12 @@ describe('LayoutTreeCrawler', () => {
|
83
|
83
|
}
|
84
|
84
|
};
|
85
|
85
|
|
86
|
|
- const node = { type: LayoutTypes.Component, data: { name: 'theContainerName', navigationOptions: passedOptions } };
|
|
86
|
+ const node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options: passedOptions } };
|
87
|
87
|
store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
88
|
88
|
|
89
|
89
|
uut.crawl(node);
|
90
|
90
|
|
91
|
|
- expect(node.data.navigationOptions).toEqual({
|
|
91
|
+ expect(node.data.options).toEqual({
|
92
|
92
|
aaa: 'exists only in passed',
|
93
|
93
|
bazz: 789,
|
94
|
94
|
inner: {
|
|
@@ -98,10 +98,10 @@ describe('LayoutTreeCrawler', () => {
|
98
|
98
|
});
|
99
|
99
|
});
|
100
|
100
|
|
101
|
|
- it('Component: deepClones navigationOptions', () => {
|
|
101
|
+ it('Component: deepClones options', () => {
|
102
|
102
|
const theStyle = {};
|
103
|
103
|
const MyContainer = class {
|
104
|
|
- static get navigationOptions() {
|
|
104
|
+ static get options() {
|
105
|
105
|
return theStyle;
|
106
|
106
|
}
|
107
|
107
|
};
|
|
@@ -109,7 +109,7 @@ describe('LayoutTreeCrawler', () => {
|
109
|
109
|
const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
|
110
|
110
|
store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
111
|
111
|
uut.crawl(node);
|
112
|
|
- expect(node.data.navigationOptions).not.toBe(theStyle);
|
|
112
|
+ expect(node.data.options).not.toBe(theStyle);
|
113
|
113
|
});
|
114
|
114
|
|
115
|
115
|
it('Containers: must contain data name', () => {
|
|
@@ -117,94 +117,94 @@ describe('LayoutTreeCrawler', () => {
|
117
|
117
|
expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
|
118
|
118
|
});
|
119
|
119
|
|
120
|
|
- it('Containers: navigationOptions default obj', () => {
|
|
120
|
+ it('Containers: options default obj', () => {
|
121
|
121
|
const MyContainer = class { };
|
122
|
122
|
|
123
|
123
|
const node = { type: LayoutTypes.Component, data: { name: 'theContainerName' } };
|
124
|
124
|
store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
125
|
125
|
uut.crawl(node);
|
126
|
|
- expect(node.data.navigationOptions).toEqual({});
|
|
126
|
+ expect(node.data.options).toEqual({});
|
127
|
127
|
});
|
128
|
128
|
|
129
|
129
|
describe('navigation options', () => {
|
130
|
|
- let navigationOptions;
|
|
130
|
+ let options;
|
131
|
131
|
let node;
|
132
|
132
|
|
133
|
133
|
beforeEach(() => {
|
134
|
|
- navigationOptions = {};
|
135
|
|
- node = { type: LayoutTypes.Component, data: { name: 'theContainerName', navigationOptions } };
|
|
134
|
+ options = {};
|
|
135
|
+ node = { type: LayoutTypes.Component, data: { name: 'theContainerName', options } };
|
136
|
136
|
});
|
137
|
137
|
|
138
|
138
|
it('processes colors into numeric AARRGGBB', () => {
|
139
|
|
- navigationOptions.someKeyColor = 'red';
|
|
139
|
+ options.someKeyColor = 'red';
|
140
|
140
|
uut.crawl(node);
|
141
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff0000);
|
|
141
|
+ expect(node.data.options.someKeyColor).toEqual(0xffff0000);
|
142
|
142
|
});
|
143
|
143
|
|
144
|
144
|
it('processes colors into numeric AARRGGBB', () => {
|
145
|
|
- navigationOptions.someKeyColor = 'yellow';
|
|
145
|
+ options.someKeyColor = 'yellow';
|
146
|
146
|
uut.crawl(node);
|
147
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffff00);
|
|
147
|
+ expect(node.data.options.someKeyColor).toEqual(0xffffff00);
|
148
|
148
|
});
|
149
|
149
|
|
150
|
150
|
it('processes numeric colors', () => {
|
151
|
|
- navigationOptions.someKeyColor = '#123456';
|
|
151
|
+ options.someKeyColor = '#123456';
|
152
|
152
|
uut.crawl(node);
|
153
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
|
|
153
|
+ expect(node.data.options.someKeyColor).toEqual(0xff123456);
|
154
|
154
|
});
|
155
|
155
|
|
156
|
156
|
it('processes numeric colors with rrggbbAA', () => {
|
157
|
|
- navigationOptions.someKeyColor = 0x123456ff; // wut
|
|
157
|
+ options.someKeyColor = 0x123456ff; // wut
|
158
|
158
|
uut.crawl(node);
|
159
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
|
|
159
|
+ expect(node.data.options.someKeyColor).toEqual(0xff123456);
|
160
|
160
|
});
|
161
|
161
|
|
162
|
162
|
it('process colors with rgb functions', () => {
|
163
|
|
- navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
|
|
163
|
+ options.someKeyColor = 'rgb(255, 0, 255)';
|
164
|
164
|
uut.crawl(node);
|
165
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
|
|
165
|
+ expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
|
166
|
166
|
});
|
167
|
167
|
|
168
|
168
|
it('process colors with special words', () => {
|
169
|
|
- navigationOptions.someKeyColor = 'fuchsia';
|
|
169
|
+ options.someKeyColor = 'fuchsia';
|
170
|
170
|
uut.crawl(node);
|
171
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
|
|
171
|
+ expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
|
172
|
172
|
});
|
173
|
173
|
|
174
|
174
|
it('process colors with hsla functions', () => {
|
175
|
|
- navigationOptions.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
|
|
175
|
+ options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
|
176
|
176
|
uut.crawl(node);
|
177
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffffff);
|
|
177
|
+ expect(node.data.options.someKeyColor).toEqual(0xffffffff);
|
178
|
178
|
});
|
179
|
179
|
|
180
|
180
|
it('unknown colors return undefined', () => {
|
181
|
|
- navigationOptions.someKeyColor = 'wut';
|
|
181
|
+ options.someKeyColor = 'wut';
|
182
|
182
|
uut.crawl(node);
|
183
|
|
- expect(node.data.navigationOptions.someKeyColor).toEqual(undefined);
|
|
183
|
+ expect(node.data.options.someKeyColor).toEqual(undefined);
|
184
|
184
|
});
|
185
|
185
|
|
186
|
186
|
it('any keys ending with Color', () => {
|
187
|
|
- navigationOptions.otherKeyColor = 'red';
|
188
|
|
- navigationOptions.yetAnotherColor = 'blue';
|
189
|
|
- navigationOptions.andAnotherColor = 'rgb(0, 255, 0)';
|
|
187
|
+ options.otherKeyColor = 'red';
|
|
188
|
+ options.yetAnotherColor = 'blue';
|
|
189
|
+ options.andAnotherColor = 'rgb(0, 255, 0)';
|
190
|
190
|
uut.crawl(node);
|
191
|
|
- expect(node.data.navigationOptions.otherKeyColor).toEqual(0xffff0000);
|
192
|
|
- expect(node.data.navigationOptions.yetAnotherColor).toEqual(0xff0000ff);
|
193
|
|
- expect(node.data.navigationOptions.andAnotherColor).toEqual(0xff00ff00);
|
|
191
|
+ expect(node.data.options.otherKeyColor).toEqual(0xffff0000);
|
|
192
|
+ expect(node.data.options.yetAnotherColor).toEqual(0xff0000ff);
|
|
193
|
+ expect(node.data.options.andAnotherColor).toEqual(0xff00ff00);
|
194
|
194
|
});
|
195
|
195
|
|
196
|
196
|
it('keys ending with Color case sensitive', () => {
|
197
|
|
- navigationOptions.otherKey_color = 'red'; // eslint-disable-line camelcase
|
|
197
|
+ options.otherKey_color = 'red'; // eslint-disable-line camelcase
|
198
|
198
|
uut.crawl(node);
|
199
|
|
- expect(node.data.navigationOptions.otherKey_color).toEqual('red');
|
|
199
|
+ expect(node.data.options.otherKey_color).toEqual('red');
|
200
|
200
|
});
|
201
|
201
|
|
202
|
202
|
it('any nested recursive keys ending with Color', () => {
|
203
|
|
- navigationOptions.innerObj = { theKeyColor: 'red' };
|
204
|
|
- navigationOptions.innerObj.innerMostObj = { anotherColor: 'yellow' };
|
|
203
|
+ options.innerObj = { theKeyColor: 'red' };
|
|
204
|
+ options.innerObj.innerMostObj = { anotherColor: 'yellow' };
|
205
|
205
|
uut.crawl(node);
|
206
|
|
- expect(node.data.navigationOptions.innerObj.theKeyColor).toEqual(0xffff0000);
|
207
|
|
- expect(node.data.navigationOptions.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
|
|
206
|
+ expect(node.data.options.innerObj.theKeyColor).toEqual(0xffff0000);
|
|
207
|
+ expect(node.data.options.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
|
208
|
208
|
});
|
209
|
209
|
});
|
210
|
210
|
});
|