@fluid-experimental/property-properties 0.58.1001 → 0.58.2000-58133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +4 -10
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.d.ts.map +1 -1
- package/dist/enableValidations.js +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +1 -28
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +26 -85
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +9 -71
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +0 -1
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +4 -22
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +2 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +3 -10
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +0 -2
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +7 -38
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js +37 -68
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +6 -18
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +3 -20
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +4 -23
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +0 -3
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +0 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +2 -2
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +3 -16
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +3 -13
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +4 -12
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +3 -22
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +12 -48
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +0 -3
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +3 -45
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +4 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +2 -14
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +35 -72
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +0 -14
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +4 -12
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +82 -82
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +53 -53
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +25 -25
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +35 -35
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +6 -6
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +26 -26
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +22 -22
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +28 -28
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +11 -11
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +25 -25
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +110 -110
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +5 -5
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +160 -160
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +21 -21
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +4 -4
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +32 -32
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +38 -38
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +3 -3
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +28 -28
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +7 -7
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +559 -560
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +38 -38
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +5 -5
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +266 -266
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +145 -145
- package/dist/test/utils.spec.js +508 -517
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +9 -9
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +5 -5
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +42 -42
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +2 -2
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +9 -9
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.js +4 -10
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +1 -28
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.js +26 -85
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.js +7 -69
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.js +0 -1
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.js +4 -22
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.js +2 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.js +3 -10
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +0 -2
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.js +7 -38
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +6 -18
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.js +3 -20
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.js +4 -23
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.js +0 -3
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.js +0 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +2 -2
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.js +3 -16
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.js +3 -13
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.js +4 -12
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.js +3 -22
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.js +12 -48
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +0 -3
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.js +3 -45
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.js +4 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.js +2 -14
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.js +35 -72
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.js +0 -14
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.js +4 -12
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +13 -6
|
@@ -15,8 +15,8 @@ describe('Property Template Wrapper', function () {
|
|
|
15
15
|
var noParents = {
|
|
16
16
|
typeid: 'SimpleTest:NoParents-1.0.0',
|
|
17
17
|
properties: [
|
|
18
|
-
{ id: 'area', typeid: 'Float32' }
|
|
19
|
-
]
|
|
18
|
+
{ id: 'area', typeid: 'Float32' },
|
|
19
|
+
],
|
|
20
20
|
};
|
|
21
21
|
PropertyFactory.register(noParents);
|
|
22
22
|
var wrapper = PropertyFactory._getWrapper('SimpleTest:NoParents-1.0.0');
|
|
@@ -28,23 +28,23 @@ describe('Property Template Wrapper', function () {
|
|
|
28
28
|
typeid: 'SimpleTest:WithParents-1.0.0',
|
|
29
29
|
inherits: [
|
|
30
30
|
'SimpleTest:Parent1-1.0.0',
|
|
31
|
-
'SimpleTest:Parent2-1.0.0'
|
|
31
|
+
'SimpleTest:Parent2-1.0.0',
|
|
32
32
|
],
|
|
33
33
|
properties: [
|
|
34
|
-
{ id: 'area', typeid: 'Float32' }
|
|
35
|
-
]
|
|
34
|
+
{ id: 'area', typeid: 'Float32' },
|
|
35
|
+
],
|
|
36
36
|
};
|
|
37
37
|
var parent1 = {
|
|
38
38
|
typeid: 'SimpleTest:Parent1-1.0.0',
|
|
39
39
|
properties: [
|
|
40
|
-
{ id: 'parent1Prop', typeid: 'Float32' }
|
|
41
|
-
]
|
|
40
|
+
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
41
|
+
],
|
|
42
42
|
};
|
|
43
43
|
var parent2 = {
|
|
44
44
|
typeid: 'SimpleTest:Parent2-1.0.0',
|
|
45
45
|
properties: [
|
|
46
|
-
{ id: 'parent2Prop', typeid: 'Float32' }
|
|
47
|
-
]
|
|
46
|
+
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
47
|
+
],
|
|
48
48
|
};
|
|
49
49
|
PropertyFactory._reregister(parent1);
|
|
50
50
|
PropertyFactory._reregister(parent2);
|
|
@@ -54,7 +54,7 @@ describe('Property Template Wrapper', function () {
|
|
|
54
54
|
expect(compiledTemplate.properties).to.deep.equal([
|
|
55
55
|
{ id: 'area', typeid: 'Float32' },
|
|
56
56
|
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
57
|
-
{ id: 'parent2Prop', typeid: 'Float32' }
|
|
57
|
+
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
58
58
|
]);
|
|
59
59
|
});
|
|
60
60
|
it('should contain constants from parent templates', function () {
|
|
@@ -62,23 +62,23 @@ describe('Property Template Wrapper', function () {
|
|
|
62
62
|
typeid: 'SimpleTest:WithParents-1.0.0',
|
|
63
63
|
inherits: [
|
|
64
64
|
'SimpleTest:Parent1-1.0.0',
|
|
65
|
-
'SimpleTest:Parent2-1.0.0'
|
|
65
|
+
'SimpleTest:Parent2-1.0.0',
|
|
66
66
|
],
|
|
67
67
|
constants: [
|
|
68
|
-
{ id: 'area', typeid: 'Float32' }
|
|
69
|
-
]
|
|
68
|
+
{ id: 'area', typeid: 'Float32' },
|
|
69
|
+
],
|
|
70
70
|
};
|
|
71
71
|
var parent1 = {
|
|
72
72
|
typeid: 'SimpleTest:Parent1-1.0.0',
|
|
73
73
|
constants: [
|
|
74
|
-
{ id: 'parent1Prop', typeid: 'Float32' }
|
|
75
|
-
]
|
|
74
|
+
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
75
|
+
],
|
|
76
76
|
};
|
|
77
77
|
var parent2 = {
|
|
78
78
|
typeid: 'SimpleTest:Parent2-1.0.0',
|
|
79
79
|
constants: [
|
|
80
|
-
{ id: 'parent2Prop', typeid: 'Float32' }
|
|
81
|
-
]
|
|
80
|
+
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
81
|
+
],
|
|
82
82
|
};
|
|
83
83
|
PropertyFactory._reregister(parent1);
|
|
84
84
|
PropertyFactory._reregister(parent2);
|
|
@@ -88,55 +88,55 @@ describe('Property Template Wrapper', function () {
|
|
|
88
88
|
expect(compiledTemplate.constants).to.deep.equal([
|
|
89
89
|
{ id: 'area', typeid: 'Float32' },
|
|
90
90
|
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
91
|
-
{ id: 'parent2Prop', typeid: 'Float32' }
|
|
91
|
+
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
92
92
|
]);
|
|
93
93
|
});
|
|
94
94
|
it('should merge property if found in both child and parent', function () {
|
|
95
95
|
var withParents = {
|
|
96
96
|
typeid: 'SimpleTest:WithParents-1.0.0',
|
|
97
97
|
inherits: [
|
|
98
|
-
'SimpleTest:Parent1-1.0.0'
|
|
98
|
+
'SimpleTest:Parent1-1.0.0',
|
|
99
99
|
],
|
|
100
100
|
properties: [
|
|
101
|
-
{ id: 'area', value: '1.1' }
|
|
102
|
-
]
|
|
101
|
+
{ id: 'area', value: '1.1' },
|
|
102
|
+
],
|
|
103
103
|
};
|
|
104
104
|
var parent1 = {
|
|
105
105
|
typeid: 'SimpleTest:Parent1-1.0.0',
|
|
106
106
|
properties: [
|
|
107
|
-
{ id: 'area', context: 'array', typeid: 'Float32' }
|
|
108
|
-
]
|
|
107
|
+
{ id: 'area', context: 'array', typeid: 'Float32' },
|
|
108
|
+
],
|
|
109
109
|
};
|
|
110
110
|
PropertyFactory._reregister(parent1);
|
|
111
111
|
PropertyFactory._reregister(withParents);
|
|
112
112
|
var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');
|
|
113
113
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
114
114
|
expect(compiledTemplate.properties).to.deep.equal([
|
|
115
|
-
{ id: 'area', context: 'array', typeid: 'Float32', value: '1.1' }
|
|
115
|
+
{ id: 'area', context: 'array', typeid: 'Float32', value: '1.1' },
|
|
116
116
|
]);
|
|
117
117
|
});
|
|
118
118
|
it('should merge constant if found in both child and parent', function () {
|
|
119
119
|
var withParents = {
|
|
120
120
|
typeid: 'SimpleTest:WithParents-1.0.0',
|
|
121
121
|
inherits: [
|
|
122
|
-
'SimpleTest:Parent1-1.0.0'
|
|
122
|
+
'SimpleTest:Parent1-1.0.0',
|
|
123
123
|
],
|
|
124
124
|
constants: [
|
|
125
|
-
{ id: 'area', value: '1.1' }
|
|
126
|
-
]
|
|
125
|
+
{ id: 'area', value: '1.1' },
|
|
126
|
+
],
|
|
127
127
|
};
|
|
128
128
|
var parent1 = {
|
|
129
129
|
typeid: 'SimpleTest:Parent1-1.0.0',
|
|
130
130
|
constants: [
|
|
131
|
-
{ id: 'area', context: 'array', typeid: 'Float32' }
|
|
132
|
-
]
|
|
131
|
+
{ id: 'area', context: 'array', typeid: 'Float32' },
|
|
132
|
+
],
|
|
133
133
|
};
|
|
134
134
|
PropertyFactory._reregister(parent1);
|
|
135
135
|
PropertyFactory._reregister(withParents);
|
|
136
136
|
var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');
|
|
137
137
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
138
138
|
expect(compiledTemplate.constants).to.deep.equal([
|
|
139
|
-
{ id: 'area', context: 'array', typeid: 'Float32', value: '1.1' }
|
|
139
|
+
{ id: 'area', context: 'array', typeid: 'Float32', value: '1.1' },
|
|
140
140
|
]);
|
|
141
141
|
});
|
|
142
142
|
it('should throw error if schema inherits from more than one creation type', function () {
|
|
@@ -149,22 +149,22 @@ describe('Property Template Wrapper', function () {
|
|
|
149
149
|
{
|
|
150
150
|
id: 'area', properties: [
|
|
151
151
|
{ id: 'length', typeid: 'Float32' }
|
|
152
|
-
]
|
|
152
|
+
],
|
|
153
153
|
}
|
|
154
|
-
]
|
|
154
|
+
],
|
|
155
155
|
}
|
|
156
|
-
]
|
|
156
|
+
],
|
|
157
157
|
};
|
|
158
158
|
expect(() => { PropertyFactory.register(badTemplate); }).to.throw();
|
|
159
159
|
});
|
|
160
160
|
it('should throw error if schema indirectly inherits from more than one creation type', function () {
|
|
161
161
|
var badParent1 = {
|
|
162
162
|
typeid: 'SimpleTest:BadParent1-1.0.0',
|
|
163
|
-
inherits: ['NodeProperty']
|
|
163
|
+
inherits: ['NodeProperty'],
|
|
164
164
|
};
|
|
165
165
|
var badParent2 = {
|
|
166
166
|
typeid: 'SimpleTest:BadParent2-1.0.0',
|
|
167
|
-
inherits: ['Binary']
|
|
167
|
+
inherits: ['Binary'],
|
|
168
168
|
};
|
|
169
169
|
var badTemplate = {
|
|
170
170
|
typeid: 'SimpleTest:IndirectBadTemplate-1.0.0',
|
|
@@ -175,11 +175,11 @@ describe('Property Template Wrapper', function () {
|
|
|
175
175
|
{
|
|
176
176
|
id: 'area', properties: [
|
|
177
177
|
{ id: 'length', typeid: 'Float32' }
|
|
178
|
-
]
|
|
178
|
+
],
|
|
179
179
|
}
|
|
180
|
-
]
|
|
180
|
+
],
|
|
181
181
|
}
|
|
182
|
-
]
|
|
182
|
+
],
|
|
183
183
|
};
|
|
184
184
|
expect(() => {
|
|
185
185
|
PropertyFactory.register(badTemplate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTemplateWrapper.spec.js","sourceRoot":"","sources":["../../src/test/propertyTemplateWrapper.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AACb,0CAA0C;AAC1C;;;GAGG;AACH,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1C,QAAQ,CAAC,2BAA2B,EAAE;IAClC,QAAQ,CAAC,4BAA4B,EAAE;QACnC,EAAE,CAAC,kDAAkD,EAAE;YACnD,IAAI,SAAS,GAAG;gBACZ,MAAM,EAAE,4BAA4B;gBACpC,UAAU,EAAE;oBACR,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE;iBACpC;aACJ,CAAC;YAEF,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACpC,IAAI,OAAO,GAAG,eAAe,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;YAExE,IAAI,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;YAEpE,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE;YAClD,IAAI,WAAW,GAAG;gBACd,MAAM,EAAE,8BAA8B;gBACtC,QAAQ,EAAE;oBACN,0BAA0B;oBAC1B,0BAA0B;iBAC7B;gBACD,UAAU,EAAE;oBACR,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE;iBACpC;aACJ,CAAC;YAEF,IAAI,OAAO,GAAG;gBACV,MAAM,EAAE,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eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBACrC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* globals */\n/* eslint-disable no-unused-expressions */\n/**\n * @fileoverview In this file, we will test the functions of a PropertyTemplateWrapper object\n * described in /src/property_template_wrapper.js\n */\nconst { PropertyFactory } = require('..');\n\ndescribe('Property Template Wrapper', function () {\n describe('Compiled Template Creation', function () {\n it('should work for template that has no inheritence', function () {\n var noParents = {\n typeid: 'SimpleTest:NoParents-1.0.0',\n properties: [\n { id: 'area', typeid: 'Float32' }\n ]\n };\n\n PropertyFactory.register(noParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:NoParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate).to.deep.equal(wrapper.getPropertyTemplate());\n });\n\n it('should contain properties from parent templates', function () {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n 'SimpleTest:Parent2-1.0.0'\n ],\n properties: [\n { id: 'area', typeid: 'Float32' }\n ]\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n properties: [\n { id: 'parent1Prop', typeid: 'Float32' }\n ]\n };\n\n var parent2 = {\n typeid: 'SimpleTest:Parent2-1.0.0',\n properties: [\n { id: 'parent2Prop', typeid: 'Float32' }\n ]\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(parent2);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.properties).to.deep.equal([\n { id: 'area', typeid: 'Float32' },\n { id: 'parent1Prop', typeid: 'Float32' },\n { id: 'parent2Prop', typeid: 'Float32' }\n ]);\n });\n\n it('should contain constants from parent templates', function () {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n 'SimpleTest:Parent2-1.0.0'\n ],\n constants: [\n { id: 'area', typeid: 'Float32' }\n ]\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n constants: [\n { id: 'parent1Prop', typeid: 'Float32' }\n ]\n };\n\n var parent2 = {\n typeid: 'SimpleTest:Parent2-1.0.0',\n constants: [\n { id: 'parent2Prop', typeid: 'Float32' }\n ]\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(parent2);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.constants).to.deep.equal([\n { id: 'area', typeid: 'Float32' },\n { id: 'parent1Prop', typeid: 'Float32' },\n { id: 'parent2Prop', typeid: 'Float32' }\n ]);\n });\n\n it('should merge property if found in both child and parent', function () {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0'\n ],\n properties: [\n { id: 'area', value: '1.1' }\n ]\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n properties: [\n { id: 'area', context: 'array', typeid: 'Float32' }\n ]\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.properties).to.deep.equal([\n { id: 'area', context: 'array', typeid: 'Float32', value: '1.1' }\n ]);\n });\n\n it('should merge constant if found in both child and parent', function () {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0'\n ],\n constants: [\n { id: 'area', value: '1.1' }\n ]\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n constants: [\n { id: 'area', context: 'array', typeid: 'Float32' }\n ]\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.constants).to.deep.equal([\n { id: 'area', context: 'array', typeid: 'Float32', value: '1.1' }\n ]);\n });\n\n it('should throw error if schema inherits from more than one creation type', function () {\n var badTemplate = {\n typeid: 'SimpleTest:BadTemplate-1.0.0',\n inherits: ['NodeProperty', 'Binary'],\n properties: [\n {\n id: 'props', properties: [\n {\n id: 'area', properties: [\n { id: 'length', typeid: 'Float32' }]\n }]\n }]\n };\n\n expect(() => { PropertyFactory.register(badTemplate) }).to.throw();\n });\n\n it('should throw error if schema indirectly inherits from more than one creation type', function () {\n var badParent1 = {\n typeid: 'SimpleTest:BadParent1-1.0.0',\n inherits: ['NodeProperty']\n };\n\n var badParent2 = {\n typeid: 'SimpleTest:BadParent2-1.0.0',\n inherits: ['Binary']\n };\n\n var badTemplate = {\n typeid: 'SimpleTest:IndirectBadTemplate-1.0.0',\n inherits: ['SimpleTest:BadParent1-1.0.0', 'SimpleTest:BadParent2-1.0.0'],\n properties: [\n {\n id: 'props', properties: [\n {\n id: 'area', properties: [\n { id: 'length', typeid: 'Float32' }]\n }]\n }]\n };\n\n expect(() => {\n PropertyFactory.register(badTemplate);\n PropertyFactory.register(badParent1);\n PropertyFactory.register(badParent2);\n }).to.throw();\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTemplateWrapper.spec.js","sourceRoot":"","sources":["../../src/test/propertyTemplateWrapper.spec.js"],"names":[],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) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* globals */\n/* eslint-disable no-unused-expressions */\n/**\n * @fileoverview In this file, we will test the functions of a PropertyTemplateWrapper object\n * described in /src/property_template_wrapper.js\n */\nconst { PropertyFactory } = require('..');\n\ndescribe('Property Template Wrapper', function() {\n describe('Compiled Template Creation', function() {\n it('should work for template that has no inheritence', function() {\n var noParents = {\n typeid: 'SimpleTest:NoParents-1.0.0',\n properties: [\n { id: 'area', typeid: 'Float32' },\n ],\n };\n\n PropertyFactory.register(noParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:NoParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate).to.deep.equal(wrapper.getPropertyTemplate());\n });\n\n it('should contain properties from parent templates', function() {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n 'SimpleTest:Parent2-1.0.0',\n ],\n properties: [\n { id: 'area', typeid: 'Float32' },\n ],\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n properties: [\n { id: 'parent1Prop', typeid: 'Float32' },\n ],\n };\n\n var parent2 = {\n typeid: 'SimpleTest:Parent2-1.0.0',\n properties: [\n { id: 'parent2Prop', typeid: 'Float32' },\n ],\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(parent2);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.properties).to.deep.equal([\n { id: 'area', typeid: 'Float32' },\n { id: 'parent1Prop', typeid: 'Float32' },\n { id: 'parent2Prop', typeid: 'Float32' },\n ]);\n });\n\n it('should contain constants from parent templates', function() {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n 'SimpleTest:Parent2-1.0.0',\n ],\n constants: [\n { id: 'area', typeid: 'Float32' },\n ],\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n constants: [\n { id: 'parent1Prop', typeid: 'Float32' },\n ],\n };\n\n var parent2 = {\n typeid: 'SimpleTest:Parent2-1.0.0',\n constants: [\n { id: 'parent2Prop', typeid: 'Float32' },\n ],\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(parent2);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.constants).to.deep.equal([\n { id: 'area', typeid: 'Float32' },\n { id: 'parent1Prop', typeid: 'Float32' },\n { id: 'parent2Prop', typeid: 'Float32' },\n ]);\n });\n\n it('should merge property if found in both child and parent', function() {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n ],\n properties: [\n { id: 'area', value: '1.1' },\n ],\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n properties: [\n { id: 'area', context: 'array', typeid: 'Float32' },\n ],\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.properties).to.deep.equal([\n { id: 'area', context: 'array', typeid: 'Float32', value: '1.1' },\n ]);\n });\n\n it('should merge constant if found in both child and parent', function() {\n var withParents = {\n typeid: 'SimpleTest:WithParents-1.0.0',\n inherits: [\n 'SimpleTest:Parent1-1.0.0',\n ],\n constants: [\n { id: 'area', value: '1.1' },\n ],\n };\n\n var parent1 = {\n typeid: 'SimpleTest:Parent1-1.0.0',\n constants: [\n { id: 'area', context: 'array', typeid: 'Float32' },\n ],\n };\n\n PropertyFactory._reregister(parent1);\n PropertyFactory._reregister(withParents);\n var wrapper = PropertyFactory._getWrapper('SimpleTest:WithParents-1.0.0');\n\n var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n expect(compiledTemplate.constants).to.deep.equal([\n { id: 'area', context: 'array', typeid: 'Float32', value: '1.1' },\n ]);\n });\n\n it('should throw error if schema inherits from more than one creation type', function() {\n var badTemplate = {\n typeid: 'SimpleTest:BadTemplate-1.0.0',\n inherits: ['NodeProperty', 'Binary'],\n properties: [\n {\n id: 'props', properties: [\n {\n id: 'area', properties: [\n { id: 'length', typeid: 'Float32' }],\n }],\n }],\n };\n\n expect(() => { PropertyFactory.register(badTemplate); }).to.throw();\n });\n\n it('should throw error if schema indirectly inherits from more than one creation type', function() {\n var badParent1 = {\n typeid: 'SimpleTest:BadParent1-1.0.0',\n inherits: ['NodeProperty'],\n };\n\n var badParent2 = {\n typeid: 'SimpleTest:BadParent2-1.0.0',\n inherits: ['Binary'],\n };\n\n var badTemplate = {\n typeid: 'SimpleTest:IndirectBadTemplate-1.0.0',\n inherits: ['SimpleTest:BadParent1-1.0.0', 'SimpleTest:BadParent2-1.0.0'],\n properties: [\n {\n id: 'props', properties: [\n {\n id: 'area', properties: [\n { id: 'length', typeid: 'Float32' }],\n }],\n }],\n };\n\n expect(() => {\n PropertyFactory.register(badTemplate);\n PropertyFactory.register(badParent1);\n PropertyFactory.register(badParent2);\n }).to.throw();\n });\n });\n});\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/* globals assert */
|
|
6
|
-
/* eslint-disable no-unused-expressions*/
|
|
6
|
+
/* eslint-disable no-unused-expressions */
|
|
7
7
|
/* eslint-disable max-nested-callbacks */
|
|
8
8
|
/* eslint-disable max-len */
|
|
9
9
|
/**
|
|
@@ -24,10 +24,10 @@ describe('PropertyUtils', function () {
|
|
|
24
24
|
{
|
|
25
25
|
id: 'nested', properties: [
|
|
26
26
|
{ id: 'c', typeid: 'Float64' },
|
|
27
|
-
{ id: 'd', typeid: 'String' }
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
27
|
+
{ id: 'd', typeid: 'String' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
31
|
};
|
|
32
32
|
PropertyFactory.register(testTemplate);
|
|
33
33
|
var myProperty = PropertyFactory.create('autodesk.test:testProp-1.0.0');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyUtils.spec.js","sourceRoot":"","sources":["../../src/test/propertyUtils.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,
|
|
1
|
+
{"version":3,"file":"propertyUtils.spec.js","sourceRoot":"","sources":["../../src/test/propertyUtils.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,0CAA0C;AAC1C,yCAAyC;AACzC,4BAA4B;AAE5B;;;GAGG;AAEH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExC,QAAQ,CAAC,eAAe,EAAE;IACtB,QAAQ,CAAC,gCAAgC,EAAE;QACvC,EAAE,CAAC,6DAA6D,EAAE;YAC9D,IAAI,YAAY,GAAG;gBACf,MAAM,EAAE,8BAA8B;gBACtC,UAAU,EAAE;oBACR,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;oBAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE;oBAC7B;wBACI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE;4BACtB,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;4BAC9B,EAAE,EAAE,EAAE,GAA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* eslint-disable no-unused-expressions */\n/* eslint-disable max-nested-callbacks */\n/* eslint-disable max-len */\n\n/**\n * @fileoverview In this file, we will test the utils\n * described in /src/utils.js\n */\n\nconst _ = require('lodash');\nconst { PropertyFactory } = require('..');\nconst { PropertyUtils } = require('..');\n\ndescribe('PropertyUtils', function() {\n describe('PropertyUtils.gatherProperties', function() {\n it('should return a list of properties that match the predicate', function() {\n var testTemplate = {\n typeid: 'autodesk.test:testProp-1.0.0',\n properties: [\n { id: 'a', typeid: 'Float64' },\n { id: 'b', typeid: 'String' },\n {\n id: 'nested', properties: [\n { id: 'c', typeid: 'Float64' },\n { id: 'd', typeid: 'String' },\n ],\n },\n ],\n };\n PropertyFactory.register(testTemplate);\n var myProperty = PropertyFactory.create('autodesk.test:testProp-1.0.0');\n myProperty.get('a').setValue(3);\n myProperty.get('b').setValue('Hello');\n myProperty.get('nested').get('c').setValue(42);\n myProperty.get('nested').get('d').setValue('Hello again!');\n\n var result = PropertyUtils.gatherProperties(myProperty, function(property) {\n return _.isNumber(property.value);\n });\n expect(result['a']).to.exist;\n expect(result['b']).to.not.exist;\n expect(result['nested.c']).to.exist;\n expect(result['nested.d']).to.not.exist;\n });\n });\n});\n"]}
|