|
@@ -67,6 +67,32 @@ describe('LayoutTreeCrawler', () => {
|
67
|
67
|
expect(node.data.options).toEqual(theStyle);
|
68
|
68
|
});
|
69
|
69
|
|
|
70
|
+ it('Components: passes passProps to the static options function to be used by the user', () => {
|
|
71
|
+ const MyComponent = class {
|
|
72
|
+ static options(passProps) {
|
|
73
|
+ return { foo: passProps.bar.baz.value };
|
|
74
|
+ }
|
|
75
|
+ };
|
|
76
|
+
|
|
77
|
+ const node: any = { type: LayoutType.Component, data: { name: 'theComponentName', passProps: { bar: { baz: { value: 'hello' } } } } };
|
|
78
|
+ store.setOriginalComponentClassForName('theComponentName', MyComponent);
|
|
79
|
+ uut.crawl(node);
|
|
80
|
+ expect(node.data.options).toEqual({ foo: 'hello' });
|
|
81
|
+ });
|
|
82
|
+
|
|
83
|
+ it('Components: passProps in the static options is optional', () => {
|
|
84
|
+ const MyComponent = class {
|
|
85
|
+ static options(passProps) {
|
|
86
|
+ return { foo: passProps };
|
|
87
|
+ }
|
|
88
|
+ };
|
|
89
|
+
|
|
90
|
+ const node: any = { type: LayoutType.Component, data: { name: 'theComponentName' } };
|
|
91
|
+ store.setOriginalComponentClassForName('theComponentName', MyComponent);
|
|
92
|
+ uut.crawl(node);
|
|
93
|
+ expect(node.data.options).toEqual({ foo: {} });
|
|
94
|
+ });
|
|
95
|
+
|
70
|
96
|
it('Components: merges options from component class static property with passed options, favoring passed options', () => {
|
71
|
97
|
const theStyle = {
|
72
|
98
|
bazz: 123,
|