|
@@ -61,6 +61,43 @@ describe('LayoutTreeCrawler', () => {
|
61
|
61
|
expect(node.data.navigationOptions).toEqual(theStyle);
|
62
|
62
|
});
|
63
|
63
|
|
|
64
|
+ it('Containers: merges navigationOptions from container class static property with passed options, favoring passed options', () => {
|
|
65
|
+ const theStyle = {
|
|
66
|
+ bazz: 123,
|
|
67
|
+ inner: {
|
|
68
|
+ foo: 'bar'
|
|
69
|
+ },
|
|
70
|
+ opt: 'exists only in static'
|
|
71
|
+ };
|
|
72
|
+ const MyContainer = class {
|
|
73
|
+ static get navigationOptions() {
|
|
74
|
+ return theStyle;
|
|
75
|
+ }
|
|
76
|
+ };
|
|
77
|
+
|
|
78
|
+ const passedOptions = {
|
|
79
|
+ aaa: 'exists only in passed',
|
|
80
|
+ bazz: 789,
|
|
81
|
+ inner: {
|
|
82
|
+ foo: 'this is overriden'
|
|
83
|
+ }
|
|
84
|
+ };
|
|
85
|
+
|
|
86
|
+ const node = { type: LayoutTypes.Container, data: { name: 'theContainerName', navigationOptions: passedOptions } };
|
|
87
|
+ store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
|
88
|
+
|
|
89
|
+ uut.crawl(node);
|
|
90
|
+
|
|
91
|
+ expect(node.data.navigationOptions).toEqual({
|
|
92
|
+ aaa: 'exists only in passed',
|
|
93
|
+ bazz: 789,
|
|
94
|
+ inner: {
|
|
95
|
+ foo: 'this is overriden'
|
|
96
|
+ },
|
|
97
|
+ opt: 'exists only in static'
|
|
98
|
+ });
|
|
99
|
+ });
|
|
100
|
+
|
64
|
101
|
it('Containers: deepClones navigationOptions', () => {
|
65
|
102
|
const theStyle = {};
|
66
|
103
|
const MyContainer = class {
|
|
@@ -91,25 +128,20 @@ describe('LayoutTreeCrawler', () => {
|
91
|
128
|
|
92
|
129
|
describe('navigation options', () => {
|
93
|
130
|
let navigationOptions;
|
94
|
|
- let MyContainer;
|
95
|
131
|
let node;
|
96
|
132
|
|
97
|
133
|
beforeEach(() => {
|
98
|
134
|
navigationOptions = {};
|
99
|
|
- MyContainer = class {
|
100
|
|
- static get navigationOptions() {
|
101
|
|
- return navigationOptions;
|
102
|
|
- }
|
103
|
|
- };
|
104
|
|
- node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
|
105
|
|
- store.setOriginalContainerClassForName('theContainerName', MyContainer);
|
|
135
|
+ node = { type: LayoutTypes.Container, data: { name: 'theContainerName', navigationOptions } };
|
106
|
136
|
});
|
107
|
137
|
|
108
|
138
|
it('processes colors into numeric AARRGGBB', () => {
|
109
|
139
|
navigationOptions.someKeyColor = 'red';
|
110
|
140
|
uut.crawl(node);
|
111
|
141
|
expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff0000);
|
|
142
|
+ });
|
112
|
143
|
|
|
144
|
+ it('processes colors into numeric AARRGGBB', () => {
|
113
|
145
|
navigationOptions.someKeyColor = 'yellow';
|
114
|
146
|
uut.crawl(node);
|
115
|
147
|
expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffff00);
|
|
@@ -119,7 +151,9 @@ describe('LayoutTreeCrawler', () => {
|
119
|
151
|
navigationOptions.someKeyColor = '#123456';
|
120
|
152
|
uut.crawl(node);
|
121
|
153
|
expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
|
|
154
|
+ });
|
122
|
155
|
|
|
156
|
+ it('processes numeric colors with rrggbbAA', () => {
|
123
|
157
|
navigationOptions.someKeyColor = 0x123456ff; // wut
|
124
|
158
|
uut.crawl(node);
|
125
|
159
|
expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
|