@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
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/README.md +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- 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 +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- 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 +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -7,177 +7,147 @@
|
|
|
7
7
|
* @fileoverview
|
|
8
8
|
* In this file, we will test the functions of a PropertyTemplateWrapper object described in /src/property_template_wrapper.js
|
|
9
9
|
*/
|
|
10
|
-
const { PropertyFactory } = require(
|
|
11
|
-
describe(
|
|
12
|
-
describe(
|
|
13
|
-
it(
|
|
10
|
+
const { PropertyFactory } = require("..");
|
|
11
|
+
describe("Property Template Wrapper", function () {
|
|
12
|
+
describe("Compiled Template Creation", function () {
|
|
13
|
+
it("should work for template that has no inheritence", function () {
|
|
14
14
|
var noParents = {
|
|
15
|
-
typeid:
|
|
16
|
-
properties: [
|
|
17
|
-
{ id: 'area', typeid: 'Float32' },
|
|
18
|
-
],
|
|
15
|
+
typeid: "SimpleTest:NoParents-1.0.0",
|
|
16
|
+
properties: [{ id: "area", typeid: "Float32" }],
|
|
19
17
|
};
|
|
20
18
|
PropertyFactory.register(noParents);
|
|
21
|
-
var wrapper = PropertyFactory._getWrapper(
|
|
19
|
+
var wrapper = PropertyFactory._getWrapper("SimpleTest:NoParents-1.0.0");
|
|
22
20
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
23
21
|
expect(compiledTemplate).to.deep.equal(wrapper.getPropertyTemplate());
|
|
24
22
|
});
|
|
25
|
-
it(
|
|
23
|
+
it("should contain properties from parent templates", function () {
|
|
26
24
|
var withParents = {
|
|
27
|
-
typeid:
|
|
28
|
-
inherits: [
|
|
29
|
-
|
|
30
|
-
'SimpleTest:Parent2-1.0.0',
|
|
31
|
-
],
|
|
32
|
-
properties: [
|
|
33
|
-
{ id: 'area', typeid: 'Float32' },
|
|
34
|
-
],
|
|
25
|
+
typeid: "SimpleTest:WithParents-1.0.0",
|
|
26
|
+
inherits: ["SimpleTest:Parent1-1.0.0", "SimpleTest:Parent2-1.0.0"],
|
|
27
|
+
properties: [{ id: "area", typeid: "Float32" }],
|
|
35
28
|
};
|
|
36
29
|
var parent1 = {
|
|
37
|
-
typeid:
|
|
38
|
-
properties: [
|
|
39
|
-
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
40
|
-
],
|
|
30
|
+
typeid: "SimpleTest:Parent1-1.0.0",
|
|
31
|
+
properties: [{ id: "parent1Prop", typeid: "Float32" }],
|
|
41
32
|
};
|
|
42
33
|
var parent2 = {
|
|
43
|
-
typeid:
|
|
44
|
-
properties: [
|
|
45
|
-
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
46
|
-
],
|
|
34
|
+
typeid: "SimpleTest:Parent2-1.0.0",
|
|
35
|
+
properties: [{ id: "parent2Prop", typeid: "Float32" }],
|
|
47
36
|
};
|
|
48
37
|
PropertyFactory._reregister(parent1);
|
|
49
38
|
PropertyFactory._reregister(parent2);
|
|
50
39
|
PropertyFactory._reregister(withParents);
|
|
51
|
-
var wrapper = PropertyFactory._getWrapper(
|
|
40
|
+
var wrapper = PropertyFactory._getWrapper("SimpleTest:WithParents-1.0.0");
|
|
52
41
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
53
42
|
expect(compiledTemplate.properties).to.deep.equal([
|
|
54
|
-
{ id:
|
|
55
|
-
{ id:
|
|
56
|
-
{ id:
|
|
43
|
+
{ id: "area", typeid: "Float32" },
|
|
44
|
+
{ id: "parent1Prop", typeid: "Float32" },
|
|
45
|
+
{ id: "parent2Prop", typeid: "Float32" },
|
|
57
46
|
]);
|
|
58
47
|
});
|
|
59
|
-
it(
|
|
48
|
+
it("should contain constants from parent templates", function () {
|
|
60
49
|
var withParents = {
|
|
61
|
-
typeid:
|
|
62
|
-
inherits: [
|
|
63
|
-
|
|
64
|
-
'SimpleTest:Parent2-1.0.0',
|
|
65
|
-
],
|
|
66
|
-
constants: [
|
|
67
|
-
{ id: 'area', typeid: 'Float32' },
|
|
68
|
-
],
|
|
50
|
+
typeid: "SimpleTest:WithParents-1.0.0",
|
|
51
|
+
inherits: ["SimpleTest:Parent1-1.0.0", "SimpleTest:Parent2-1.0.0"],
|
|
52
|
+
constants: [{ id: "area", typeid: "Float32" }],
|
|
69
53
|
};
|
|
70
54
|
var parent1 = {
|
|
71
|
-
typeid:
|
|
72
|
-
constants: [
|
|
73
|
-
{ id: 'parent1Prop', typeid: 'Float32' },
|
|
74
|
-
],
|
|
55
|
+
typeid: "SimpleTest:Parent1-1.0.0",
|
|
56
|
+
constants: [{ id: "parent1Prop", typeid: "Float32" }],
|
|
75
57
|
};
|
|
76
58
|
var parent2 = {
|
|
77
|
-
typeid:
|
|
78
|
-
constants: [
|
|
79
|
-
{ id: 'parent2Prop', typeid: 'Float32' },
|
|
80
|
-
],
|
|
59
|
+
typeid: "SimpleTest:Parent2-1.0.0",
|
|
60
|
+
constants: [{ id: "parent2Prop", typeid: "Float32" }],
|
|
81
61
|
};
|
|
82
62
|
PropertyFactory._reregister(parent1);
|
|
83
63
|
PropertyFactory._reregister(parent2);
|
|
84
64
|
PropertyFactory._reregister(withParents);
|
|
85
|
-
var wrapper = PropertyFactory._getWrapper(
|
|
65
|
+
var wrapper = PropertyFactory._getWrapper("SimpleTest:WithParents-1.0.0");
|
|
86
66
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
87
67
|
expect(compiledTemplate.constants).to.deep.equal([
|
|
88
|
-
{ id:
|
|
89
|
-
{ id:
|
|
90
|
-
{ id:
|
|
68
|
+
{ id: "area", typeid: "Float32" },
|
|
69
|
+
{ id: "parent1Prop", typeid: "Float32" },
|
|
70
|
+
{ id: "parent2Prop", typeid: "Float32" },
|
|
91
71
|
]);
|
|
92
72
|
});
|
|
93
|
-
it(
|
|
73
|
+
it("should merge property if found in both child and parent", function () {
|
|
94
74
|
var withParents = {
|
|
95
|
-
typeid:
|
|
96
|
-
inherits: [
|
|
97
|
-
|
|
98
|
-
],
|
|
99
|
-
properties: [
|
|
100
|
-
{ id: 'area', value: '1.1' },
|
|
101
|
-
],
|
|
75
|
+
typeid: "SimpleTest:WithParents-1.0.0",
|
|
76
|
+
inherits: ["SimpleTest:Parent1-1.0.0"],
|
|
77
|
+
properties: [{ id: "area", value: "1.1" }],
|
|
102
78
|
};
|
|
103
79
|
var parent1 = {
|
|
104
|
-
typeid:
|
|
105
|
-
properties: [
|
|
106
|
-
{ id: 'area', context: 'array', typeid: 'Float32' },
|
|
107
|
-
],
|
|
80
|
+
typeid: "SimpleTest:Parent1-1.0.0",
|
|
81
|
+
properties: [{ id: "area", context: "array", typeid: "Float32" }],
|
|
108
82
|
};
|
|
109
83
|
PropertyFactory._reregister(parent1);
|
|
110
84
|
PropertyFactory._reregister(withParents);
|
|
111
|
-
var wrapper = PropertyFactory._getWrapper(
|
|
85
|
+
var wrapper = PropertyFactory._getWrapper("SimpleTest:WithParents-1.0.0");
|
|
112
86
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
113
87
|
expect(compiledTemplate.properties).to.deep.equal([
|
|
114
|
-
{ id:
|
|
88
|
+
{ id: "area", context: "array", typeid: "Float32", value: "1.1" },
|
|
115
89
|
]);
|
|
116
90
|
});
|
|
117
|
-
it(
|
|
91
|
+
it("should merge constant if found in both child and parent", function () {
|
|
118
92
|
var withParents = {
|
|
119
|
-
typeid:
|
|
120
|
-
inherits: [
|
|
121
|
-
|
|
122
|
-
],
|
|
123
|
-
constants: [
|
|
124
|
-
{ id: 'area', value: '1.1' },
|
|
125
|
-
],
|
|
93
|
+
typeid: "SimpleTest:WithParents-1.0.0",
|
|
94
|
+
inherits: ["SimpleTest:Parent1-1.0.0"],
|
|
95
|
+
constants: [{ id: "area", value: "1.1" }],
|
|
126
96
|
};
|
|
127
97
|
var parent1 = {
|
|
128
|
-
typeid:
|
|
129
|
-
constants: [
|
|
130
|
-
{ id: 'area', context: 'array', typeid: 'Float32' },
|
|
131
|
-
],
|
|
98
|
+
typeid: "SimpleTest:Parent1-1.0.0",
|
|
99
|
+
constants: [{ id: "area", context: "array", typeid: "Float32" }],
|
|
132
100
|
};
|
|
133
101
|
PropertyFactory._reregister(parent1);
|
|
134
102
|
PropertyFactory._reregister(withParents);
|
|
135
|
-
var wrapper = PropertyFactory._getWrapper(
|
|
103
|
+
var wrapper = PropertyFactory._getWrapper("SimpleTest:WithParents-1.0.0");
|
|
136
104
|
var compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);
|
|
137
105
|
expect(compiledTemplate.constants).to.deep.equal([
|
|
138
|
-
{ id:
|
|
106
|
+
{ id: "area", context: "array", typeid: "Float32", value: "1.1" },
|
|
139
107
|
]);
|
|
140
108
|
});
|
|
141
|
-
it(
|
|
109
|
+
it("should throw error if schema inherits from more than one creation type", function () {
|
|
142
110
|
var badTemplate = {
|
|
143
|
-
typeid:
|
|
144
|
-
inherits: [
|
|
111
|
+
typeid: "SimpleTest:BadTemplate-1.0.0",
|
|
112
|
+
inherits: ["NodeProperty", "Binary"],
|
|
145
113
|
properties: [
|
|
146
114
|
{
|
|
147
|
-
id:
|
|
115
|
+
id: "props",
|
|
116
|
+
properties: [
|
|
148
117
|
{
|
|
149
|
-
id:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
118
|
+
id: "area",
|
|
119
|
+
properties: [{ id: "length", typeid: "Float32" }],
|
|
120
|
+
},
|
|
153
121
|
],
|
|
154
|
-
}
|
|
122
|
+
},
|
|
155
123
|
],
|
|
156
124
|
};
|
|
157
|
-
expect(() => {
|
|
125
|
+
expect(() => {
|
|
126
|
+
PropertyFactory.register(badTemplate);
|
|
127
|
+
}).to.throw();
|
|
158
128
|
});
|
|
159
|
-
it(
|
|
129
|
+
it("should throw error if schema indirectly inherits from more than one creation type", function () {
|
|
160
130
|
var badParent1 = {
|
|
161
|
-
typeid:
|
|
162
|
-
inherits: [
|
|
131
|
+
typeid: "SimpleTest:BadParent1-1.0.0",
|
|
132
|
+
inherits: ["NodeProperty"],
|
|
163
133
|
};
|
|
164
134
|
var badParent2 = {
|
|
165
|
-
typeid:
|
|
166
|
-
inherits: [
|
|
135
|
+
typeid: "SimpleTest:BadParent2-1.0.0",
|
|
136
|
+
inherits: ["Binary"],
|
|
167
137
|
};
|
|
168
138
|
var badTemplate = {
|
|
169
|
-
typeid:
|
|
170
|
-
inherits: [
|
|
139
|
+
typeid: "SimpleTest:IndirectBadTemplate-1.0.0",
|
|
140
|
+
inherits: ["SimpleTest:BadParent1-1.0.0", "SimpleTest:BadParent2-1.0.0"],
|
|
171
141
|
properties: [
|
|
172
142
|
{
|
|
173
|
-
id:
|
|
143
|
+
id: "props",
|
|
144
|
+
properties: [
|
|
174
145
|
{
|
|
175
|
-
id:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
146
|
+
id: "area",
|
|
147
|
+
properties: [{ id: "length", typeid: "Float32" }],
|
|
148
|
+
},
|
|
179
149
|
],
|
|
180
|
-
}
|
|
150
|
+
},
|
|
181
151
|
],
|
|
182
152
|
};
|
|
183
153
|
expect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTemplateWrapper.spec.js","sourceRoot":"","sources":["../../src/test/propertyTemplateWrapper.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AAEb;;;GAGG;AAEH,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,0BAA0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AAE,SAAS,EAAE;iCAAC;6BAC3C;yBAAC;qBACT;iBAAC;aACT,CAAC;YAEF,MAAM,CAAC,GAAG,EAAE;gBACR,eAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBACtC,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\n/**\n * @fileoverview\n * In this file, we will test the functions of a PropertyTemplateWrapper object described in /src/property_template_wrapper.js\n */\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":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AAEb;;;GAGG;AAEH,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1C,QAAQ,CAAC,2BAA2B,EAAE;IACrC,QAAQ,CAAC,4BAA4B,EAAE;QACtC,EAAE,CAAC,kDAAkD,EAAE;YACtD,IAAI,SAAS,GAAG;gBACf,MAAM,EAAE,4BAA4B;gBACpC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;aAC/C,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;QACvE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE;YACrD,IAAI,WAAW,GAAG;gBACjB,MAAM,EAAE,8BAA8B;gBACtC,QAAQ,EAAE,CAAC,0BAA0B,EAAE,0BAA0B,CAAC;gBAClE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;aAC/C,CAAC;YAEF,IAAI,OAAO,GAAG;gBACb,MAAM,EAAE,0BAA0B;gBAClC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;aACtD,CAAC;YAEF,IAAI,OAAO,G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AC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,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\n/**\n * @fileoverview\n * In this file, we will test the functions of a PropertyTemplateWrapper object described in /src/property_template_wrapper.js\n */\n\nconst { PropertyFactory } = require(\"..\");\n\ndescribe(\"Property Template Wrapper\", function () {\n\tdescribe(\"Compiled Template Creation\", function () {\n\t\tit(\"should work for template that has no inheritence\", function () {\n\t\t\tvar noParents = {\n\t\t\t\ttypeid: \"SimpleTest:NoParents-1.0.0\",\n\t\t\t\tproperties: [{ id: \"area\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tPropertyFactory.register(noParents);\n\t\t\tvar wrapper = PropertyFactory._getWrapper(\"SimpleTest:NoParents-1.0.0\");\n\n\t\t\tvar compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n\t\t\texpect(compiledTemplate).to.deep.equal(wrapper.getPropertyTemplate());\n\t\t});\n\n\t\tit(\"should contain properties from parent templates\", function () {\n\t\t\tvar withParents = {\n\t\t\t\ttypeid: \"SimpleTest:WithParents-1.0.0\",\n\t\t\t\tinherits: [\"SimpleTest:Parent1-1.0.0\", \"SimpleTest:Parent2-1.0.0\"],\n\t\t\t\tproperties: [{ id: \"area\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tvar parent1 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent1-1.0.0\",\n\t\t\t\tproperties: [{ id: \"parent1Prop\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tvar parent2 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent2-1.0.0\",\n\t\t\t\tproperties: [{ id: \"parent2Prop\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tPropertyFactory._reregister(parent1);\n\t\t\tPropertyFactory._reregister(parent2);\n\t\t\tPropertyFactory._reregister(withParents);\n\t\t\tvar wrapper = PropertyFactory._getWrapper(\"SimpleTest:WithParents-1.0.0\");\n\n\t\t\tvar compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n\t\t\texpect(compiledTemplate.properties).to.deep.equal([\n\t\t\t\t{ id: \"area\", typeid: \"Float32\" },\n\t\t\t\t{ id: \"parent1Prop\", typeid: \"Float32\" },\n\t\t\t\t{ id: \"parent2Prop\", typeid: \"Float32\" },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"should contain constants from parent templates\", function () {\n\t\t\tvar withParents = {\n\t\t\t\ttypeid: \"SimpleTest:WithParents-1.0.0\",\n\t\t\t\tinherits: [\"SimpleTest:Parent1-1.0.0\", \"SimpleTest:Parent2-1.0.0\"],\n\t\t\t\tconstants: [{ id: \"area\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tvar parent1 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent1-1.0.0\",\n\t\t\t\tconstants: [{ id: \"parent1Prop\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tvar parent2 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent2-1.0.0\",\n\t\t\t\tconstants: [{ id: \"parent2Prop\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tPropertyFactory._reregister(parent1);\n\t\t\tPropertyFactory._reregister(parent2);\n\t\t\tPropertyFactory._reregister(withParents);\n\t\t\tvar wrapper = PropertyFactory._getWrapper(\"SimpleTest:WithParents-1.0.0\");\n\n\t\t\tvar compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n\t\t\texpect(compiledTemplate.constants).to.deep.equal([\n\t\t\t\t{ id: \"area\", typeid: \"Float32\" },\n\t\t\t\t{ id: \"parent1Prop\", typeid: \"Float32\" },\n\t\t\t\t{ id: \"parent2Prop\", typeid: \"Float32\" },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"should merge property if found in both child and parent\", function () {\n\t\t\tvar withParents = {\n\t\t\t\ttypeid: \"SimpleTest:WithParents-1.0.0\",\n\t\t\t\tinherits: [\"SimpleTest:Parent1-1.0.0\"],\n\t\t\t\tproperties: [{ id: \"area\", value: \"1.1\" }],\n\t\t\t};\n\n\t\t\tvar parent1 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent1-1.0.0\",\n\t\t\t\tproperties: [{ id: \"area\", context: \"array\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tPropertyFactory._reregister(parent1);\n\t\t\tPropertyFactory._reregister(withParents);\n\t\t\tvar wrapper = PropertyFactory._getWrapper(\"SimpleTest:WithParents-1.0.0\");\n\n\t\t\tvar compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n\t\t\texpect(compiledTemplate.properties).to.deep.equal([\n\t\t\t\t{ id: \"area\", context: \"array\", typeid: \"Float32\", value: \"1.1\" },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"should merge constant if found in both child and parent\", function () {\n\t\t\tvar withParents = {\n\t\t\t\ttypeid: \"SimpleTest:WithParents-1.0.0\",\n\t\t\t\tinherits: [\"SimpleTest:Parent1-1.0.0\"],\n\t\t\t\tconstants: [{ id: \"area\", value: \"1.1\" }],\n\t\t\t};\n\n\t\t\tvar parent1 = {\n\t\t\t\ttypeid: \"SimpleTest:Parent1-1.0.0\",\n\t\t\t\tconstants: [{ id: \"area\", context: \"array\", typeid: \"Float32\" }],\n\t\t\t};\n\n\t\t\tPropertyFactory._reregister(parent1);\n\t\t\tPropertyFactory._reregister(withParents);\n\t\t\tvar wrapper = PropertyFactory._getWrapper(\"SimpleTest:WithParents-1.0.0\");\n\n\t\t\tvar compiledTemplate = wrapper.getCompiledTemplate(PropertyFactory);\n\n\t\t\texpect(compiledTemplate.constants).to.deep.equal([\n\t\t\t\t{ id: \"area\", context: \"array\", typeid: \"Float32\", value: \"1.1\" },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"should throw error if schema inherits from more than one creation type\", function () {\n\t\t\tvar badTemplate = {\n\t\t\t\ttypeid: \"SimpleTest:BadTemplate-1.0.0\",\n\t\t\t\tinherits: [\"NodeProperty\", \"Binary\"],\n\t\t\t\tproperties: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"props\",\n\t\t\t\t\t\tproperties: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"area\",\n\t\t\t\t\t\t\t\tproperties: [{ id: \"length\", typeid: \"Float32\" }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\n\t\t\texpect(() => {\n\t\t\t\tPropertyFactory.register(badTemplate);\n\t\t\t}).to.throw();\n\t\t});\n\n\t\tit(\"should throw error if schema indirectly inherits from more than one creation type\", function () {\n\t\t\tvar badParent1 = {\n\t\t\t\ttypeid: \"SimpleTest:BadParent1-1.0.0\",\n\t\t\t\tinherits: [\"NodeProperty\"],\n\t\t\t};\n\n\t\t\tvar badParent2 = {\n\t\t\t\ttypeid: \"SimpleTest:BadParent2-1.0.0\",\n\t\t\t\tinherits: [\"Binary\"],\n\t\t\t};\n\n\t\t\tvar badTemplate = {\n\t\t\t\ttypeid: \"SimpleTest:IndirectBadTemplate-1.0.0\",\n\t\t\t\tinherits: [\"SimpleTest:BadParent1-1.0.0\", \"SimpleTest:BadParent2-1.0.0\"],\n\t\t\t\tproperties: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"props\",\n\t\t\t\t\t\tproperties: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"area\",\n\t\t\t\t\t\t\t\tproperties: [{ id: \"length\", typeid: \"Float32\" }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\n\t\t\texpect(() => {\n\t\t\t\tPropertyFactory.register(badTemplate);\n\t\t\t\tPropertyFactory.register(badParent1);\n\t\t\t\tPropertyFactory.register(badParent2);\n\t\t\t}).to.throw();\n\t\t});\n\t});\n});\n"]}
|
|
@@ -5,38 +5,39 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview In this file, we will test the utils described in /src/utils.js
|
|
7
7
|
*/
|
|
8
|
-
const _ = require(
|
|
9
|
-
const { PropertyFactory } = require(
|
|
10
|
-
const { PropertyUtils } = require(
|
|
11
|
-
describe(
|
|
12
|
-
describe(
|
|
13
|
-
it(
|
|
8
|
+
const _ = require("lodash");
|
|
9
|
+
const { PropertyFactory } = require("..");
|
|
10
|
+
const { PropertyUtils } = require("..");
|
|
11
|
+
describe("PropertyUtils", function () {
|
|
12
|
+
describe("PropertyUtils.gatherProperties", function () {
|
|
13
|
+
it("should return a list of properties that match the predicate", function () {
|
|
14
14
|
var testTemplate = {
|
|
15
|
-
typeid:
|
|
15
|
+
typeid: "autodesk.test:testProp-1.0.0",
|
|
16
16
|
properties: [
|
|
17
|
-
{ id:
|
|
18
|
-
{ id:
|
|
17
|
+
{ id: "a", typeid: "Float64" },
|
|
18
|
+
{ id: "b", typeid: "String" },
|
|
19
19
|
{
|
|
20
|
-
id:
|
|
21
|
-
|
|
22
|
-
{ id:
|
|
20
|
+
id: "nested",
|
|
21
|
+
properties: [
|
|
22
|
+
{ id: "c", typeid: "Float64" },
|
|
23
|
+
{ id: "d", typeid: "String" },
|
|
23
24
|
],
|
|
24
25
|
},
|
|
25
26
|
],
|
|
26
27
|
};
|
|
27
28
|
PropertyFactory.register(testTemplate);
|
|
28
|
-
var myProperty = PropertyFactory.create(
|
|
29
|
-
myProperty.get(
|
|
30
|
-
myProperty.get(
|
|
31
|
-
myProperty.get(
|
|
32
|
-
myProperty.get(
|
|
29
|
+
var myProperty = PropertyFactory.create("autodesk.test:testProp-1.0.0");
|
|
30
|
+
myProperty.get("a").setValue(3);
|
|
31
|
+
myProperty.get("b").setValue("Hello");
|
|
32
|
+
myProperty.get("nested").get("c").setValue(42);
|
|
33
|
+
myProperty.get("nested").get("d").setValue("Hello again!");
|
|
33
34
|
var result = PropertyUtils.gatherProperties(myProperty, function (property) {
|
|
34
35
|
return _.isNumber(property.value);
|
|
35
36
|
});
|
|
36
|
-
expect(result[
|
|
37
|
-
expect(result[
|
|
38
|
-
expect(result[
|
|
39
|
-
expect(result[
|
|
37
|
+
expect(result["a"]).to.exist;
|
|
38
|
+
expect(result["b"]).to.not.exist;
|
|
39
|
+
expect(result["nested.c"]).to.exist;
|
|
40
|
+
expect(result["nested.d"]).to.not.exist;
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyUtils.spec.js","sourceRoot":"","sources":["../../src/test/propertyUtils.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;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;
|
|
1
|
+
{"version":3,"file":"propertyUtils.spec.js","sourceRoot":"","sources":["../../src/test/propertyUtils.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;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;IACzB,QAAQ,CAAC,gCAAgC,EAAE;QAC1C,EAAE,CAAC,6DAA6D,EAAE;YACjE,IAAI,YAAY,GAAG;gBAClB,MAAM,EAAE,8BAA8B;gBACtC,UAAU,EAAE;oBACX,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;oBAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,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CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test the utils described in /src/utils.js\n */\n\nconst _ = require(\"lodash\");\nconst { PropertyFactory } = require(\"..\");\nconst { PropertyUtils } = require(\"..\");\n\ndescribe(\"PropertyUtils\", function () {\n\tdescribe(\"PropertyUtils.gatherProperties\", function () {\n\t\tit(\"should return a list of properties that match the predicate\", function () {\n\t\t\tvar testTemplate = {\n\t\t\t\ttypeid: \"autodesk.test:testProp-1.0.0\",\n\t\t\t\tproperties: [\n\t\t\t\t\t{ id: \"a\", typeid: \"Float64\" },\n\t\t\t\t\t{ id: \"b\", typeid: \"String\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nested\",\n\t\t\t\t\t\tproperties: [\n\t\t\t\t\t\t\t{ id: \"c\", typeid: \"Float64\" },\n\t\t\t\t\t\t\t{ id: \"d\", typeid: \"String\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tPropertyFactory.register(testTemplate);\n\t\t\tvar myProperty = PropertyFactory.create(\"autodesk.test:testProp-1.0.0\");\n\t\t\tmyProperty.get(\"a\").setValue(3);\n\t\t\tmyProperty.get(\"b\").setValue(\"Hello\");\n\t\t\tmyProperty.get(\"nested\").get(\"c\").setValue(42);\n\t\t\tmyProperty.get(\"nested\").get(\"d\").setValue(\"Hello again!\");\n\n\t\t\tvar result = PropertyUtils.gatherProperties(myProperty, function (property) {\n\t\t\t\treturn _.isNumber(property.value);\n\t\t\t});\n\t\t\texpect(result[\"a\"]).to.exist;\n\t\t\texpect(result[\"b\"]).to.not.exist;\n\t\t\texpect(result[\"nested.c\"]).to.exist;\n\t\t\texpect(result[\"nested.d\"]).to.not.exist;\n\t\t});\n\t});\n});\n"]}
|