@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.
Files changed (266) hide show
  1. package/README.md +1 -0
  2. package/dist/containerSerializer.d.ts.map +1 -1
  3. package/dist/containerSerializer.js +5 -5
  4. package/dist/containerSerializer.js.map +1 -1
  5. package/dist/enableValidations.js.map +1 -1
  6. package/dist/index.d.ts +19 -19
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
  10. package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  11. package/dist/properties/abstractStaticCollectionProperty.js +70 -53
  12. package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
  13. package/dist/properties/arrayProperty.d.ts.map +1 -1
  14. package/dist/properties/arrayProperty.js +152 -103
  15. package/dist/properties/arrayProperty.js.map +1 -1
  16. package/dist/properties/baseProperty.d.ts +4 -4
  17. package/dist/properties/baseProperty.d.ts.map +1 -1
  18. package/dist/properties/baseProperty.js +69 -47
  19. package/dist/properties/baseProperty.js.map +1 -1
  20. package/dist/properties/boolProperty.d.ts.map +1 -1
  21. package/dist/properties/boolProperty.js +3 -3
  22. package/dist/properties/boolProperty.js.map +1 -1
  23. package/dist/properties/containerProperty.d.ts +8 -8
  24. package/dist/properties/containerProperty.d.ts.map +1 -1
  25. package/dist/properties/containerProperty.js +33 -26
  26. package/dist/properties/containerProperty.js.map +1 -1
  27. package/dist/properties/enumArrayProperty.d.ts.map +1 -1
  28. package/dist/properties/enumArrayProperty.js +14 -14
  29. package/dist/properties/enumArrayProperty.js.map +1 -1
  30. package/dist/properties/enumProperty.d.ts.map +1 -1
  31. package/dist/properties/enumProperty.js +17 -17
  32. package/dist/properties/enumProperty.js.map +1 -1
  33. package/dist/properties/floatProperties.js +4 -4
  34. package/dist/properties/floatProperties.js.map +1 -1
  35. package/dist/properties/index.d.ts +23 -23
  36. package/dist/properties/index.d.ts.map +1 -1
  37. package/dist/properties/index.js.map +1 -1
  38. package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  39. package/dist/properties/indexedCollectionBaseProperty.js +47 -37
  40. package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
  41. package/dist/properties/intProperties.d.ts.map +1 -1
  42. package/dist/properties/intProperties.js +10 -10
  43. package/dist/properties/intProperties.js.map +1 -1
  44. package/dist/properties/lazyLoadedProperties.js.map +1 -1
  45. package/dist/properties/mapProperty.d.ts.map +1 -1
  46. package/dist/properties/mapProperty.js +21 -17
  47. package/dist/properties/mapProperty.js.map +1 -1
  48. package/dist/properties/namedNodeProperty.d.ts.map +1 -1
  49. package/dist/properties/namedNodeProperty.js +3 -3
  50. package/dist/properties/namedNodeProperty.js.map +1 -1
  51. package/dist/properties/namedProperty.d.ts.map +1 -1
  52. package/dist/properties/namedProperty.js +7 -5
  53. package/dist/properties/namedProperty.js.map +1 -1
  54. package/dist/properties/nodeProperty.d.ts.map +1 -1
  55. package/dist/properties/nodeProperty.js +5 -3
  56. package/dist/properties/nodeProperty.js.map +1 -1
  57. package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
  58. package/dist/properties/primitiveTypeCasts.js +9 -9
  59. package/dist/properties/primitiveTypeCasts.js.map +1 -1
  60. package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
  61. package/dist/properties/referenceArrayProperty.js +31 -25
  62. package/dist/properties/referenceArrayProperty.js.map +1 -1
  63. package/dist/properties/referenceMapProperty.d.ts.map +1 -1
  64. package/dist/properties/referenceMapProperty.js +18 -18
  65. package/dist/properties/referenceMapProperty.js.map +1 -1
  66. package/dist/properties/referenceProperty.d.ts.map +1 -1
  67. package/dist/properties/referenceProperty.js +33 -29
  68. package/dist/properties/referenceProperty.js.map +1 -1
  69. package/dist/properties/setProperty.d.ts.map +1 -1
  70. package/dist/properties/setProperty.js +31 -29
  71. package/dist/properties/setProperty.js.map +1 -1
  72. package/dist/properties/stringProperty.d.ts.map +1 -1
  73. package/dist/properties/stringProperty.js +56 -40
  74. package/dist/properties/stringProperty.js.map +1 -1
  75. package/dist/properties/uintProperties.js +5 -5
  76. package/dist/properties/uintProperties.js.map +1 -1
  77. package/dist/properties/valueArrayProperty.d.ts +1 -1
  78. package/dist/properties/valueArrayProperty.d.ts.map +1 -1
  79. package/dist/properties/valueArrayProperty.js +30 -29
  80. package/dist/properties/valueArrayProperty.js.map +1 -1
  81. package/dist/properties/valueMapProperty.d.ts.map +1 -1
  82. package/dist/properties/valueMapProperty.js +31 -29
  83. package/dist/properties/valueMapProperty.js.map +1 -1
  84. package/dist/properties/valueProperty.d.ts.map +1 -1
  85. package/dist/properties/valueProperty.js +11 -9
  86. package/dist/properties/valueProperty.js.map +1 -1
  87. package/dist/propertyFactory.d.ts.map +1 -1
  88. package/dist/propertyFactory.js +309 -252
  89. package/dist/propertyFactory.js.map +1 -1
  90. package/dist/propertyTemplate.d.ts +17 -17
  91. package/dist/propertyTemplate.d.ts.map +1 -1
  92. package/dist/propertyTemplate.js +64 -45
  93. package/dist/propertyTemplate.js.map +1 -1
  94. package/dist/propertyTemplateWrapper.d.ts.map +1 -1
  95. package/dist/propertyTemplateWrapper.js +40 -25
  96. package/dist/propertyTemplateWrapper.js.map +1 -1
  97. package/dist/propertyUtils.d.ts.map +1 -1
  98. package/dist/propertyUtils.js.map +1 -1
  99. package/dist/test/properties/arrayProperty.spec.js +566 -490
  100. package/dist/test/properties/arrayProperty.spec.js.map +1 -1
  101. package/dist/test/properties/baseProperty.spec.js +293 -280
  102. package/dist/test/properties/baseProperty.spec.js.map +1 -1
  103. package/dist/test/properties/containerProperty.spec.js +100 -94
  104. package/dist/test/properties/containerProperty.spec.js.map +1 -1
  105. package/dist/test/properties/customArrayProperty.spec.js +174 -147
  106. package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
  107. package/dist/test/properties/enumArrayProperty.spec.js +67 -63
  108. package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
  109. package/dist/test/properties/enumProperty.spec.js +115 -97
  110. package/dist/test/properties/enumProperty.spec.js.map +1 -1
  111. package/dist/test/properties/float32.spec.js +5 -5
  112. package/dist/test/properties/float32.spec.js.map +1 -1
  113. package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
  114. package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
  115. package/dist/test/properties/int64MapProperty.spec.js +185 -166
  116. package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
  117. package/dist/test/properties/int64Property.spec.js +109 -109
  118. package/dist/test/properties/int64Property.spec.js.map +1 -1
  119. package/dist/test/properties/isLeafNode.spec.js +75 -76
  120. package/dist/test/properties/isLeafNode.spec.js.map +1 -1
  121. package/dist/test/properties/mapProperty.spec.js +571 -531
  122. package/dist/test/properties/mapProperty.spec.js.map +1 -1
  123. package/dist/test/properties/namedNodeProperty.spec.js +31 -31
  124. package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
  125. package/dist/test/properties/nodeProperty.spec.js +805 -795
  126. package/dist/test/properties/nodeProperty.spec.js.map +1 -1
  127. package/dist/test/properties/referenceProperty.spec.js +729 -679
  128. package/dist/test/properties/referenceProperty.spec.js.map +1 -1
  129. package/dist/test/properties/relationshipProperty.spec.js +16 -16
  130. package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
  131. package/dist/test/properties/setProperty.spec.js +288 -227
  132. package/dist/test/properties/setProperty.spec.js.map +1 -1
  133. package/dist/test/properties/stringProperty.spec.js +326 -318
  134. package/dist/test/properties/stringProperty.spec.js.map +1 -1
  135. package/dist/test/properties/uint64Property.spec.js +46 -36
  136. package/dist/test/properties/uint64Property.spec.js.map +1 -1
  137. package/dist/test/properties/valueMapProperty.spec.js +259 -246
  138. package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
  139. package/dist/test/properties/valueProperty.spec.js +49 -43
  140. package/dist/test/properties/valueProperty.spec.js.map +1 -1
  141. package/dist/test/propertyFactory.spec.js +2038 -1631
  142. package/dist/test/propertyFactory.spec.js.map +1 -1
  143. package/dist/test/propertyTemplateWrapper.spec.js +72 -102
  144. package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
  145. package/dist/test/propertyUtils.spec.js +22 -21
  146. package/dist/test/propertyUtils.spec.js.map +1 -1
  147. package/dist/test/reversibleChangeset.spec.js +857 -703
  148. package/dist/test/reversibleChangeset.spec.js.map +1 -1
  149. package/dist/test/setup.js +5 -5
  150. package/dist/test/setup.js.map +1 -1
  151. package/dist/test/tsconfig.tsbuildinfo +1 -1
  152. package/dist/test/utils.spec.js +1334 -1144
  153. package/dist/test/utils.spec.js.map +1 -1
  154. package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
  155. package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
  156. package/dist/test/validation/badPrimitiveTypeid.js +12 -12
  157. package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
  158. package/dist/test/validation/goodColorId.js +91 -91
  159. package/dist/test/validation/goodColorId.js.map +1 -1
  160. package/dist/test/validation/goodColorPalette.js +4 -4
  161. package/dist/test/validation/goodColorPalette.js.map +1 -1
  162. package/dist/test/validation/goodPointId.js +20 -20
  163. package/dist/test/validation/goodPointId.js.map +1 -1
  164. package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
  165. package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
  166. package/lib/containerSerializer.d.ts.map +1 -1
  167. package/lib/containerSerializer.js +5 -5
  168. package/lib/containerSerializer.js.map +1 -1
  169. package/lib/enableValidations.js.map +1 -1
  170. package/lib/index.d.ts +19 -19
  171. package/lib/index.d.ts.map +1 -1
  172. package/lib/index.js +19 -19
  173. package/lib/index.js.map +1 -1
  174. package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
  175. package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  176. package/lib/properties/abstractStaticCollectionProperty.js +70 -53
  177. package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
  178. package/lib/properties/arrayProperty.d.ts.map +1 -1
  179. package/lib/properties/arrayProperty.js +152 -103
  180. package/lib/properties/arrayProperty.js.map +1 -1
  181. package/lib/properties/baseProperty.d.ts +4 -4
  182. package/lib/properties/baseProperty.d.ts.map +1 -1
  183. package/lib/properties/baseProperty.js +73 -51
  184. package/lib/properties/baseProperty.js.map +1 -1
  185. package/lib/properties/boolProperty.d.ts.map +1 -1
  186. package/lib/properties/boolProperty.js +3 -3
  187. package/lib/properties/boolProperty.js.map +1 -1
  188. package/lib/properties/containerProperty.d.ts +8 -8
  189. package/lib/properties/containerProperty.d.ts.map +1 -1
  190. package/lib/properties/containerProperty.js +33 -26
  191. package/lib/properties/containerProperty.js.map +1 -1
  192. package/lib/properties/enumArrayProperty.d.ts.map +1 -1
  193. package/lib/properties/enumArrayProperty.js +14 -14
  194. package/lib/properties/enumArrayProperty.js.map +1 -1
  195. package/lib/properties/enumProperty.d.ts.map +1 -1
  196. package/lib/properties/enumProperty.js +17 -17
  197. package/lib/properties/enumProperty.js.map +1 -1
  198. package/lib/properties/floatProperties.js +4 -4
  199. package/lib/properties/floatProperties.js.map +1 -1
  200. package/lib/properties/index.d.ts +23 -23
  201. package/lib/properties/index.d.ts.map +1 -1
  202. package/lib/properties/index.js +23 -23
  203. package/lib/properties/index.js.map +1 -1
  204. package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  205. package/lib/properties/indexedCollectionBaseProperty.js +47 -37
  206. package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
  207. package/lib/properties/intProperties.d.ts.map +1 -1
  208. package/lib/properties/intProperties.js +10 -10
  209. package/lib/properties/intProperties.js.map +1 -1
  210. package/lib/properties/lazyLoadedProperties.js.map +1 -1
  211. package/lib/properties/mapProperty.d.ts.map +1 -1
  212. package/lib/properties/mapProperty.js +21 -17
  213. package/lib/properties/mapProperty.js.map +1 -1
  214. package/lib/properties/namedNodeProperty.d.ts.map +1 -1
  215. package/lib/properties/namedNodeProperty.js +3 -3
  216. package/lib/properties/namedNodeProperty.js.map +1 -1
  217. package/lib/properties/namedProperty.d.ts.map +1 -1
  218. package/lib/properties/namedProperty.js +7 -5
  219. package/lib/properties/namedProperty.js.map +1 -1
  220. package/lib/properties/nodeProperty.d.ts.map +1 -1
  221. package/lib/properties/nodeProperty.js +5 -3
  222. package/lib/properties/nodeProperty.js.map +1 -1
  223. package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
  224. package/lib/properties/primitiveTypeCasts.js +9 -9
  225. package/lib/properties/primitiveTypeCasts.js.map +1 -1
  226. package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
  227. package/lib/properties/referenceArrayProperty.js +31 -25
  228. package/lib/properties/referenceArrayProperty.js.map +1 -1
  229. package/lib/properties/referenceMapProperty.d.ts.map +1 -1
  230. package/lib/properties/referenceMapProperty.js +18 -18
  231. package/lib/properties/referenceMapProperty.js.map +1 -1
  232. package/lib/properties/referenceProperty.d.ts.map +1 -1
  233. package/lib/properties/referenceProperty.js +33 -29
  234. package/lib/properties/referenceProperty.js.map +1 -1
  235. package/lib/properties/setProperty.d.ts.map +1 -1
  236. package/lib/properties/setProperty.js +31 -29
  237. package/lib/properties/setProperty.js.map +1 -1
  238. package/lib/properties/stringProperty.d.ts.map +1 -1
  239. package/lib/properties/stringProperty.js +56 -40
  240. package/lib/properties/stringProperty.js.map +1 -1
  241. package/lib/properties/uintProperties.js +5 -5
  242. package/lib/properties/uintProperties.js.map +1 -1
  243. package/lib/properties/valueArrayProperty.d.ts +1 -1
  244. package/lib/properties/valueArrayProperty.d.ts.map +1 -1
  245. package/lib/properties/valueArrayProperty.js +30 -29
  246. package/lib/properties/valueArrayProperty.js.map +1 -1
  247. package/lib/properties/valueMapProperty.d.ts.map +1 -1
  248. package/lib/properties/valueMapProperty.js +31 -29
  249. package/lib/properties/valueMapProperty.js.map +1 -1
  250. package/lib/properties/valueProperty.d.ts.map +1 -1
  251. package/lib/properties/valueProperty.js +11 -9
  252. package/lib/properties/valueProperty.js.map +1 -1
  253. package/lib/propertyFactory.d.ts.map +1 -1
  254. package/lib/propertyFactory.js +309 -252
  255. package/lib/propertyFactory.js.map +1 -1
  256. package/lib/propertyTemplate.d.ts +17 -17
  257. package/lib/propertyTemplate.d.ts.map +1 -1
  258. package/lib/propertyTemplate.js +64 -45
  259. package/lib/propertyTemplate.js.map +1 -1
  260. package/lib/propertyTemplateWrapper.d.ts.map +1 -1
  261. package/lib/propertyTemplateWrapper.js +40 -25
  262. package/lib/propertyTemplateWrapper.js.map +1 -1
  263. package/lib/propertyUtils.d.ts.map +1 -1
  264. package/lib/propertyUtils.js.map +1 -1
  265. package/package.json +28 -28
  266. 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('Property Template Wrapper', function () {
12
- describe('Compiled Template Creation', function () {
13
- it('should work for template that has no inheritence', function () {
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: 'SimpleTest:NoParents-1.0.0',
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('SimpleTest:NoParents-1.0.0');
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('should contain properties from parent templates', function () {
23
+ it("should contain properties from parent templates", function () {
26
24
  var withParents = {
27
- typeid: 'SimpleTest:WithParents-1.0.0',
28
- inherits: [
29
- 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent2-1.0.0',
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('SimpleTest:WithParents-1.0.0');
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: 'area', typeid: 'Float32' },
55
- { id: 'parent1Prop', typeid: 'Float32' },
56
- { id: 'parent2Prop', typeid: 'Float32' },
43
+ { id: "area", typeid: "Float32" },
44
+ { id: "parent1Prop", typeid: "Float32" },
45
+ { id: "parent2Prop", typeid: "Float32" },
57
46
  ]);
58
47
  });
59
- it('should contain constants from parent templates', function () {
48
+ it("should contain constants from parent templates", function () {
60
49
  var withParents = {
61
- typeid: 'SimpleTest:WithParents-1.0.0',
62
- inherits: [
63
- 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent2-1.0.0',
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('SimpleTest:WithParents-1.0.0');
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: 'area', typeid: 'Float32' },
89
- { id: 'parent1Prop', typeid: 'Float32' },
90
- { id: 'parent2Prop', typeid: 'Float32' },
68
+ { id: "area", typeid: "Float32" },
69
+ { id: "parent1Prop", typeid: "Float32" },
70
+ { id: "parent2Prop", typeid: "Float32" },
91
71
  ]);
92
72
  });
93
- it('should merge property if found in both child and parent', function () {
73
+ it("should merge property if found in both child and parent", function () {
94
74
  var withParents = {
95
- typeid: 'SimpleTest:WithParents-1.0.0',
96
- inherits: [
97
- 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent1-1.0.0',
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('SimpleTest:WithParents-1.0.0');
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: 'area', context: 'array', typeid: 'Float32', value: '1.1' },
88
+ { id: "area", context: "array", typeid: "Float32", value: "1.1" },
115
89
  ]);
116
90
  });
117
- it('should merge constant if found in both child and parent', function () {
91
+ it("should merge constant if found in both child and parent", function () {
118
92
  var withParents = {
119
- typeid: 'SimpleTest:WithParents-1.0.0',
120
- inherits: [
121
- 'SimpleTest:Parent1-1.0.0',
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: 'SimpleTest:Parent1-1.0.0',
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('SimpleTest:WithParents-1.0.0');
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: 'area', context: 'array', typeid: 'Float32', value: '1.1' },
106
+ { id: "area", context: "array", typeid: "Float32", value: "1.1" },
139
107
  ]);
140
108
  });
141
- it('should throw error if schema inherits from more than one creation type', function () {
109
+ it("should throw error if schema inherits from more than one creation type", function () {
142
110
  var badTemplate = {
143
- typeid: 'SimpleTest:BadTemplate-1.0.0',
144
- inherits: ['NodeProperty', 'Binary'],
111
+ typeid: "SimpleTest:BadTemplate-1.0.0",
112
+ inherits: ["NodeProperty", "Binary"],
145
113
  properties: [
146
114
  {
147
- id: 'props', properties: [
115
+ id: "props",
116
+ properties: [
148
117
  {
149
- id: 'area', properties: [
150
- { id: 'length', typeid: 'Float32' }
151
- ],
152
- }
118
+ id: "area",
119
+ properties: [{ id: "length", typeid: "Float32" }],
120
+ },
153
121
  ],
154
- }
122
+ },
155
123
  ],
156
124
  };
157
- expect(() => { PropertyFactory.register(badTemplate); }).to.throw();
125
+ expect(() => {
126
+ PropertyFactory.register(badTemplate);
127
+ }).to.throw();
158
128
  });
159
- it('should throw error if schema indirectly inherits from more than one creation type', function () {
129
+ it("should throw error if schema indirectly inherits from more than one creation type", function () {
160
130
  var badParent1 = {
161
- typeid: 'SimpleTest:BadParent1-1.0.0',
162
- inherits: ['NodeProperty'],
131
+ typeid: "SimpleTest:BadParent1-1.0.0",
132
+ inherits: ["NodeProperty"],
163
133
  };
164
134
  var badParent2 = {
165
- typeid: 'SimpleTest:BadParent2-1.0.0',
166
- inherits: ['Binary'],
135
+ typeid: "SimpleTest:BadParent2-1.0.0",
136
+ inherits: ["Binary"],
167
137
  };
168
138
  var badTemplate = {
169
- typeid: 'SimpleTest:IndirectBadTemplate-1.0.0',
170
- inherits: ['SimpleTest:BadParent1-1.0.0', 'SimpleTest:BadParent2-1.0.0'],
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: 'props', properties: [
143
+ id: "props",
144
+ properties: [
174
145
  {
175
- id: 'area', properties: [
176
- { id: 'length', typeid: 'Float32' }
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,0BAA0B;iBAC7B;gBACD,UAAU,EAAE;oBAC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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});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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('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 () {
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: 'autodesk.test:testProp-1.0.0',
15
+ typeid: "autodesk.test:testProp-1.0.0",
16
16
  properties: [
17
- { id: 'a', typeid: 'Float64' },
18
- { id: 'b', typeid: 'String' },
17
+ { id: "a", typeid: "Float64" },
18
+ { id: "b", typeid: "String" },
19
19
  {
20
- id: 'nested', properties: [
21
- { id: 'c', typeid: 'Float64' },
22
- { id: 'd', typeid: 'String' },
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('autodesk.test:testProp-1.0.0');
29
- myProperty.get('a').setValue(3);
30
- myProperty.get('b').setValue('Hello');
31
- myProperty.get('nested').get('c').setValue(42);
32
- myProperty.get('nested').get('d').setValue('Hello again!');
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['a']).to.exist;
37
- expect(result['b']).to.not.exist;
38
- expect(result['nested.c']).to.exist;
39
- expect(result['nested.d']).to.not.exist;
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;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,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE;yBAChC;qBACJ;iBACJ;aACJ,CAAC;YACF,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACvC,IAAI,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;YACxE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAChC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACtC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/C,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAE3D,IAAI,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAS,QAAQ;gBACrE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;QAC5C,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/**\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 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"]}
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,EAAE;oBAC7B;wBACC,EAAE,EAAE,QAAQ;wBACZ,UAAU,EAAE;4BACX,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;4BAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE;yBAC7B;qBACD;iBACD;aACD,CAAC;YACF,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACvC,IAAI,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;YACxE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAChC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACtC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/C,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAE3D,IAAI,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,QAAQ;gBACzE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;QACzC,CAAC,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"]}