@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,40 +7,38 @@
7
7
  * @fileoverview
8
8
  * In this file, we will test the map property object described in /src/properties/mapProperty.js
9
9
  */
10
- const { ChangeSet } = require('@fluid-experimental/property-changeset');
11
- const { PropertyFactory } = require('../..');
12
- const { BaseProperty } = require('../..');
13
- describe('ValueMapProperty', function () {
10
+ const { ChangeSet } = require("@fluid-experimental/property-changeset");
11
+ const { PropertyFactory } = require("../..");
12
+ const { BaseProperty } = require("../..");
13
+ describe("ValueMapProperty", function () {
14
14
  var myNode, Uint32Map;
15
15
  before(function () {
16
16
  // Register a template with a set property for the tests
17
17
  var TestPropertyTemplate = {
18
- typeid: 'autodesk.tests:ValueMapTestPropertyID-1.0.0',
19
- inherits: ['NamedProperty'],
20
- properties: [
21
- { id: 'Uint32Map', typeid: 'Uint32', context: 'map' },
22
- ],
18
+ typeid: "autodesk.tests:ValueMapTestPropertyID-1.0.0",
19
+ inherits: ["NamedProperty"],
20
+ properties: [{ id: "Uint32Map", typeid: "Uint32", context: "map" }],
23
21
  };
24
22
  // Register a template with a set property for the tests
25
23
  var AllTypesTestPropertyTemplate = {
26
- typeid: 'autodesk.tests:AllTypesValueMapTestPropertyID-1.0.0',
27
- inherits: ['NamedProperty'],
24
+ typeid: "autodesk.tests:AllTypesValueMapTestPropertyID-1.0.0",
25
+ inherits: ["NamedProperty"],
28
26
  properties: [
29
- { id: 'Uint32Map', typeid: 'Uint32', context: 'map' },
30
- { id: 'Uint16Map', typeid: 'Uint16', context: 'map' },
31
- { id: 'Uint8Map', typeid: 'Uint8', context: 'map' },
32
- { id: 'Int32Map', typeid: 'Int32', context: 'map' },
33
- { id: 'Int16Map', typeid: 'Int16', context: 'map' },
34
- { id: 'Int8Map', typeid: 'Int8', context: 'map' },
35
- { id: 'Float64Map', typeid: 'Float64', context: 'map' },
36
- { id: 'Float32Map', typeid: 'Float32', context: 'map' },
37
- { id: 'StringMap', typeid: 'String', context: 'map' },
38
- { id: 'BoolMap', typeid: 'Bool', context: 'map' },
27
+ { id: "Uint32Map", typeid: "Uint32", context: "map" },
28
+ { id: "Uint16Map", typeid: "Uint16", context: "map" },
29
+ { id: "Uint8Map", typeid: "Uint8", context: "map" },
30
+ { id: "Int32Map", typeid: "Int32", context: "map" },
31
+ { id: "Int16Map", typeid: "Int16", context: "map" },
32
+ { id: "Int8Map", typeid: "Int8", context: "map" },
33
+ { id: "Float64Map", typeid: "Float64", context: "map" },
34
+ { id: "Float32Map", typeid: "Float32", context: "map" },
35
+ { id: "StringMap", typeid: "String", context: "map" },
36
+ { id: "BoolMap", typeid: "Bool", context: "map" },
39
37
  ],
40
38
  };
41
39
  PropertyFactory._reregister(TestPropertyTemplate);
42
40
  PropertyFactory._reregister(AllTypesTestPropertyTemplate);
43
- myNode = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
41
+ myNode = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
44
42
  Uint32Map = myNode._properties.Uint32Map;
45
43
  });
46
44
  // Helper functions for the test cases
@@ -51,7 +49,7 @@ describe('ValueMapProperty', function () {
51
49
  // Inserts a node with a given key (a new one is generated when undefined)
52
50
  var insertEntryInRootWithKey = function (key, root) {
53
51
  if (key === undefined) {
54
- key = 'node' + keyCounter++;
52
+ key = "node" + keyCounter++;
55
53
  }
56
54
  root._properties.Uint32Map.insert(key, keyCounter);
57
55
  };
@@ -61,7 +59,7 @@ describe('ValueMapProperty', function () {
61
59
  };
62
60
  // Returns a functor that will insert a node with a constant key
63
61
  var insertEntryInRootWithUnqiueKey = function () {
64
- var key = 'node' + keyCounter++;
62
+ var key = "node" + keyCounter++;
65
63
  return insertEntryInRootWithKey.bind(undefined, key);
66
64
  };
67
65
  // Removes the first node from the root
@@ -74,237 +72,240 @@ describe('ValueMapProperty', function () {
74
72
  var firstKey = root._properties.Uint32Map.getIds()[0];
75
73
  root._properties.Uint32Map.set(firstKey, root._properties.Uint32Map.get(firstKey) + 1);
76
74
  };
77
- describe('Inherited API Methods', function () {
75
+ describe("Inherited API Methods", function () {
78
76
  var newMap;
79
77
  before(function () {
80
- newMap = PropertyFactory.create('Int32', 'map');
78
+ newMap = PropertyFactory.create("Int32", "map");
81
79
  });
82
- it('.clear should work to remove all entries in the map', function () {
83
- newMap.insert('one', 1);
84
- newMap.insert('two', 2);
85
- expect(newMap.getValues()).to.deep.equal({ 'one': 1, 'two': 2 });
80
+ it(".clear should work to remove all entries in the map", function () {
81
+ newMap.insert("one", 1);
82
+ newMap.insert("two", 2);
83
+ expect(newMap.getValues()).to.deep.equal({ one: 1, two: 2 });
86
84
  newMap.clear();
87
85
  expect(newMap.getValues()).to.deep.equal({});
88
86
  });
89
- it('.getAsArray should return an array of map values', function () {
90
- newMap.insert('one', 1);
91
- newMap.insert('two', 2);
87
+ it(".getAsArray should return an array of map values", function () {
88
+ newMap.insert("one", 1);
89
+ newMap.insert("two", 2);
92
90
  expect(newMap.getAsArray()).to.deep.equal([1, 2]);
93
91
  });
94
- it('getEntriesReadOnly should work', function () {
95
- newMap.insert('one', 1);
96
- newMap.insert('two', 2);
97
- expect(newMap.getEntriesReadOnly()).to.deep.equal({ 'one': 1, 'two': 2 });
92
+ it("getEntriesReadOnly should work", function () {
93
+ newMap.insert("one", 1);
94
+ newMap.insert("two", 2);
95
+ expect(newMap.getEntriesReadOnly()).to.deep.equal({ one: 1, two: 2 });
98
96
  });
99
- it('.getFullTypeid should return a string of the typeid with or without collection', function () {
100
- expect(newMap.getFullTypeid()).to.equal('map<Int32>');
101
- expect(newMap.getFullTypeid(true)).to.equal('Int32');
97
+ it(".getFullTypeid should return a string of the typeid with or without collection", function () {
98
+ expect(newMap.getFullTypeid()).to.equal("map<Int32>");
99
+ expect(newMap.getFullTypeid(true)).to.equal("Int32");
102
100
  });
103
- it('.getIds should return an array of map keys', function () {
104
- newMap.insert('one', 1);
105
- newMap.insert('two', 2);
106
- expect(newMap.getIds()).to.deep.equal(['one', 'two']);
101
+ it(".getIds should return an array of map keys", function () {
102
+ newMap.insert("one", 1);
103
+ newMap.insert("two", 2);
104
+ expect(newMap.getIds()).to.deep.equal(["one", "two"]);
107
105
  });
108
- it('.getValues should return an object', function () {
109
- newMap.insert('one', 1);
110
- newMap.insert('two', 2);
111
- expect(newMap.getValues()).to.deep.equal({ 'one': 1, 'two': 2 });
106
+ it(".getValues should return an object", function () {
107
+ newMap.insert("one", 1);
108
+ newMap.insert("two", 2);
109
+ expect(newMap.getValues()).to.deep.equal({ one: 1, two: 2 });
112
110
  });
113
- it('.has should return a boolean', function () {
114
- newMap.insert('one', 1);
115
- newMap.insert('two', 2);
116
- expect(newMap.has('two')).to.equal(true);
117
- expect(newMap.has('three')).to.equal(false);
111
+ it(".has should return a boolean", function () {
112
+ newMap.insert("one", 1);
113
+ newMap.insert("two", 2);
114
+ expect(newMap.has("two")).to.equal(true);
115
+ expect(newMap.has("three")).to.equal(false);
118
116
  });
119
- it('.setValues should work to set multiple values', function () {
120
- newMap.setValues({ 'first': 11, 'second': 22, 'third': 33 });
121
- expect(newMap.get('first')).to.equal(11);
122
- expect(newMap.get('third')).to.equal(33);
117
+ it(".setValues should work to set multiple values", function () {
118
+ newMap.setValues({ first: 11, second: 22, third: 33 });
119
+ expect(newMap.get("first")).to.equal(11);
120
+ expect(newMap.get("third")).to.equal(33);
123
121
  });
124
122
  afterEach(function () {
125
123
  newMap.clear();
126
124
  });
127
125
  });
128
- describe('Testing creation, assignment and serialization', function () {
129
- it('should be empty at the beginning', function () {
126
+ describe("Testing creation, assignment and serialization", function () {
127
+ it("should be empty at the beginning", function () {
130
128
  expect(Uint32Map.getAsArray()).to.be.empty;
131
129
  expect(Uint32Map.getEntriesReadOnly()).to.be.empty;
132
- expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ 'dirtyOnly': false }))).to.be.ok;
133
- expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ 'dirtyOnly': true }))).to.be.ok;
134
- });
135
- it('should be possible to add entries', function () {
136
- Uint32Map.insert('value1', 1);
137
- expect(Uint32Map.get('value1')).to.equal(1);
138
- Uint32Map.insert('value2', 2);
139
- expect(Uint32Map.get('value2')).to.equal(2);
140
- Uint32Map.insert('value3', 3);
141
- expect(Uint32Map.get('value3')).to.equal(3);
142
- expect(Uint32Map.getEntriesReadOnly()).to.deep.equal({ 'value1': 1, 'value2': 2, 'value3': 3 });
130
+ expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ dirtyOnly: false }))).to.be.ok;
131
+ expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ dirtyOnly: true }))).to.be.ok;
132
+ });
133
+ it("should be possible to add entries", function () {
134
+ Uint32Map.insert("value1", 1);
135
+ expect(Uint32Map.get("value1")).to.equal(1);
136
+ Uint32Map.insert("value2", 2);
137
+ expect(Uint32Map.get("value2")).to.equal(2);
138
+ Uint32Map.insert("value3", 3);
139
+ expect(Uint32Map.get("value3")).to.equal(3);
140
+ expect(Uint32Map.getEntriesReadOnly()).to.deep.equal({
141
+ value1: 1,
142
+ value2: 2,
143
+ value3: 3,
144
+ });
143
145
  expect(Uint32Map.getAsArray()).to.include(1, 2, 3);
144
- expect(Uint32Map.has('value1')).to.be.ok;
145
- expect(Uint32Map.has('value2')).to.be.ok;
146
- expect(Uint32Map.has('value3')).to.be.ok;
146
+ expect(Uint32Map.has("value1")).to.be.ok;
147
+ expect(Uint32Map.has("value2")).to.be.ok;
148
+ expect(Uint32Map.has("value3")).to.be.ok;
147
149
  expect(Uint32Map.serialize()).to.deep.equal({
148
- insert: { 'value1': 1, 'value2': 2, 'value3': 3 },
150
+ insert: { value1: 1, value2: 2, value3: 3 },
149
151
  });
150
152
  });
151
- it('should be possible to remove entries', function () {
152
- Uint32Map.remove('value1');
153
- expect(Uint32Map.has('value1')).to.be.not.ok;
154
- Uint32Map.remove('value2');
155
- expect(Uint32Map.has('value1')).to.be.not.ok;
156
- Uint32Map.remove('value3');
157
- expect(Uint32Map.has('value1')).to.be.not.ok;
153
+ it("should be possible to remove entries", function () {
154
+ Uint32Map.remove("value1");
155
+ expect(Uint32Map.has("value1")).to.be.not.ok;
156
+ Uint32Map.remove("value2");
157
+ expect(Uint32Map.has("value1")).to.be.not.ok;
158
+ Uint32Map.remove("value3");
159
+ expect(Uint32Map.has("value1")).to.be.not.ok;
158
160
  expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize())).to.be.ok;
159
161
  });
160
- it('a remove followed by an insert should become a modify', function () {
161
- Uint32Map.insert('value1', 1);
162
+ it("a remove followed by an insert should become a modify", function () {
163
+ Uint32Map.insert("value1", 1);
162
164
  Uint32Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
163
165
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
164
- Uint32Map.remove('value1');
165
- Uint32Map.insert('value1', 2);
166
- expect(Uint32Map.serialize({ 'dirtyOnly': true })).to.deep.equal({
167
- modify: { 'value1': 2 },
166
+ Uint32Map.remove("value1");
167
+ Uint32Map.insert("value1", 2);
168
+ expect(Uint32Map.serialize({ dirtyOnly: true })).to.deep.equal({
169
+ modify: { value1: 2 },
168
170
  });
169
171
  // This should also work for a set operation
170
- Uint32Map.set('value1', 3);
171
- expect(Uint32Map.serialize({ 'dirtyOnly': true })).to.deep.equal({
172
- modify: { 'value1': 3 },
172
+ Uint32Map.set("value1", 3);
173
+ expect(Uint32Map.serialize({ dirtyOnly: true })).to.deep.equal({
174
+ modify: { value1: 3 },
173
175
  });
174
176
  // But setting the same value should give an empty ChangeSet
175
177
  Uint32Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
176
178
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
177
- Uint32Map.set('value1', 3);
178
- expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ 'dirtyOnly': true }))).to.be.ok;
179
+ Uint32Map.set("value1", 3);
180
+ expect(ChangeSet.isEmptyChangeSet(Uint32Map.serialize({ dirtyOnly: true }))).to.be.ok;
179
181
  // This should be tracked separately for dirtyness and pending changes
180
182
  Uint32Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
181
183
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
182
- Uint32Map.remove('value1');
184
+ Uint32Map.remove("value1");
183
185
  Uint32Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
184
- Uint32Map.insert('value1', 2);
186
+ Uint32Map.insert("value1", 2);
185
187
  expect(Uint32Map.serialize({
186
- 'dirtyOnly': true,
187
- 'includeRootTypeid': false,
188
- 'dirtinessType': BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,
189
- })).to.deep.equal({ modify: { 'value1': 2 } });
188
+ dirtyOnly: true,
189
+ includeRootTypeid: false,
190
+ dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,
191
+ })).to.deep.equal({ modify: { value1: 2 } });
190
192
  expect(Uint32Map.serialize({
191
- 'dirtyOnly': true,
192
- 'includeRootTypeid': false,
193
- 'dirtinessType': BaseProperty.MODIFIED_STATE_FLAGS.DIRTY,
194
- })).to.deep.equal({ insert: { 'value1': 2 } });
195
- });
196
- it('deserialize should work', function () {
197
- var myInitialStateNode = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
198
- myInitialStateNode._properties.Uint32Map.insert('value1', 1);
199
- myInitialStateNode._properties.Uint32Map.insert('value2', 2);
193
+ dirtyOnly: true,
194
+ includeRootTypeid: false,
195
+ dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY,
196
+ })).to.deep.equal({ insert: { value1: 2 } });
197
+ });
198
+ it("deserialize should work", function () {
199
+ var myInitialStateNode = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
200
+ myInitialStateNode._properties.Uint32Map.insert("value1", 1);
201
+ myInitialStateNode._properties.Uint32Map.insert("value2", 2);
200
202
  var initialChangeSet = myInitialStateNode.serialize();
201
203
  // Deserialize a copy into a second node and check that the chageset is correct
202
- var myDeserializeNode1 = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
204
+ var myDeserializeNode1 = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
203
205
  var changes = myDeserializeNode1.deserialize(initialChangeSet);
204
206
  expect(changes).to.deep.equal(initialChangeSet);
205
207
  expect(myDeserializeNode1.serialize()).to.deep.equal(myInitialStateNode.serialize());
206
208
  myDeserializeNode1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
207
209
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
208
210
  // Create a third copy
209
- var myDeserializeNode2 = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
211
+ var myDeserializeNode2 = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
210
212
  myDeserializeNode2.deserialize(initialChangeSet);
211
213
  myDeserializeNode2.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
212
214
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
213
215
  myInitialStateNode.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
214
216
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
215
- myInitialStateNode._properties.Uint32Map.set('value1', 2);
216
- myInitialStateNode._properties.Uint32Map.remove('value2');
217
- myInitialStateNode._properties.Uint32Map.insert('value3', 3);
218
- var changesChangeSet = myInitialStateNode.serialize({ 'dirtyOnly': true });
219
- var fullChangeSet = myInitialStateNode.serialize({ 'dirtyOnly': false });
217
+ myInitialStateNode._properties.Uint32Map.set("value1", 2);
218
+ myInitialStateNode._properties.Uint32Map.remove("value2");
219
+ myInitialStateNode._properties.Uint32Map.insert("value3", 3);
220
+ var changesChangeSet = myInitialStateNode.serialize({ dirtyOnly: true });
221
+ var fullChangeSet = myInitialStateNode.serialize({ dirtyOnly: false });
220
222
  var reportedChanges = myDeserializeNode1.deserialize(fullChangeSet);
221
- expect(myDeserializeNode1.serialize({ 'dirtyOnly': false })).to.deep.equal(myInitialStateNode.serialize({ 'dirtyOnly': false }));
223
+ expect(myDeserializeNode1.serialize({ dirtyOnly: false })).to.deep.equal(myInitialStateNode.serialize({ dirtyOnly: false }));
222
224
  expect(reportedChanges).to.deep.equal(changesChangeSet);
223
- expect(myDeserializeNode1.serialize({ 'dirtyOnly': true })).to.deep.equal(changesChangeSet);
225
+ expect(myDeserializeNode1.serialize({ dirtyOnly: true })).to.deep.equal(changesChangeSet);
224
226
  var deserializeChanges = myDeserializeNode2.deserialize(fullChangeSet);
225
227
  expect(deserializeChanges).to.deep.equal(changesChangeSet);
226
228
  });
227
- it('inserting the same key twice should throw an exception', function () {
228
- var rootNode = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
229
- rootNode._properties.Uint32Map.insert('node1', 1);
229
+ it("inserting the same key twice should throw an exception", function () {
230
+ var rootNode = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
231
+ rootNode._properties.Uint32Map.insert("node1", 1);
230
232
  expect(function () {
231
- rootNode._properties.Uint32Map.insert('node1', 2);
233
+ rootNode._properties.Uint32Map.insert("node1", 2);
232
234
  }).to.throw();
233
235
  });
234
- it('set should overwrite existing entry', function () {
235
- var rootNode = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
236
- rootNode._properties.Uint32Map.set('node1', 0);
237
- rootNode._properties.Uint32Map.set('node1', 1);
236
+ it("set should overwrite existing entry", function () {
237
+ var rootNode = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
238
+ rootNode._properties.Uint32Map.set("node1", 0);
239
+ rootNode._properties.Uint32Map.set("node1", 1);
238
240
  // the set should overwrite the insert
239
- expect(rootNode.serialize({ 'dirtyOnly': true })['map<Uint32>'].Uint32Map).to.have.all.keys('insert');
241
+ expect(rootNode.serialize({ dirtyOnly: true })["map<Uint32>"].Uint32Map).to.have.all.keys("insert");
240
242
  // Overwriting with the same property shouldn't dirty the node
241
243
  rootNode.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
242
244
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
243
- rootNode._properties.Uint32Map.set('node1', 1);
244
- expect(ChangeSet.isEmptyChangeSet(rootNode.serialize({ 'dirtyOnly': true }))).to.be.ok;
245
+ rootNode._properties.Uint32Map.set("node1", 1);
246
+ expect(ChangeSet.isEmptyChangeSet(rootNode.serialize({ dirtyOnly: true }))).to.be.ok;
245
247
  expect(rootNode.isDirty()).to.be.false;
246
248
  // Overwriting with a different value should result in a modify
247
- rootNode._properties.Uint32Map.set('node1', 2);
248
- expect(rootNode.serialize({ 'dirtyOnly': true })['map<Uint32>'].Uint32Map).to.have.all.keys('modify');
249
- });
250
- it('casting should work as expected', function () {
251
- var property = PropertyFactory.create('autodesk.tests:AllTypesValueMapTestPropertyID-1.0.0');
252
- property._properties.Uint32Map.set('tooLarge', 1e20);
253
- property._properties.Uint32Map.set('negative', -1);
254
- property._properties.Uint16Map.set('tooLarge', 1e20);
255
- property._properties.Uint16Map.set('negative', -1);
256
- property._properties.Uint8Map.set('tooLarge', 1e20);
257
- property._properties.Uint8Map.set('negative', -1);
258
- property._properties.Int16Map.set('tooSmall', -32769);
259
- property._properties.Int16Map.set('tooLarge', 32768);
260
- property._properties.Int8Map.set('tooSmall', -129);
261
- property._properties.Int8Map.set('tooLarge', 128);
262
- property._properties.Float64Map.set('value', 1e300);
263
- property._properties.Float32Map.set('tooLarge', 1e300);
264
- property._properties.StringMap.set('value', 'test');
265
- property._properties.BoolMap.set('true', 1);
266
- property._properties.BoolMap.set('false', 0);
267
- expect(property._properties.Uint32Map.get('tooLarge')).to.be.below(Math.pow(2, 32));
268
- expect(property._properties.Uint32Map.get('tooLarge')).to.be.above(-1);
269
- expect(property._properties.Uint32Map.get('negative')).to.be.below(Math.pow(2, 32));
270
- expect(property._properties.Uint32Map.get('negative')).to.be.above(-1);
271
- expect(property._properties.Uint16Map.get('tooLarge')).to.be.below(Math.pow(2, 16));
272
- expect(property._properties.Uint16Map.get('tooLarge')).to.be.above(-1);
273
- expect(property._properties.Uint16Map.get('negative')).to.be.below(Math.pow(2, 16));
274
- expect(property._properties.Uint16Map.get('negative')).to.be.above(-1);
275
- expect(property._properties.Uint8Map.get('tooLarge')).to.be.below(Math.pow(2, 8));
276
- expect(property._properties.Uint8Map.get('tooLarge')).to.be.above(-1);
277
- expect(property._properties.Uint8Map.get('negative')).to.be.below(Math.pow(2, 8));
278
- expect(property._properties.Uint8Map.get('negative')).to.be.above(-1);
279
- expect(property._properties.Int16Map.get('tooLarge')).to.be.below(32768);
280
- expect(property._properties.Int16Map.get('tooLarge')).to.be.above(-32769);
281
- expect(property._properties.Int16Map.get('tooSmall')).to.be.below(32768);
282
- expect(property._properties.Int16Map.get('tooSmall')).to.be.above(-32769);
283
- expect(property._properties.Int8Map.get('tooLarge')).to.be.below(128);
284
- expect(property._properties.Int8Map.get('tooLarge')).to.be.above(-129);
285
- expect(property._properties.Int8Map.get('tooSmall')).to.be.below(128);
286
- expect(property._properties.Int8Map.get('tooSmall')).to.be.above(-129);
287
- expect(property._properties.Float32Map.get('tooLarge')).to.equal(Infinity);
288
- expect(property._properties.Float64Map.get('value')).to.equal(1e300);
289
- expect(property._properties.StringMap.get('value')).to.equal('test');
290
- expect(property._properties.BoolMap.get('true')).to.equal(true);
291
- expect(property._properties.BoolMap.get('false')).to.equal(false);
292
- });
293
- it('prettyPrint should work', function () {
294
- var myProp = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0')._properties.Uint32Map;
295
- myProp.insert('value1', 1);
296
- myProp.insert('value2', 2);
297
- var expectedPrettyStr = 'Uint32Map (Map of Uint32):\n' +
298
- ' value1: 1\n' +
299
- ' value2: 2\n';
300
- var prettyStr = '';
249
+ rootNode._properties.Uint32Map.set("node1", 2);
250
+ expect(rootNode.serialize({ dirtyOnly: true })["map<Uint32>"].Uint32Map).to.have.all.keys("modify");
251
+ });
252
+ it("casting should work as expected", function () {
253
+ var property = PropertyFactory.create("autodesk.tests:AllTypesValueMapTestPropertyID-1.0.0");
254
+ property._properties.Uint32Map.set("tooLarge", 1e20);
255
+ property._properties.Uint32Map.set("negative", -1);
256
+ property._properties.Uint16Map.set("tooLarge", 1e20);
257
+ property._properties.Uint16Map.set("negative", -1);
258
+ property._properties.Uint8Map.set("tooLarge", 1e20);
259
+ property._properties.Uint8Map.set("negative", -1);
260
+ property._properties.Int16Map.set("tooSmall", -32769);
261
+ property._properties.Int16Map.set("tooLarge", 32768);
262
+ property._properties.Int8Map.set("tooSmall", -129);
263
+ property._properties.Int8Map.set("tooLarge", 128);
264
+ property._properties.Float64Map.set("value", 1e300);
265
+ property._properties.Float32Map.set("tooLarge", 1e300);
266
+ property._properties.StringMap.set("value", "test");
267
+ property._properties.BoolMap.set("true", 1);
268
+ property._properties.BoolMap.set("false", 0);
269
+ expect(property._properties.Uint32Map.get("tooLarge")).to.be.below(Math.pow(2, 32));
270
+ expect(property._properties.Uint32Map.get("tooLarge")).to.be.above(-1);
271
+ expect(property._properties.Uint32Map.get("negative")).to.be.below(Math.pow(2, 32));
272
+ expect(property._properties.Uint32Map.get("negative")).to.be.above(-1);
273
+ expect(property._properties.Uint16Map.get("tooLarge")).to.be.below(Math.pow(2, 16));
274
+ expect(property._properties.Uint16Map.get("tooLarge")).to.be.above(-1);
275
+ expect(property._properties.Uint16Map.get("negative")).to.be.below(Math.pow(2, 16));
276
+ expect(property._properties.Uint16Map.get("negative")).to.be.above(-1);
277
+ expect(property._properties.Uint8Map.get("tooLarge")).to.be.below(Math.pow(2, 8));
278
+ expect(property._properties.Uint8Map.get("tooLarge")).to.be.above(-1);
279
+ expect(property._properties.Uint8Map.get("negative")).to.be.below(Math.pow(2, 8));
280
+ expect(property._properties.Uint8Map.get("negative")).to.be.above(-1);
281
+ expect(property._properties.Int16Map.get("tooLarge")).to.be.below(32768);
282
+ expect(property._properties.Int16Map.get("tooLarge")).to.be.above(-32769);
283
+ expect(property._properties.Int16Map.get("tooSmall")).to.be.below(32768);
284
+ expect(property._properties.Int16Map.get("tooSmall")).to.be.above(-32769);
285
+ expect(property._properties.Int8Map.get("tooLarge")).to.be.below(128);
286
+ expect(property._properties.Int8Map.get("tooLarge")).to.be.above(-129);
287
+ expect(property._properties.Int8Map.get("tooSmall")).to.be.below(128);
288
+ expect(property._properties.Int8Map.get("tooSmall")).to.be.above(-129);
289
+ expect(property._properties.Float32Map.get("tooLarge")).to.equal(Infinity);
290
+ expect(property._properties.Float64Map.get("value")).to.equal(1e300);
291
+ expect(property._properties.StringMap.get("value")).to.equal("test");
292
+ expect(property._properties.BoolMap.get("true")).to.equal(true);
293
+ expect(property._properties.BoolMap.get("false")).to.equal(false);
294
+ });
295
+ it("prettyPrint should work", function () {
296
+ var myProp = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0")
297
+ ._properties.Uint32Map;
298
+ myProp.insert("value1", 1);
299
+ myProp.insert("value2", 2);
300
+ var expectedPrettyStr = "Uint32Map (Map of Uint32):\n" + " value1: 1\n" + " value2: 2\n";
301
+ var prettyStr = "";
301
302
  myProp.prettyPrint(function (str) {
302
- prettyStr += str + '\n';
303
+ prettyStr += str + "\n";
303
304
  });
304
305
  expect(prettyStr).to.equal(expectedPrettyStr);
305
306
  });
306
307
  });
307
- describe('squashing', function () {
308
+ describe("squashing", function () {
308
309
  //
309
310
  // Helper function which takes a sequence of callbacks that are suceessively executed
310
311
  // and the changes applied by the callbacks are separately tracked and squashed in a
@@ -315,7 +316,7 @@ describe('ValueMapProperty', function () {
315
316
  //
316
317
  var testChangeSetSquashing = function (in_options) {
317
318
  resetKeyCounter();
318
- var testProperty = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
319
+ var testProperty = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
319
320
  var callbacks = in_options.callbacks;
320
321
  if (in_options.pre) {
321
322
  in_options.pre(testProperty);
@@ -327,7 +328,7 @@ describe('ValueMapProperty', function () {
327
328
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
328
329
  for (var i = 0; i < callbacks.length; i++) {
329
330
  callbacks[i](testProperty);
330
- var changes = testProperty.serialize({ 'dirtyOnly': true });
331
+ var changes = testProperty.serialize({ dirtyOnly: true });
331
332
  testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
332
333
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
333
334
  squashedChangeset.applyChangeSet(changes);
@@ -336,25 +337,38 @@ describe('ValueMapProperty', function () {
336
337
  in_options.post(squashedChangeset.getSerializedChangeSet());
337
338
  }
338
339
  initialChangeset.applyChangeSet(squashedChangeset.getSerializedChangeSet());
339
- expect(initialChangeset.getSerializedChangeSet()).to.deep.equal(testProperty.serialize({ 'dirtyOnly': false }));
340
+ expect(initialChangeset.getSerializedChangeSet()).to.deep.equal(testProperty.serialize({ dirtyOnly: false }));
340
341
  };
341
- it('should work for multiple independent inserts', function () {
342
- testChangeSetSquashing({ callbacks: [insertNodeInRoot, insertNodeInRoot, insertNodeInRoot] });
342
+ it("should work for multiple independent inserts", function () {
343
+ testChangeSetSquashing({
344
+ callbacks: [insertNodeInRoot, insertNodeInRoot, insertNodeInRoot],
345
+ });
343
346
  });
344
- it('should work for inserts followed by removes', function () {
347
+ it("should work for inserts followed by removes", function () {
345
348
  testChangeSetSquashing({
346
- callbacks: [insertNodeInRoot, insertNodeInRoot, removeFirstNodeInRoot, removeFirstNodeInRoot],
349
+ callbacks: [
350
+ insertNodeInRoot,
351
+ insertNodeInRoot,
352
+ removeFirstNodeInRoot,
353
+ removeFirstNodeInRoot,
354
+ ],
347
355
  post: function (changeset) {
348
356
  expect(changeset).to.be.empty;
349
357
  },
350
358
  });
351
359
  });
352
- it('of inserts and modifies should work', function () {
360
+ it("of inserts and modifies should work", function () {
353
361
  testChangeSetSquashing({
354
- callbacks: [insertNodeInRoot, insertNodeInRoot, insertNodeInRoot, modifyEntry, modifyEntry],
362
+ callbacks: [
363
+ insertNodeInRoot,
364
+ insertNodeInRoot,
365
+ insertNodeInRoot,
366
+ modifyEntry,
367
+ modifyEntry,
368
+ ],
355
369
  });
356
370
  });
357
- it('an insert, modify and a remove should give an empty changeset', function () {
371
+ it("an insert, modify and a remove should give an empty changeset", function () {
358
372
  testChangeSetSquashing({
359
373
  callbacks: [insertNodeInRoot, modifyEntry, modifyEntry, removeFirstNodeInRoot],
360
374
  post: function (changeset) {
@@ -362,50 +376,50 @@ describe('ValueMapProperty', function () {
362
376
  },
363
377
  });
364
378
  });
365
- it('should work for modifies after an already existing insert', function () {
379
+ it("should work for modifies after an already existing insert", function () {
366
380
  testChangeSetSquashing({
367
381
  pre: insertNodeInRoot,
368
382
  callbacks: [modifyEntry, modifyEntry],
369
383
  });
370
384
  });
371
- it('of modify and remove after an already existing insert should work', function () {
385
+ it("of modify and remove after an already existing insert should work", function () {
372
386
  testChangeSetSquashing({
373
387
  pre: insertNodeInRoot,
374
388
  callbacks: [modifyEntry, removeFirstNodeInRoot],
375
389
  post: function (changeset) {
376
- expect(changeset['map<Uint32>'].Uint32Map).to.have.all.keys('remove');
390
+ expect(changeset["map<Uint32>"].Uint32Map).to.have.all.keys("remove");
377
391
  },
378
392
  });
379
393
  });
380
- it('of remove and insert should result in modify', function () {
394
+ it("of remove and insert should result in modify", function () {
381
395
  // Create two nodes with the same GUID
382
396
  testChangeSetSquashing({
383
397
  pre: function (root) {
384
- root._properties.Uint32Map.insert('node1', 1);
398
+ root._properties.Uint32Map.insert("node1", 1);
385
399
  },
386
400
  callbacks: [
387
401
  removeFirstNodeInRoot,
388
402
  function (root) {
389
- root._properties.Uint32Map.insert('node1', 2);
403
+ root._properties.Uint32Map.insert("node1", 2);
390
404
  },
391
405
  ],
392
406
  post: function (changeset) {
393
- expect(changeset['map<Uint32>'].Uint32Map).to.have.all.keys('modify');
407
+ expect(changeset["map<Uint32>"].Uint32Map).to.have.all.keys("modify");
394
408
  },
395
409
  });
396
410
  });
397
411
  });
398
- describe('Rebasing', function () {
412
+ describe("Rebasing", function () {
399
413
  var testRebasing = function (in_options) {
400
414
  // Prepare the initial state
401
- var baseProperty1 = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
415
+ var baseProperty1 = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
402
416
  if (in_options.prepare) {
403
417
  in_options.prepare(baseProperty1);
404
418
  }
405
419
  // Create two copies of this state
406
- var baseProperty2 = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
420
+ var baseProperty2 = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
407
421
  baseProperty2.deserialize(baseProperty1.serialize());
408
- var baseProperty3 = PropertyFactory.create('autodesk.tests:ValueMapTestPropertyID-1.0.0');
422
+ var baseProperty3 = PropertyFactory.create("autodesk.tests:ValueMapTestPropertyID-1.0.0");
409
423
  baseProperty3.deserialize(baseProperty1.serialize());
410
424
  // Make sure the states are clear
411
425
  baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
@@ -423,8 +437,8 @@ describe('ValueMapProperty', function () {
423
437
  in_options.op2(baseProperty2);
424
438
  }
425
439
  // Get the ChangeSets
426
- var changeSet1 = new ChangeSet(baseProperty1.serialize({ 'dirtyOnly': true }));
427
- var changeSet2 = baseProperty2.serialize({ 'dirtyOnly': true });
440
+ var changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));
441
+ var changeSet2 = baseProperty2.serialize({ dirtyOnly: true });
428
442
  // Perform the actual rebase
429
443
  var conflicts = [];
430
444
  changeSet1._rebaseChangeSet(changeSet2, conflicts);
@@ -439,55 +453,55 @@ describe('ValueMapProperty', function () {
439
453
  if (in_options.op2) {
440
454
  in_options.op2(baseProperty3);
441
455
  }
442
- var finalChangeSet = baseProperty3.serialize({ 'dirtyOnly': false });
456
+ var finalChangeSet = baseProperty3.serialize({ dirtyOnly: false });
443
457
  expect(finalChangeSet).to.be.deep.equal(combinedChangeSet.getSerializedChangeSet());
444
458
  }
445
459
  if (in_options.checkResult) {
446
460
  in_options.checkResult(conflicts, changeSet2, combinedChangeSet);
447
461
  }
448
462
  };
449
- it('with a NOP should be possible', function () {
463
+ it("with a NOP should be possible", function () {
450
464
  testRebasing({
451
465
  op2: insertEntryInRootWithUnqiueKey(),
452
466
  compareToSequential: true,
453
467
  });
454
468
  });
455
- it('with independent inserts should be possible', function () {
469
+ it("with independent inserts should be possible", function () {
456
470
  testRebasing({
457
471
  op1: insertEntryInRootWithUnqiueKey(),
458
472
  op2: insertEntryInRootWithUnqiueKey(),
459
473
  compareToSequential: true,
460
474
  });
461
475
  });
462
- it('with independent removes should be possible', function () {
476
+ it("with independent removes should be possible", function () {
463
477
  testRebasing({
464
478
  prepare: function (root) {
465
- root._properties.Uint32Map.insert('entry1', 1);
466
- root._properties.Uint32Map.insert('entry2', 2);
479
+ root._properties.Uint32Map.insert("entry1", 1);
480
+ root._properties.Uint32Map.insert("entry2", 2);
467
481
  },
468
482
  op1: function (root) {
469
- root._properties.Uint32Map.remove('entry1');
483
+ root._properties.Uint32Map.remove("entry1");
470
484
  },
471
485
  op2: function (root) {
472
- root._properties.Uint32Map.remove('entry2');
486
+ root._properties.Uint32Map.remove("entry2");
473
487
  },
474
488
  compareToSequential: true,
475
489
  });
476
490
  });
477
- it('with a modify and a remove should possible', function () {
491
+ it("with a modify and a remove should possible", function () {
478
492
  testRebasing({
479
493
  prepare: function (root) {
480
- root._properties.Uint32Map.insert('entry1', 1);
494
+ root._properties.Uint32Map.insert("entry1", 1);
481
495
  },
482
496
  op1: modifyEntry,
483
497
  op2: removeFirstNodeInRoot,
484
498
  compareToSequential: true,
485
499
  });
486
500
  });
487
- it('with a remove and a modify should possible', function () {
501
+ it("with a remove and a modify should possible", function () {
488
502
  testRebasing({
489
503
  prepare: function (root) {
490
- root._properties.Uint32Map.insert('entry1', 1);
504
+ root._properties.Uint32Map.insert("entry1", 1);
491
505
  },
492
506
  op1: removeFirstNodeInRoot,
493
507
  op2: modifyEntry,
@@ -495,21 +509,21 @@ describe('ValueMapProperty', function () {
495
509
  checkResult: function (conflicts, changeSet) {
496
510
  expect(conflicts).to.have.length(1);
497
511
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
498
- expect(conflicts[0].path).to.be.equal('Uint32Map[entry1]');
512
+ expect(conflicts[0].path).to.be.equal("Uint32Map[entry1]");
499
513
  expect(ChangeSet.isEmptyChangeSet(changeSet)).to.be.ok;
500
514
  },
501
515
  });
502
516
  });
503
- it('with two compatible removes should be possible', function () {
517
+ it("with two compatible removes should be possible", function () {
504
518
  testRebasing({
505
519
  prepare: function (root) {
506
- root._properties.Uint32Map.insert('entry1', 1);
520
+ root._properties.Uint32Map.insert("entry1", 1);
507
521
  },
508
522
  op1: function (root) {
509
- root._properties.Uint32Map.remove('entry1');
523
+ root._properties.Uint32Map.remove("entry1");
510
524
  },
511
525
  op2: function (root) {
512
- root._properties.Uint32Map.remove('entry1');
526
+ root._properties.Uint32Map.remove("entry1");
513
527
  },
514
528
  compareToSequential: false,
515
529
  checkResult: function (conflicts, changeSet) {
@@ -517,79 +531,78 @@ describe('ValueMapProperty', function () {
517
531
  },
518
532
  });
519
533
  });
520
- it('with two conflicting modifies should be possible and report a conflict', function () {
534
+ it("with two conflicting modifies should be possible and report a conflict", function () {
521
535
  testRebasing({
522
536
  prepare: function (root) {
523
- root._properties.Uint32Map.insert('entry1', 1);
537
+ root._properties.Uint32Map.insert("entry1", 1);
524
538
  },
525
539
  op1: function (root) {
526
- root._properties.Uint32Map.set('entry1', 2);
540
+ root._properties.Uint32Map.set("entry1", 2);
527
541
  },
528
542
  op2: function (root) {
529
- root._properties.Uint32Map.set('entry1', 3);
543
+ root._properties.Uint32Map.set("entry1", 3);
530
544
  },
531
545
  compareToSequential: true,
532
546
  checkResult: function (conflicts, changeSet) {
533
547
  expect(conflicts).to.have.length(1);
534
548
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
535
- expect(conflicts[0].path).to.be.equal('Uint32Map[entry1]');
549
+ expect(conflicts[0].path).to.be.equal("Uint32Map[entry1]");
536
550
  },
537
551
  });
538
552
  });
539
- it('with modify followed by remove+insert should be a conflicting set', function () {
553
+ it("with modify followed by remove+insert should be a conflicting set", function () {
540
554
  testRebasing({
541
555
  prepare: function (root) {
542
- root._properties.Uint32Map.insert('entry1', 1);
556
+ root._properties.Uint32Map.insert("entry1", 1);
543
557
  },
544
558
  op1: modifyEntry,
545
559
  op2: function (root) {
546
- root._properties.Uint32Map.remove('entry1');
547
- root._properties.Uint32Map.insert('entry1', 2);
560
+ root._properties.Uint32Map.remove("entry1");
561
+ root._properties.Uint32Map.insert("entry1", 2);
548
562
  },
549
563
  compareToSequential: true,
550
564
  checkResult: function (conflicts, changeSet) {
551
565
  expect(conflicts).to.have.length(1);
552
566
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
553
- expect(conflicts[0].path).to.be.equal('Uint32Map[entry1]');
567
+ expect(conflicts[0].path).to.be.equal("Uint32Map[entry1]");
554
568
  },
555
569
  });
556
570
  });
557
- it('with remove+insert followed by modify should be a conflicting set', function () {
571
+ it("with remove+insert followed by modify should be a conflicting set", function () {
558
572
  testRebasing({
559
573
  prepare: function (root) {
560
- root._properties.Uint32Map.insert('entry1', 1);
574
+ root._properties.Uint32Map.insert("entry1", 1);
561
575
  },
562
576
  op1: function (root) {
563
- root._properties.Uint32Map.remove('entry1');
564
- root._properties.Uint32Map.insert('entry1', 2);
577
+ root._properties.Uint32Map.remove("entry1");
578
+ root._properties.Uint32Map.insert("entry1", 2);
565
579
  },
566
580
  op2: function (root) {
567
- root._properties.Uint32Map.set('entry1', 3);
581
+ root._properties.Uint32Map.set("entry1", 3);
568
582
  },
569
583
  compareToSequential: true,
570
584
  checkResult: function (conflicts, changeSet) {
571
585
  expect(conflicts).to.have.length(1);
572
586
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
573
- expect(conflicts[0].path).to.be.equal('Uint32Map[entry1]');
587
+ expect(conflicts[0].path).to.be.equal("Uint32Map[entry1]");
574
588
  },
575
589
  });
576
590
  });
577
- it('with conflicting inserts should report conflict', function () {
591
+ it("with conflicting inserts should report conflict", function () {
578
592
  testRebasing({
579
- prepare: function (root) {
580
- },
593
+ prepare: function (root) { },
581
594
  op1: function (root) {
582
- root._properties.Uint32Map.insert('entry1', 1);
595
+ root._properties.Uint32Map.insert("entry1", 1);
583
596
  },
584
597
  op2: function (root) {
585
- root._properties.Uint32Map.insert('entry1', 2);
598
+ root._properties.Uint32Map.insert("entry1", 2);
586
599
  },
587
600
  compareToSequential: false,
588
601
  checkResult: function (conflicts, changeSet) {
589
- expect(changeSet['map<Uint32>'].Uint32Map).to.have.all.keys('modify');
602
+ expect(changeSet["map<Uint32>"].Uint32Map).to.have.all.keys("modify");
590
603
  expect(conflicts).to.have.length(1);
591
604
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
592
- expect(conflicts[0].path).to.be.equal('Uint32Map[entry1]');
605
+ expect(conflicts[0].path).to.be.equal("Uint32Map[entry1]");
593
606
  },
594
607
  });
595
608
  });