@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,27 +7,27 @@
7
7
  * described in /src/properties/baseProperty.js
8
8
  */
9
9
  var PropertyFactory, ChangeSet, MSG, BaseProperty;
10
- describe('BaseProperty', function () {
10
+ describe("BaseProperty", function () {
11
11
  /**
12
12
  * Get all the objects we need in this test here.
13
13
  */
14
14
  before(function () {
15
- PropertyFactory = require('../..').PropertyFactory;
16
- ChangeSet = require('@fluid-experimental/property-changeset').ChangeSet;
17
- MSG = require('@fluid-experimental/property-common').constants.MSG;
18
- BaseProperty = require('../..').BaseProperty;
15
+ PropertyFactory = require("../..").PropertyFactory;
16
+ ChangeSet = require("@fluid-experimental/property-changeset").ChangeSet;
17
+ MSG = require("@fluid-experimental/property-common").constants.MSG;
18
+ BaseProperty = require("../..").BaseProperty;
19
19
  var TestPropertyObject = {
20
- typeid: 'autodesk.tests:property.with.special.characters-1.0.0',
20
+ typeid: "autodesk.tests:property.with.special.characters-1.0.0",
21
21
  properties: [
22
- { id: 'simple_property', typeid: 'String' },
23
- { id: 'test.property', typeid: 'String' },
24
- { id: 'test"property"', typeid: 'String' },
22
+ { id: "simple_property", typeid: "String" },
23
+ { id: "test.property", typeid: "String" },
24
+ { id: 'test"property"', typeid: "String" },
25
25
  {
26
- id: 'test[property]', properties: [
26
+ id: "test[property]",
27
+ properties: [
27
28
  {
28
- id: '.property.', properties: [
29
- { id: 'test', typeid: 'String' },
30
- ],
29
+ id: ".property.",
30
+ properties: [{ id: "test", typeid: "String" }],
31
31
  },
32
32
  ],
33
33
  },
@@ -35,109 +35,117 @@ describe('BaseProperty', function () {
35
35
  };
36
36
  PropertyFactory._reregister(TestPropertyObject);
37
37
  });
38
- describe('Serializing a BaseProperty with special characters', function () {
39
- it('should be possible to serialize a property with special characters', function () {
40
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
41
- myProp._properties['test.property'].value = 'a';
42
- myProp._properties['test"property"'].value = 'b';
43
- myProp._properties['test[property]']['.property.']['test'].value = 'c';
38
+ describe("Serializing a BaseProperty with special characters", function () {
39
+ it("should be possible to serialize a property with special characters", function () {
40
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
41
+ myProp._properties["test.property"].value = "a";
42
+ myProp._properties['test"property"'].value = "b";
43
+ myProp._properties["test[property]"][".property."]["test"].value = "c";
44
44
  var serialized = myProp._serialize(false);
45
- var myProp2 = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
45
+ var myProp2 = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
46
46
  myProp2.deserialize(serialized);
47
- expect(myProp2._properties['test.property'].value).to.equal('a');
48
- expect(myProp2._properties['test"property"'].value).to.equal('b');
49
- expect(myProp2._properties['test[property]']['.property.']['test'].value).to.equal('c');
47
+ expect(myProp2._properties["test.property"].value).to.equal("a");
48
+ expect(myProp2._properties['test"property"'].value).to.equal("b");
49
+ expect(myProp2._properties["test[property]"][".property."]["test"].value).to.equal("c");
50
50
  });
51
51
  });
52
- describe('Get should work', function () {
52
+ describe("Get should work", function () {
53
53
  // Test whether .get accepts the correct parameters
54
- it('should accept an id (string) or an array of ids', function () {
55
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
54
+ it("should accept an id (string) or an array of ids", function () {
55
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
56
56
  var correctArrayFn = function () {
57
- myProp.get(['test']);
57
+ myProp.get(["test"]);
58
58
  };
59
59
  var correctStringFn = function () {
60
- myProp.get('test');
60
+ myProp.get("test");
61
61
  };
62
62
  expect(correctArrayFn).to.not.throw();
63
63
  expect(correctStringFn).to.not.throw();
64
64
  });
65
65
  // .get(['test1','test2']) === .get('test1').get('test2')
66
- it('when an array is passed, it should do a .get for each id in the array', function () {
67
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
68
- expect(myProp.get(['test[property]', '.property.', 'test'])).to.equal(myProp.get('test[property]').get('.property.').get('test'));
69
- });
70
- it('when an array is passed with a bad path, it should return undefined', function () {
71
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
72
- expect(myProp.get(['wrong path', '.property', 'test'])).to.be.undefined;
73
- });
74
- it('should work with raise level path tokens', function () {
75
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
76
- expect(myProp.get(['test[property]', '.property.', BaseProperty.PATH_TOKENS.UP,
77
- '.property.', 'test'])).to.deep.equal(myProp.get('test[property]').get('.property.').get('test'));
78
- expect(myProp.get(['test[property]', '.property.',
79
- BaseProperty.PATH_TOKENS.UP, BaseProperty.PATH_TOKENS.UP,
80
- 'simple_property'])).to.deep.equal(myProp.get('simple_property'));
81
- });
82
- it('should work with path root tokens', function () {
83
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
66
+ it("when an array is passed, it should do a .get for each id in the array", function () {
67
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
68
+ expect(myProp.get(["test[property]", ".property.", "test"])).to.equal(myProp.get("test[property]").get(".property.").get("test"));
69
+ });
70
+ it("when an array is passed with a bad path, it should return undefined", function () {
71
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
72
+ expect(myProp.get(["wrong path", ".property", "test"])).to.be.undefined;
73
+ });
74
+ it("should work with raise level path tokens", function () {
75
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
76
+ expect(myProp.get([
77
+ "test[property]",
78
+ ".property.",
79
+ BaseProperty.PATH_TOKENS.UP,
80
+ ".property.",
81
+ "test",
82
+ ])).to.deep.equal(myProp.get("test[property]").get(".property.").get("test"));
83
+ expect(myProp.get([
84
+ "test[property]",
85
+ ".property.",
86
+ BaseProperty.PATH_TOKENS.UP,
87
+ BaseProperty.PATH_TOKENS.UP,
88
+ "simple_property",
89
+ ])).to.deep.equal(myProp.get("simple_property"));
90
+ });
91
+ it("should work with path root tokens", function () {
92
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
84
93
  expect(myProp.get([BaseProperty.PATH_TOKENS.ROOT])).to.equal(myProp);
85
- expect(myProp.get([BaseProperty.PATH_TOKENS.ROOT, 'simple_property']))
86
- .to.equal(myProp.get('simple_property'));
87
- expect(myProp.get('test[property]').get([BaseProperty.PATH_TOKENS.ROOT])).to.equal(myProp);
94
+ expect(myProp.get([BaseProperty.PATH_TOKENS.ROOT, "simple_property"])).to.equal(myProp.get("simple_property"));
95
+ expect(myProp.get("test[property]").get([BaseProperty.PATH_TOKENS.ROOT])).to.equal(myProp);
88
96
  });
89
97
  });
90
- describe('GetValue should work', function () {
91
- it('should return the value of a primitive property', function () {
92
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
93
- myProp._properties['test.property'].value = 'a';
94
- var myValue = myProp.getValue(['test.property']);
95
- expect(myValue).to.equal('a');
96
- });
97
- it('should work with an array of paths', function () {
98
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
99
- myProp.get(['test[property]', '.property.', 'test']).setValue('b');
100
- expect(myProp.getValue(['test[property]', '.property.', 'test'])).to.equal('b');
101
- });
102
- it('should throw if using .getValue on a non-primitive property', function () {
103
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
98
+ describe("GetValue should work", function () {
99
+ it("should return the value of a primitive property", function () {
100
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
101
+ myProp._properties["test.property"].value = "a";
102
+ var myValue = myProp.getValue(["test.property"]);
103
+ expect(myValue).to.equal("a");
104
+ });
105
+ it("should work with an array of paths", function () {
106
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
107
+ myProp.get(["test[property]", ".property.", "test"]).setValue("b");
108
+ expect(myProp.getValue(["test[property]", ".property.", "test"])).to.equal("b");
109
+ });
110
+ it("should throw if using .getValue on a non-primitive property", function () {
111
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
104
112
  var incorrectFn = function () {
105
- myProp.getValue(['test[property]']);
113
+ myProp.getValue(["test[property]"]);
106
114
  };
107
115
  expect(incorrectFn).to.throw();
108
116
  });
109
117
  });
110
- describe('GetValues should work', function () {
111
- it('should return the values of a property', function () {
112
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
118
+ describe("GetValues should work", function () {
119
+ it("should return the values of a property", function () {
120
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
113
121
  myProp.setValues({
114
- 'simple_property': 'string1',
115
- 'test"property"': 'string3',
116
- 'test[property]': {
117
- '.property.': {
118
- 'test': 'string4',
122
+ "simple_property": "string1",
123
+ 'test"property"': "string3",
124
+ "test[property]": {
125
+ ".property.": {
126
+ test: "string4",
119
127
  },
120
128
  },
121
129
  });
122
130
  expect(myProp.getValues()).to.deep.equal({
123
- 'simple_property': 'string1',
124
- 'test.property': '',
125
- 'test"property"': 'string3',
126
- 'test[property]': {
127
- '.property.': {
128
- 'test': 'string4',
131
+ "simple_property": "string1",
132
+ "test.property": "",
133
+ 'test"property"': "string3",
134
+ "test[property]": {
135
+ ".property.": {
136
+ test: "string4",
129
137
  },
130
138
  },
131
139
  });
132
140
  });
133
- it('setValues should accept the output of getValues as a valid input', function () {
134
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
141
+ it("setValues should accept the output of getValues as a valid input", function () {
142
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
135
143
  myProp.setValues({
136
- 'simple_property': 'string1',
137
- 'test"property"': 'string3',
138
- 'test[property]': {
139
- '.property.': {
140
- 'test': 'string4',
144
+ "simple_property": "string1",
145
+ 'test"property"': "string3",
146
+ "test[property]": {
147
+ ".property.": {
148
+ test: "string4",
141
149
  },
142
150
  },
143
151
  });
@@ -147,107 +155,104 @@ describe('BaseProperty', function () {
147
155
  expect(correctFn).to.not.throw();
148
156
  });
149
157
  });
150
- describe('setValues should work', function () {
151
- it('should accept an object and set each values in that object', function () {
152
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
158
+ describe("setValues should work", function () {
159
+ it("should accept an object and set each values in that object", function () {
160
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
153
161
  myProp.setValues({
154
- 'simple_property': 'string1',
155
- 'test[property]': {
156
- '.property.': {
157
- 'test': 'string2',
162
+ "simple_property": "string1",
163
+ "test[property]": {
164
+ ".property.": {
165
+ test: "string2",
158
166
  },
159
167
  },
160
168
  });
161
- expect(myProp.get('simple_property').getValue()).to.equal('string1');
162
- expect(myProp.get(['test[property]', '.property.', 'test']).getValue()).to.equal('string2');
169
+ expect(myProp.get("simple_property").getValue()).to.equal("string1");
170
+ expect(myProp.get(["test[property]", ".property.", "test"]).getValue()).to.equal("string2");
163
171
  });
164
- it('should throw if trying to insert in a non-exiting path', function () {
165
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
172
+ it("should throw if trying to insert in a non-exiting path", function () {
173
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
166
174
  var invalidFunction = function () {
167
175
  myProp.setValues({
168
- 'simple_property': 'string1',
169
- 'test[property]': {
170
- '.property.': {
171
- 'test123': 'string2',
176
+ "simple_property": "string1",
177
+ "test[property]": {
178
+ ".property.": {
179
+ test123: "string2",
172
180
  },
173
181
  },
174
182
  });
175
183
  };
176
184
  // TODO: move this to constants.js
177
- expect(invalidFunction).to.throw(MSG.SET_VALUES_PATH_INVALID + 'test123');
185
+ expect(invalidFunction).to.throw(MSG.SET_VALUES_PATH_INVALID + "test123");
178
186
  });
179
- it('should throw if trying to insert into a path that resolves to a property', function () {
180
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
187
+ it("should throw if trying to insert into a path that resolves to a property", function () {
188
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
181
189
  var invalidFunction = function () {
182
190
  myProp.setValues({
183
- 'simple_property': 'string1',
184
- 'test[property]': {
185
- '.property.': 'string2',
191
+ "simple_property": "string1",
192
+ "test[property]": {
193
+ ".property.": "string2",
186
194
  },
187
195
  });
188
196
  };
189
- expect(invalidFunction).to.throw(MSG.SET_VALUES_PATH_PROPERTY + '.property.');
197
+ expect(invalidFunction).to.throw(MSG.SET_VALUES_PATH_PROPERTY + ".property.");
190
198
  });
191
199
  });
192
- describe('Path resolution should work', function () {
200
+ describe("Path resolution should work", function () {
193
201
  // Test whether the right paths are returned
194
- it('should work with getAbsolutePath', function () {
195
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
196
- expect(myProp.get('simple_property').getAbsolutePath()).to.equal('/simple_property');
197
- expect(myProp.get('test.property').getAbsolutePath()).to.equal('/"test.property"');
202
+ it("should work with getAbsolutePath", function () {
203
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
204
+ expect(myProp.get("simple_property").getAbsolutePath()).to.equal("/simple_property");
205
+ expect(myProp.get("test.property").getAbsolutePath()).to.equal('/"test.property"');
198
206
  expect(myProp.get('test"property"').getAbsolutePath()).to.equal('/"test\\"property\\""');
199
- expect(myProp.get('test[property]').getAbsolutePath()).to.equal('/"test[property]"');
200
- expect(myProp.get('test[property]')
201
- .get('.property.').getAbsolutePath()).to.equal('/"test[property]".".property."');
202
- expect(myProp.get('test[property]')
203
- .get('.property.')
204
- .get('test').getAbsolutePath()).to.equal('/"test[property]".".property.".test');
205
- });
206
- it('should work with getRelativePath', function () {
207
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
208
- var nested = myProp.get('test[property]');
209
- expect(myProp.get(['test[property]', '.property.', 'test'])
210
- .getRelativePath(nested)).to.equal('".property.".test');
211
- expect(myProp.get(['test[property]', '.property.', 'test']).getRelativePath(myProp.get('simple_property')))
212
- .to.equal('../"test[property]".".property.".test');
213
- expect(nested.getRelativePath(myProp.get(['test[property]', '.property.', 'test']))).to.equal('../../');
207
+ expect(myProp.get("test[property]").getAbsolutePath()).to.equal('/"test[property]"');
208
+ expect(myProp.get("test[property]").get(".property.").getAbsolutePath()).to.equal('/"test[property]".".property."');
209
+ expect(myProp.get("test[property]").get(".property.").get("test").getAbsolutePath()).to.equal('/"test[property]".".property.".test');
210
+ });
211
+ it("should work with getRelativePath", function () {
212
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
213
+ var nested = myProp.get("test[property]");
214
+ expect(myProp.get(["test[property]", ".property.", "test"]).getRelativePath(nested)).to.equal('".property.".test');
215
+ expect(myProp
216
+ .get(["test[property]", ".property.", "test"])
217
+ .getRelativePath(myProp.get("simple_property"))).to.equal('../"test[property]".".property.".test');
218
+ expect(nested.getRelativePath(myProp.get(["test[property]", ".property.", "test"]))).to.equal("../../");
214
219
  });
215
220
  // Test that path resolution works
216
- it('should work with resolvePath', function () {
217
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
218
- expect(myProp.resolvePath('simple_property')).to.equal(myProp.get('simple_property'));
219
- expect(myProp.resolvePath('"test.property"')).to.equal(myProp.get('test.property'));
221
+ it("should work with resolvePath", function () {
222
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
223
+ expect(myProp.resolvePath("simple_property")).to.equal(myProp.get("simple_property"));
224
+ expect(myProp.resolvePath('"test.property"')).to.equal(myProp.get("test.property"));
220
225
  expect(myProp.resolvePath('"test\\"property\\""')).to.equal(myProp.get('test"property"'));
221
- expect(myProp.resolvePath('"test[property]"')).to.equal(myProp.get('test[property]'));
222
- expect(myProp.resolvePath('"test[property]".".property."')).to.equal(myProp.get('test[property]').get('.property.'));
223
- expect(myProp.resolvePath('"test[property]".".property.".test')).to.equal(myProp.get('test[property]').get('.property.').get('test'));
224
- expect(myProp.resolvePath('/')).to.equal(myProp);
225
- expect(myProp.resolvePath('/simple_property')).to.equal(myProp.get('simple_property'));
226
- expect(myProp.get('simple_property').resolvePath('/')).to.equal(myProp);
227
- expect(myProp.get('simple_property').resolvePath('/simple_property')).to.equal(myProp.get('simple_property'));
228
- });
229
- it('should return undefined for invalid paths', function () {
230
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
231
- expect(myProp.resolvePath('invalid_path')).to.be.undefined;
232
- expect(myProp.resolvePath('invalid_path.invalid_child')).to.be.undefined;
226
+ expect(myProp.resolvePath('"test[property]"')).to.equal(myProp.get("test[property]"));
227
+ expect(myProp.resolvePath('"test[property]".".property."')).to.equal(myProp.get("test[property]").get(".property."));
228
+ expect(myProp.resolvePath('"test[property]".".property.".test')).to.equal(myProp.get("test[property]").get(".property.").get("test"));
229
+ expect(myProp.resolvePath("/")).to.equal(myProp);
230
+ expect(myProp.resolvePath("/simple_property")).to.equal(myProp.get("simple_property"));
231
+ expect(myProp.get("simple_property").resolvePath("/")).to.equal(myProp);
232
+ expect(myProp.get("simple_property").resolvePath("/simple_property")).to.equal(myProp.get("simple_property"));
233
+ });
234
+ it("should return undefined for invalid paths", function () {
235
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
236
+ expect(myProp.resolvePath("invalid_path")).to.be.undefined;
237
+ expect(myProp.resolvePath("invalid_path.invalid_child")).to.be.undefined;
233
238
  });
234
239
  });
235
- describe('cleanDirty', function () {
236
- it('should work for paths with special characters', function () {
237
- var property = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
238
- property.resolvePath('"test[property]".".property.".test').value = 'test';
240
+ describe("cleanDirty", function () {
241
+ it("should work for paths with special characters", function () {
242
+ var property = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
243
+ property.resolvePath('"test[property]".".property.".test').value = "test";
239
244
  property.cleanDirty();
240
245
  expect(property._serialize(true)).to.be.empty;
241
246
  expect(property.getPendingChanges()).to.deep.equal(new ChangeSet({}));
242
247
  });
243
248
  });
244
- it('should clone the property set', function (done) {
245
- var nodeProperty = PropertyFactory.create('NodeProperty');
249
+ it("should clone the property set", function (done) {
250
+ var nodeProperty = PropertyFactory.create("NodeProperty");
246
251
  nodeProperty.deserialize({
247
252
  insert: {
248
253
  String: {
249
- result1: 'foo',
250
- result2: 'bar',
254
+ result1: "foo",
255
+ result2: "bar",
251
256
  },
252
257
  NodeProperty: {
253
258
  result3: {
@@ -264,16 +269,16 @@ describe('BaseProperty', function () {
264
269
  expect(nodeProperty._serialize(false)).to.eql(clone._serialize(false));
265
270
  done();
266
271
  });
267
- it('should support reapplying dirty flags on non-identical changeSets', function (done) {
268
- let nodeProperty = PropertyFactory.create('NodeProperty');
269
- nodeProperty.insert('result1', PropertyFactory.create('String'));
270
- nodeProperty.insert('result2', PropertyFactory.create('String'));
271
- nodeProperty.insert('result3', PropertyFactory.create('Int32'));
272
- nodeProperty.insert('result4', PropertyFactory.create('Int32'));
272
+ it("should support reapplying dirty flags on non-identical changeSets", function (done) {
273
+ let nodeProperty = PropertyFactory.create("NodeProperty");
274
+ nodeProperty.insert("result1", PropertyFactory.create("String"));
275
+ nodeProperty.insert("result2", PropertyFactory.create("String"));
276
+ nodeProperty.insert("result3", PropertyFactory.create("Int32"));
277
+ nodeProperty.insert("result4", PropertyFactory.create("Int32"));
273
278
  const changeset1 = {
274
279
  String: {
275
- result1: 'foo',
276
- result2: 'bar',
280
+ result1: "foo",
281
+ result2: "bar",
277
282
  },
278
283
  };
279
284
  const changeset2 = {
@@ -285,110 +290,115 @@ describe('BaseProperty', function () {
285
290
  nodeProperty._reapplyDirtyFlags(changeset1, changeset2);
286
291
  done();
287
292
  });
288
- it('should be able to handle duplicate namespace', function () {
293
+ it("should be able to handle duplicate namespace", function () {
289
294
  var ANumber = {
290
- typeid: 'autodesk.tests:ANumber-1.0.0',
291
- properties: [{
292
- id: 'aValue', typeid: 'Int32',
293
- }],
295
+ typeid: "autodesk.tests:ANumber-1.0.0",
296
+ properties: [
297
+ {
298
+ id: "aValue",
299
+ typeid: "Int32",
300
+ },
301
+ ],
294
302
  };
295
303
  PropertyFactory.register(ANumber);
296
304
  var SomeNumbers = {
297
- typeid: 'autodesk.tests:SomeNumbers-1.0.0',
305
+ typeid: "autodesk.tests:SomeNumbers-1.0.0",
298
306
  properties: [
299
- { id: 'aValue', typeid: 'autodesk.tests:ANumber-1.0.0' },
300
- { id: 'anotherValue', typeid: 'autodesk.tests:ANumber-1.0.0' },
301
- { id: 'thirdValue', typeid: 'autodesk.tests:ANumber-1.0.0' },
307
+ { id: "aValue", typeid: "autodesk.tests:ANumber-1.0.0" },
308
+ { id: "anotherValue", typeid: "autodesk.tests:ANumber-1.0.0" },
309
+ { id: "thirdValue", typeid: "autodesk.tests:ANumber-1.0.0" },
302
310
  ],
303
311
  };
304
312
  PropertyFactory.register(SomeNumbers);
305
313
  var originalSomeNumbers = PropertyFactory.create(SomeNumbers.typeid);
306
- let root = PropertyFactory.create('NodeProperty');
307
- root.insert('aValue', originalSomeNumbers);
308
- var someNumbers = root.resolvePath('aValue');
314
+ let root = PropertyFactory.create("NodeProperty");
315
+ root.insert("aValue", originalSomeNumbers);
316
+ var someNumbers = root.resolvePath("aValue");
309
317
  expect(someNumbers).to.equal(originalSomeNumbers);
310
- var aNumber = root.resolvePath('aValue.aValue');
318
+ var aNumber = root.resolvePath("aValue.aValue");
311
319
  expect(aNumber).to.exist;
312
- var aValue = root.resolvePath('aValue.aValue.aValue');
320
+ var aValue = root.resolvePath("aValue.aValue.aValue");
313
321
  expect(aValue).to.exist;
314
322
  });
315
- describe('getContext', function () {
316
- it('should work with context of single', function () {
317
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
318
- expect(myProp.getContext()).to.equal('single');
323
+ describe("getContext", function () {
324
+ it("should work with context of single", function () {
325
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
326
+ expect(myProp.getContext()).to.equal("single");
319
327
  });
320
- it('should work with other contexts', function () {
321
- var arrayProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0', 'array');
322
- expect(arrayProp.getContext()).to.equal('array');
323
- var mapProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0', 'map');
324
- expect(mapProp.getContext()).to.equal('map');
328
+ it("should work with other contexts", function () {
329
+ var arrayProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0", "array");
330
+ expect(arrayProp.getContext()).to.equal("array");
331
+ var mapProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0", "map");
332
+ expect(mapProp.getContext()).to.equal("map");
325
333
  });
326
334
  });
327
- describe('getFullTypeid', function () {
328
- it('should return the typeid of the property', function () {
329
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
330
- expect(myProp.getFullTypeid()).to.equal('autodesk.tests:property.with.special.characters-1.0.0');
335
+ describe("getFullTypeid", function () {
336
+ it("should return the typeid of the property", function () {
337
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
338
+ expect(myProp.getFullTypeid()).to.equal("autodesk.tests:property.with.special.characters-1.0.0");
331
339
  });
332
340
  });
333
- describe('getTypeid', function () {
334
- it('should return the typeid of the property', function () {
335
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
336
- expect(myProp.getTypeid()).to.equal('autodesk.tests:property.with.special.characters-1.0.0');
341
+ describe("getTypeid", function () {
342
+ it("should return the typeid of the property", function () {
343
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
344
+ expect(myProp.getTypeid()).to.equal("autodesk.tests:property.with.special.characters-1.0.0");
337
345
  });
338
346
  });
339
- describe('getId', function () {
340
- it('should return the id of the property', function () {
341
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
342
- var nested = myProp.get('test.property');
343
- expect(nested.getId()).to.equal('test.property');
347
+ describe("getId", function () {
348
+ it("should return the id of the property", function () {
349
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
350
+ var nested = myProp.get("test.property");
351
+ expect(nested.getId()).to.equal("test.property");
344
352
  });
345
353
  });
346
- describe('getParent', function () {
347
- it('should return the parent property', function () {
348
- var myProp = PropertyFactory.create('autodesk.tests:property.with.special.characters-1.0.0');
349
- var nested = myProp.get('test.property');
354
+ describe("getParent", function () {
355
+ it("should return the parent property", function () {
356
+ var myProp = PropertyFactory.create("autodesk.tests:property.with.special.characters-1.0.0");
357
+ var nested = myProp.get("test.property");
350
358
  expect(nested.getParent()).to.deep.equal(myProp);
351
359
  });
352
360
  });
353
361
  // Other aspects of traverseDown function are already tested. Missing BREAK_TRAVERSAL and paths only.
354
- describe('traverseDown, hasPendingChanges and getPendingChanges', function () {
362
+ describe("traverseDown, hasPendingChanges and getPendingChanges", function () {
355
363
  var BREAK_TRAVERSAL;
356
364
  before(function () {
357
- BREAK_TRAVERSAL = require('../..').BaseProperty.BREAK_TRAVERSAL;
365
+ BREAK_TRAVERSAL = require("../..").BaseProperty.BREAK_TRAVERSAL;
358
366
  var TestTraversalObject = {
359
- typeid: 'autodesk.tests:property.traversal-1.0.0',
367
+ typeid: "autodesk.tests:property.traversal-1.0.0",
360
368
  properties: [
361
- { id: 'p1', typeid: 'String' },
369
+ { id: "p1", typeid: "String" },
362
370
  {
363
- id: 'p2', properties: [
371
+ id: "p2",
372
+ properties: [
364
373
  {
365
- id: 'p2p1', properties: [
366
- { id: 'p2p1p1', typeid: 'String' },
367
- { id: 'p2p1p2', typeid: 'String' },
368
- { id: 'p2p1p3', typeid: 'String' },
374
+ id: "p2p1",
375
+ properties: [
376
+ { id: "p2p1p1", typeid: "String" },
377
+ { id: "p2p1p2", typeid: "String" },
378
+ { id: "p2p1p3", typeid: "String" },
369
379
  ],
370
380
  },
371
381
  {
372
- id: 'p2p2', properties: [
373
- { id: 'p2p2p1', typeid: 'String' },
374
- { id: 'p2p2p2', typeid: 'String' },
375
- { id: 'p2p2p3', typeid: 'Int32' },
382
+ id: "p2p2",
383
+ properties: [
384
+ { id: "p2p2p1", typeid: "String" },
385
+ { id: "p2p2p2", typeid: "String" },
386
+ { id: "p2p2p3", typeid: "Int32" },
376
387
  ],
377
388
  },
378
389
  ],
379
390
  },
380
- { id: 'p3', typeid: 'String' },
391
+ { id: "p3", typeid: "String" },
381
392
  {
382
- id: 'p4', properties: [
393
+ id: "p4",
394
+ properties: [
383
395
  {
384
- id: 'p4p1', properties: [
385
- { id: 'p4p1p1', typeid: 'String' },
386
- ],
396
+ id: "p4p1",
397
+ properties: [{ id: "p4p1p1", typeid: "String" }],
387
398
  },
388
399
  {
389
- id: 'p4p2', properties: [
390
- { id: 'p4p2p1', typeid: 'String' },
391
- ],
400
+ id: "p4p2",
401
+ properties: [{ id: "p4p2p1", typeid: "String" }],
392
402
  },
393
403
  ],
394
404
  },
@@ -396,8 +406,8 @@ describe('BaseProperty', function () {
396
406
  };
397
407
  PropertyFactory.register(TestTraversalObject);
398
408
  });
399
- it('should stop when callback returns BREAK_TRAVERSAL', function () {
400
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
409
+ it("should stop when callback returns BREAK_TRAVERSAL", function () {
410
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
401
411
  var nbrCalls = 0;
402
412
  var breakTrav = function (prop) {
403
413
  if (++nbrCalls === 5) {
@@ -408,113 +418,116 @@ describe('BaseProperty', function () {
408
418
  property.traverseDown(breakTrav);
409
419
  expect(nbrCalls).to.equal(5);
410
420
  });
411
- it('should provide path of each prop', function () {
421
+ it("should provide path of each prop", function () {
412
422
  var arrPaths = [];
413
423
  var gatherPaths = function (prop, path) {
414
424
  arrPaths.push(path);
415
425
  };
416
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
417
- property.resolvePath('p4').traverseDown(gatherPaths);
418
- expect(arrPaths).to.deep.equal(['p4p1', 'p4p1.p4p1p1', 'p4p2', 'p4p2.p4p2p1']);
419
- });
420
- it('should return pending changes', function () {
421
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
422
- expect(property.resolvePath('p2').getPendingChanges()).to.deep.equal(new ChangeSet({}));
423
- expect(property.resolvePath('p2').hasPendingChanges()).to.be.false;
424
- property.resolvePath('p2.p2p1.p2p1p2').value = 'Hi';
425
- property.resolvePath('p2.p2p2.p2p2p1').value = 'Hello';
426
- property.resolvePath('p2.p2p2.p2p2p3').value = 42;
427
- expect(property.resolvePath('p2').getPendingChanges()).to.deep.equal(new ChangeSet({ 'Int32': { 'p2p2.p2p2p3': 42 }, 'String': { 'p2p1.p2p1p2': 'Hi', 'p2p2.p2p2p1': 'Hello' } }));
428
- expect(property.resolvePath('p2').hasPendingChanges()).to.be.true;
429
- });
430
- it('should output a pretty string with prettyPrint()', function () {
431
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
432
- var expectedPrettyStr = 'p2 (ContainerProperty):\n' +
433
- ' p2p1 (ContainerProperty):\n' +
426
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
427
+ property.resolvePath("p4").traverseDown(gatherPaths);
428
+ expect(arrPaths).to.deep.equal(["p4p1", "p4p1.p4p1p1", "p4p2", "p4p2.p4p2p1"]);
429
+ });
430
+ it("should return pending changes", function () {
431
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
432
+ expect(property.resolvePath("p2").getPendingChanges()).to.deep.equal(new ChangeSet({}));
433
+ expect(property.resolvePath("p2").hasPendingChanges()).to.be.false;
434
+ property.resolvePath("p2.p2p1.p2p1p2").value = "Hi";
435
+ property.resolvePath("p2.p2p2.p2p2p1").value = "Hello";
436
+ property.resolvePath("p2.p2p2.p2p2p3").value = 42;
437
+ expect(property.resolvePath("p2").getPendingChanges()).to.deep.equal(new ChangeSet({
438
+ Int32: { "p2p2.p2p2p3": 42 },
439
+ String: { "p2p1.p2p1p2": "Hi", "p2p2.p2p2p1": "Hello" },
440
+ }));
441
+ expect(property.resolvePath("p2").hasPendingChanges()).to.be.true;
442
+ });
443
+ it("should output a pretty string with prettyPrint()", function () {
444
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
445
+ var expectedPrettyStr = "p2 (ContainerProperty):\n" +
446
+ " p2p1 (ContainerProperty):\n" +
434
447
  ' p2p1p1 (String): ""\n' +
435
448
  ' p2p1p2 (String): ""\n' +
436
449
  ' p2p1p3 (String): ""\n' +
437
- ' p2p2 (ContainerProperty):\n' +
450
+ " p2p2 (ContainerProperty):\n" +
438
451
  ' p2p2p1 (String): ""\n' +
439
452
  ' p2p2p2 (String): ""\n' +
440
- ' p2p2p3 (Int32): 0\n';
441
- var prettyStr = '';
442
- property.resolvePath('p2').prettyPrint(function (str) {
443
- prettyStr += str + '\n';
453
+ " p2p2p3 (Int32): 0\n";
454
+ var prettyStr = "";
455
+ property.resolvePath("p2").prettyPrint(function (str) {
456
+ prettyStr += str + "\n";
444
457
  });
445
458
  expect(prettyStr).to.equal(expectedPrettyStr);
446
459
  });
447
460
  });
448
- describe('Ancestry relations should be resolved correctly', function () {
461
+ describe("Ancestry relations should be resolved correctly", function () {
449
462
  /**
450
463
  * creates a workspace
451
464
  * @return {property-properties.Workspace} workspace
452
465
  */
453
466
  function createRootProperty() {
454
- return Promise.resolve(PropertyFactory.create('NodeProperty'));
467
+ return Promise.resolve(PropertyFactory.create("NodeProperty"));
455
468
  }
456
- it('property should be ancestor of subproperty', function () {
469
+ it("property should be ancestor of subproperty", function () {
457
470
  return createRootProperty().then(function (workspace) {
458
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
459
- var subproperty = property.resolvePath('p2.p2p1.p2p1p2');
460
- workspace.insert('test', property);
471
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
472
+ var subproperty = property.resolvePath("p2.p2p1.p2p1p2");
473
+ workspace.insert("test", property);
461
474
  expect(property.isAncestorOf(subproperty)).to.equal(true);
462
475
  });
463
476
  });
464
- it('property should not be ancestor itself', function () {
477
+ it("property should not be ancestor itself", function () {
465
478
  return createRootProperty().then(function (workspace) {
466
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
479
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
467
480
  expect(property.isAncestorOf(property)).to.equal(false);
468
481
  });
469
482
  });
470
- it('property not in workspace should correctly resolve ancestry', function () {
471
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
472
- var subproperty = property.resolvePath('p2.p2p1.p2p1p2');
483
+ it("property not in workspace should correctly resolve ancestry", function () {
484
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
485
+ var subproperty = property.resolvePath("p2.p2p1.p2p1p2");
473
486
  expect(property.isAncestorOf(subproperty)).to.equal(true);
474
487
  expect(subproperty.isDescendantOf(property)).to.equal(true);
475
488
  });
476
- it('property should be ancestor of subproperty', function () {
489
+ it("property should be ancestor of subproperty", function () {
477
490
  return createRootProperty().then(function (workspace) {
478
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
479
- var subproperty = property.resolvePath('p2.p2p1.p2p1p2');
480
- workspace.insert('test', property);
491
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
492
+ var subproperty = property.resolvePath("p2.p2p1.p2p1p2");
493
+ workspace.insert("test", property);
481
494
  expect(property.isAncestorOf(subproperty)).to.equal(true);
482
495
  });
483
496
  });
484
- it('subproperty should be descendant of property', function () {
497
+ it("subproperty should be descendant of property", function () {
485
498
  return createRootProperty().then(function (workspace) {
486
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
487
- var subproperty = property.resolvePath('p2.p2p1.p2p1p2');
488
- workspace.insert('test', property);
499
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
500
+ var subproperty = property.resolvePath("p2.p2p1.p2p1p2");
501
+ workspace.insert("test", property);
489
502
  expect(subproperty.isDescendantOf(property)).to.equal(true);
490
503
  });
491
504
  });
492
- it('property in array property should be descendant of array', function () {
505
+ it("property in array property should be descendant of array", function () {
493
506
  return createRootProperty().then(function (workspace) {
494
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0', 'array');
495
- var element = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
507
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0", "array");
508
+ var element = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
496
509
  property.push(element);
497
- var subproperty = element.resolvePath('p2.p2p1.p2p1p2');
498
- workspace.insert('test', property);
510
+ var subproperty = element.resolvePath("p2.p2p1.p2p1p2");
511
+ workspace.insert("test", property);
499
512
  expect(subproperty.isDescendantOf(property)).to.equal(true);
500
513
  });
501
514
  });
502
- it('array property should be ancestor of property in array', function () {
515
+ it("array property should be ancestor of property in array", function () {
503
516
  return createRootProperty().then(function (workspace) {
504
- var property = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0', 'array');
505
- var element = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
517
+ var property = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0", "array");
518
+ var element = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
506
519
  property.push(element);
507
- var subproperty = element.resolvePath('p2.p2p1.p2p1p2');
508
- workspace.insert('test', property);
520
+ var subproperty = element.resolvePath("p2.p2p1.p2p1p2");
521
+ workspace.insert("test", property);
509
522
  expect(property.isAncestorOf(subproperty)).to.equal(true);
510
523
  });
511
524
  });
512
- it('two different properties should not be related', function () {
525
+ it("two different properties should not be related", function () {
513
526
  return createRootProperty().then(function (workspace) {
514
- var prop1 = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
515
- var prop2 = PropertyFactory.create('autodesk.tests:property.traversal-1.0.0');
516
- workspace.insert('test1', prop1);
517
- workspace.insert('test2', prop2);
527
+ var prop1 = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
528
+ var prop2 = PropertyFactory.create("autodesk.tests:property.traversal-1.0.0");
529
+ workspace.insert("test1", prop1);
530
+ workspace.insert("test2", prop2);
518
531
  expect(prop2.isAncestorOf(prop1)).to.equal(false);
519
532
  expect(prop2.isDescendantOf(prop1)).to.equal(false);
520
533
  expect(prop1.isAncestorOf(prop2)).to.equal(false);