@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
@@ -5,29 +5,27 @@
5
5
  /**
6
6
  * @fileoverview In this file, we will test the string property object described in /src/properties/stringProperty.js
7
7
  */
8
- const { ChangeSet } = require('@fluid-experimental/property-changeset');
9
- const { MSG } = require('@fluid-experimental/property-common').constants;
10
- const _ = require('lodash');
11
- const { PropertyFactory } = require('../..');
12
- const { BaseProperty } = require('../..');
8
+ const { ChangeSet } = require("@fluid-experimental/property-changeset");
9
+ const { MSG } = require("@fluid-experimental/property-common").constants;
10
+ const _ = require("lodash");
11
+ const { PropertyFactory } = require("../..");
12
+ const { BaseProperty } = require("../..");
13
13
  const deepCopy = _.cloneDeep;
14
- describe('StringProperty', function () {
14
+ describe("StringProperty", function () {
15
15
  var changeSetWithEntries, removalChangeSet;
16
16
  var myStringProp;
17
17
  before(function () {
18
18
  // Register a template with a set property for the tests
19
19
  var SimpleStringTestPropertyTemplate = {
20
- typeid: 'autodesk.tests:SimpleStringTestProperty-1.0.0',
21
- properties: [
22
- { id: 'stringProperty', typeid: 'String' },
23
- ],
20
+ typeid: "autodesk.tests:SimpleStringTestProperty-1.0.0",
21
+ properties: [{ id: "stringProperty", typeid: "String" }],
24
22
  };
25
23
  PropertyFactory._reregister(SimpleStringTestPropertyTemplate);
26
- myStringProp = PropertyFactory.create('String');
24
+ myStringProp = PropertyFactory.create("String");
27
25
  });
28
26
  // Inserts a char into the string
29
27
  var insertText = function (stringProp) {
30
- stringProp.insertRange(0, 'x');
28
+ stringProp.insertRange(0, "x");
31
29
  };
32
30
  // Removes the first char from the string
33
31
  var removeText = function (stringProp) {
@@ -35,46 +33,44 @@ describe('StringProperty', function () {
35
33
  };
36
34
  // Modifies the text
37
35
  var modifyText = function (stringProp) {
38
- stringProp.setRange(0, 'y');
36
+ stringProp.setRange(0, "y");
39
37
  };
40
38
  // set the text to a given string
41
39
  var setText = function (stringProp) {
42
- stringProp.value = 's';
40
+ stringProp.value = "s";
43
41
  };
44
- describe('Testing creation, assignment and serialization', function () {
45
- it('should be empty at the beginning', function () {
46
- expect(myStringProp.value).to.equal('');
47
- expect(myStringProp.getValue()).to.equal('');
48
- expect(myStringProp.serialize({ 'dirtyOnly': true })).to.be.empty;
49
- expect(myStringProp.serialize({ 'dirtyOnly': false })).to.equal('');
50
- });
51
- it('should be possible to insert into the string', function () {
42
+ describe("Testing creation, assignment and serialization", function () {
43
+ it("should be empty at the beginning", function () {
44
+ expect(myStringProp.value).to.equal("");
45
+ expect(myStringProp.getValue()).to.equal("");
46
+ expect(myStringProp.serialize({ dirtyOnly: true })).to.be.empty;
47
+ expect(myStringProp.serialize({ dirtyOnly: false })).to.equal("");
48
+ });
49
+ it("should be possible to insert into the string", function () {
52
50
  // Text insertion
53
- myStringProp.insertRange(0, 'abef');
54
- expect(myStringProp.value).to.equal('abef');
55
- expect(myStringProp.getValue()).to.equal('abef');
56
- myStringProp.insertRange(2, 'cd');
57
- expect(myStringProp.value).to.equal('abcdef');
58
- expect(myStringProp.getValue()).to.equal('abcdef');
59
- changeSetWithEntries = myStringProp.serialize({ 'dirtyOnly': true });
60
- expect(myStringProp.serialize({ 'dirtyOnly': false })).to.equal('abcdef');
61
- var CS = myStringProp.serialize({ 'dirtyOnly': true });
62
- expect(CS.insert &&
63
- CS.insert[0] &&
64
- CS.insert[0][1] === 'abcdef').to.be.ok;
65
- });
66
- it('Should handle removals correctly', function () {
51
+ myStringProp.insertRange(0, "abef");
52
+ expect(myStringProp.value).to.equal("abef");
53
+ expect(myStringProp.getValue()).to.equal("abef");
54
+ myStringProp.insertRange(2, "cd");
55
+ expect(myStringProp.value).to.equal("abcdef");
56
+ expect(myStringProp.getValue()).to.equal("abcdef");
57
+ changeSetWithEntries = myStringProp.serialize({ dirtyOnly: true });
58
+ expect(myStringProp.serialize({ dirtyOnly: false })).to.equal("abcdef");
59
+ var CS = myStringProp.serialize({ dirtyOnly: true });
60
+ expect(CS.insert && CS.insert[0] && CS.insert[0][1] === "abcdef").to.be.ok;
61
+ });
62
+ it("Should handle removals correctly", function () {
67
63
  myStringProp.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
68
64
  myStringProp.removeRange(3, 2);
69
- expect(myStringProp.value).to.equal('abcf');
70
- expect(myStringProp.getValue()).to.equal('abcf');
65
+ expect(myStringProp.value).to.equal("abcf");
66
+ expect(myStringProp.getValue()).to.equal("abcf");
71
67
  removalChangeSet = myStringProp._serialize(true, false, BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
72
- expect(removalChangeSet).to.have.all.keys(['remove']);
68
+ expect(removalChangeSet).to.have.all.keys(["remove"]);
73
69
  expect(removalChangeSet.remove).to.have.length(1);
74
70
  expect(removalChangeSet.remove[0]).to.deep.equal([3, 2]);
75
71
  });
76
- it('Should support deserialization', function () {
77
- var deserializedNode = PropertyFactory.create('String');
72
+ it("Should support deserialization", function () {
73
+ var deserializedNode = PropertyFactory.create("String");
78
74
  var deserializedChanges1 = deserializedNode.deserialize(changeSetWithEntries);
79
75
  expect(deserializedChanges1).to.deep.equal(changeSetWithEntries);
80
76
  var deserializedChanges2 = deserializedNode.deserialize(changeSetWithEntries);
@@ -82,74 +78,74 @@ describe('StringProperty', function () {
82
78
  var deserializedChanges3 = deserializedNode.deserialize({});
83
79
  expect(deserializedChanges3).to.deep.equal({ remove: [[0, 6]] });
84
80
  deserializedNode.deserialize(changeSetWithEntries); // refill
85
- var deserializedChanges4 = deserializedNode.deserialize('');
86
- expect(deserializedChanges4).to.deep.equal('');
81
+ var deserializedChanges4 = deserializedNode.deserialize("");
82
+ expect(deserializedChanges4).to.deep.equal("");
87
83
  });
88
- it('inserting at a bad position should throw an exception', function () {
84
+ it("inserting at a bad position should throw an exception", function () {
89
85
  expect(function () {
90
- myStringProp.insertRange(2242, 'x');
86
+ myStringProp.insertRange(2242, "x");
91
87
  }).to.throw();
92
88
  });
93
- it('insert after set should work', function () {
94
- var testString = PropertyFactory.create('String');
95
- testString.value = 'A';
96
- testString.insertRange(0, 'B');
97
- expect(testString.value).to.equal('BA');
98
- expect(testString.getValue()).to.equal('BA');
99
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('BA');
100
- });
101
- it('remove after set should work', function () {
102
- var testString = PropertyFactory.create('String');
103
- testString.value = 'ABCD';
89
+ it("insert after set should work", function () {
90
+ var testString = PropertyFactory.create("String");
91
+ testString.value = "A";
92
+ testString.insertRange(0, "B");
93
+ expect(testString.value).to.equal("BA");
94
+ expect(testString.getValue()).to.equal("BA");
95
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("BA");
96
+ });
97
+ it("remove after set should work", function () {
98
+ var testString = PropertyFactory.create("String");
99
+ testString.value = "ABCD";
104
100
  testString.removeRange(1, 2);
105
- expect(testString.value).to.equal('AD');
106
- expect(testString.getValue()).to.equal('AD');
107
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('AD');
108
- });
109
- it('modify after set should work', function () {
110
- var testString = PropertyFactory.create('String');
111
- testString.value = 'ABCD';
112
- testString.setRange(1, 'XY');
113
- expect(testString.value).to.equal('AXYD');
114
- expect(testString.getValue()).to.equal('AXYD');
115
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('AXYD');
116
- });
117
- it('set must stay a set', function () {
118
- var testString = PropertyFactory.create('String');
119
- testString.value = 'ABCD';
120
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('ABCD');
101
+ expect(testString.value).to.equal("AD");
102
+ expect(testString.getValue()).to.equal("AD");
103
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("AD");
104
+ });
105
+ it("modify after set should work", function () {
106
+ var testString = PropertyFactory.create("String");
107
+ testString.value = "ABCD";
108
+ testString.setRange(1, "XY");
109
+ expect(testString.value).to.equal("AXYD");
110
+ expect(testString.getValue()).to.equal("AXYD");
111
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("AXYD");
112
+ });
113
+ it("set must stay a set", function () {
114
+ var testString = PropertyFactory.create("String");
115
+ testString.value = "ABCD";
116
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("ABCD");
121
117
  testString.cleanDirty();
122
- testString.value = 'XY';
123
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('XY');
124
- testString.insertRange(2, 'Z');
125
- expect(testString.serialize({ 'dirtyOnly': true })).to.equal('XYZ');
126
- });
127
- it('.get should return a single letter', function () {
128
- var testString = PropertyFactory.create('String');
129
- testString.value = 'ABCD';
130
- expect(testString.get(2)).to.equal('C');
131
- });
132
- it('.getFullTypeid should return a string of the typeid', function () {
133
- var testString = PropertyFactory.create('String');
134
- expect(testString.getFullTypeid()).to.equal('String');
135
- });
136
- it('.insert should insert a string', function () {
137
- var testString = PropertyFactory.create('String');
138
- testString.setValue('AAAAA');
139
- testString.insert(1, 'BB');
140
- expect(testString.getValue()).to.equal('ABBAAAA');
141
- });
142
- it('.insertRange should insert a string', function () {
143
- var testString = PropertyFactory.create('String');
144
- testString.setValue('AAAAA');
145
- testString.insertRange(1, 'BB');
146
- expect(testString.getValue()).to.equal('ABBAAAA');
147
- });
148
- it('Should report dirtiness correctly when introducing a modification in certain order', function () {
149
- testString = PropertyFactory.create('String');
118
+ testString.value = "XY";
119
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("XY");
120
+ testString.insertRange(2, "Z");
121
+ expect(testString.serialize({ dirtyOnly: true })).to.equal("XYZ");
122
+ });
123
+ it(".get should return a single letter", function () {
124
+ var testString = PropertyFactory.create("String");
125
+ testString.value = "ABCD";
126
+ expect(testString.get(2)).to.equal("C");
127
+ });
128
+ it(".getFullTypeid should return a string of the typeid", function () {
129
+ var testString = PropertyFactory.create("String");
130
+ expect(testString.getFullTypeid()).to.equal("String");
131
+ });
132
+ it(".insert should insert a string", function () {
133
+ var testString = PropertyFactory.create("String");
134
+ testString.setValue("AAAAA");
135
+ testString.insert(1, "BB");
136
+ expect(testString.getValue()).to.equal("ABBAAAA");
137
+ });
138
+ it(".insertRange should insert a string", function () {
139
+ var testString = PropertyFactory.create("String");
140
+ testString.setValue("AAAAA");
141
+ testString.insertRange(1, "BB");
142
+ expect(testString.getValue()).to.equal("ABBAAAA");
143
+ });
144
+ it("Should report dirtiness correctly when introducing a modification in certain order", function () {
145
+ testString = PropertyFactory.create("String");
150
146
  let newValue = "test";
151
- const node = PropertyFactory.create('NodeProperty');
152
- node.insert('stringProp', testString);
147
+ const node = PropertyFactory.create("NodeProperty");
148
+ node.insert("stringProp", testString);
153
149
  // Ignore insert changeset
154
150
  node.cleanDirty();
155
151
  node.applyChangeSet(JSON.parse(`{"modify":{"String":{"stringProp":{"value":"${newValue}","oldValue": ""}}}}`));
@@ -161,159 +157,163 @@ describe('StringProperty', function () {
161
157
  node.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
162
158
  expect(Object.keys(node._serialize(true, false, 2))).to.have.length(1);
163
159
  });
164
- it('.insertRange should also accept an array with a single string', function () {
165
- var testString = PropertyFactory.create('String');
166
- testString.setValue('AAAAA');
167
- testString.insertRange(1, ['BC']);
168
- expect(testString.getValue()).to.equal('ABCAAAA');
169
- });
170
- it('.insertRange should join an array with more than one string', function () {
171
- var testString = PropertyFactory.create('String');
172
- testString.setValue('AAAAA');
173
- testString.insertRange(1, ['B', 'C', 'D']);
174
- expect(testString.getValue()).to.equal('ABCDAAAA');
175
- });
176
- it('.push should add a string to the end of the original string and return the length of the string', function () {
177
- var testString = PropertyFactory.create('String');
178
- testString.setValue('AAAAA');
179
- testString.push('BB');
180
- expect(testString.getValue()).to.equal('AAAAABB');
181
- expect(testString.push('CC')).to.equal(9);
160
+ it(".insertRange should also accept an array with a single string", function () {
161
+ var testString = PropertyFactory.create("String");
162
+ testString.setValue("AAAAA");
163
+ testString.insertRange(1, ["BC"]);
164
+ expect(testString.getValue()).to.equal("ABCAAAA");
165
+ });
166
+ it(".insertRange should join an array with more than one string", function () {
167
+ var testString = PropertyFactory.create("String");
168
+ testString.setValue("AAAAA");
169
+ testString.insertRange(1, ["B", "C", "D"]);
170
+ expect(testString.getValue()).to.equal("ABCDAAAA");
171
+ });
172
+ it(".push should add a string to the end of the original string and return the length of the string", function () {
173
+ var testString = PropertyFactory.create("String");
174
+ testString.setValue("AAAAA");
175
+ testString.push("BB");
176
+ expect(testString.getValue()).to.equal("AAAAABB");
177
+ expect(testString.push("CC")).to.equal(9);
182
178
  });
183
179
  });
184
- describe('inherited API methods', function () {
185
- it('.clear should remove all values from the string', function () {
186
- var testString = PropertyFactory.create('String');
187
- testString.setValue('AAAAA');
188
- expect(testString.getValue()).to.equal('AAAAA');
180
+ describe("inherited API methods", function () {
181
+ it(".clear should remove all values from the string", function () {
182
+ var testString = PropertyFactory.create("String");
183
+ testString.setValue("AAAAA");
184
+ expect(testString.getValue()).to.equal("AAAAA");
189
185
  testString.clear();
190
- expect(testString.getValue()).to.equal('');
186
+ expect(testString.getValue()).to.equal("");
191
187
  });
192
- it('.getEntriesReadOnly should return a string', function () {
193
- var testString = PropertyFactory.create('String');
194
- testString.setValue('AAAAA');
195
- expect(testString.getEntriesReadOnly()).to.equal('AAAAA');
188
+ it(".getEntriesReadOnly should return a string", function () {
189
+ var testString = PropertyFactory.create("String");
190
+ testString.setValue("AAAAA");
191
+ expect(testString.getEntriesReadOnly()).to.equal("AAAAA");
196
192
  });
197
- it('.getIds should return an array of string ids', function () {
198
- var testString = PropertyFactory.create('String');
199
- testString.setValue('AAAAA');
200
- expect(testString.getIds()).to.deep.equal(['0', '1', '2', '3', '4']);
193
+ it(".getIds should return an array of string ids", function () {
194
+ var testString = PropertyFactory.create("String");
195
+ testString.setValue("AAAAA");
196
+ expect(testString.getIds()).to.deep.equal(["0", "1", "2", "3", "4"]);
201
197
  });
202
- it('.getLength should return the length of the string', function () {
203
- var testString = PropertyFactory.create('String');
198
+ it(".getLength should return the length of the string", function () {
199
+ var testString = PropertyFactory.create("String");
204
200
  expect(testString.getLength()).to.equal(0);
205
- testString.setValue('AAAAA');
201
+ testString.setValue("AAAAA");
206
202
  expect(testString.getLength()).to.equal(5);
207
203
  });
208
- it('.pop should remove the last letter', function () {
209
- var testString = PropertyFactory.create('String');
210
- testString.setValue('ABCDE');
204
+ it(".pop should remove the last letter", function () {
205
+ var testString = PropertyFactory.create("String");
206
+ testString.setValue("ABCDE");
211
207
  testString.pop();
212
- expect(testString.getValue()).to.equal('ABCD');
208
+ expect(testString.getValue()).to.equal("ABCD");
213
209
  });
214
- it('.remove should remove a single letter', function () {
215
- var testString = PropertyFactory.create('String');
216
- testString.setValue('ABCDE');
210
+ it(".remove should remove a single letter", function () {
211
+ var testString = PropertyFactory.create("String");
212
+ testString.setValue("ABCDE");
217
213
  testString.remove(2);
218
- expect(testString.getValue()).to.equal('ABDE');
219
- expect(testString.remove(1)).to.equal('B');
214
+ expect(testString.getValue()).to.equal("ABDE");
215
+ expect(testString.remove(1)).to.equal("B");
220
216
  });
221
- it('removeRange should remove a range of letters', function () {
222
- var testString = PropertyFactory.create('String');
223
- testString.setValue('ABCDEFG');
217
+ it("removeRange should remove a range of letters", function () {
218
+ var testString = PropertyFactory.create("String");
219
+ testString.setValue("ABCDEFG");
224
220
  testString.removeRange(1, 2);
225
- expect(testString.getValue()).to.equal('ADEFG');
226
- expect(testString.removeRange(2, 3)).to.equal('EFG');
221
+ expect(testString.getValue()).to.equal("ADEFG");
222
+ expect(testString.removeRange(2, 3)).to.equal("EFG");
227
223
  });
228
224
  it('@regression removeRange should clear a value longer than the special value "setAsLiteral"', function () {
229
- var testString = PropertyFactory.create('String');
230
- testString.setValue('AAAAAAAAAAAAAAAAAA');
225
+ var testString = PropertyFactory.create("String");
226
+ testString.setValue("AAAAAAAAAAAAAAAAAA");
231
227
  testString.removeRange(0, testString.getValue().length);
232
- expect(testString.getValue()).to.equal('');
233
- });
234
- it('set should set a single character', function () {
235
- var testString = PropertyFactory.create('String');
236
- testString.setValue('ABCDEFG');
237
- testString.set(3, 'x');
238
- expect(testString.getValue()).to.equal('ABCxEFG');
239
- });
240
- it('set should not allow setting more than one character', function () {
241
- var testString = PropertyFactory.create('String');
242
- testString.setValue('ABCDEFG');
243
- expect(function () { testString.set(0, 'ab'); }).to.throw(MSG.STRING_SET_ONE_CHAR);
244
- });
245
- it('set should throw if in_offset is not an integer', function () {
246
- var testString = PropertyFactory.create('String');
247
- testString.setValue('ABCDEFG');
248
- expect(function () { testString.set('test', 'a'); }).to.throw(MSG.STRING_SET_NEEDS_INDEX);
249
- });
250
- it('setRange should replace a range of letters', function () {
251
- var testString = PropertyFactory.create('String');
252
- testString.setValue('ABCDEFG');
253
- testString.setRange(3, 'xx');
254
- expect(testString.getValue()).to.equal('ABCxxFG');
255
- });
256
- it('setRange should throw if trying to set out of range', function () {
257
- var testString = PropertyFactory.create('String');
258
- testString.setValue('ABCDEFG');
228
+ expect(testString.getValue()).to.equal("");
229
+ });
230
+ it("set should set a single character", function () {
231
+ var testString = PropertyFactory.create("String");
232
+ testString.setValue("ABCDEFG");
233
+ testString.set(3, "x");
234
+ expect(testString.getValue()).to.equal("ABCxEFG");
235
+ });
236
+ it("set should not allow setting more than one character", function () {
237
+ var testString = PropertyFactory.create("String");
238
+ testString.setValue("ABCDEFG");
239
+ expect(function () {
240
+ testString.set(0, "ab");
241
+ }).to.throw(MSG.STRING_SET_ONE_CHAR);
242
+ });
243
+ it("set should throw if in_offset is not an integer", function () {
244
+ var testString = PropertyFactory.create("String");
245
+ testString.setValue("ABCDEFG");
246
+ expect(function () {
247
+ testString.set("test", "a");
248
+ }).to.throw(MSG.STRING_SET_NEEDS_INDEX);
249
+ });
250
+ it("setRange should replace a range of letters", function () {
251
+ var testString = PropertyFactory.create("String");
252
+ testString.setValue("ABCDEFG");
253
+ testString.setRange(3, "xx");
254
+ expect(testString.getValue()).to.equal("ABCxxFG");
255
+ });
256
+ it("setRange should throw if trying to set out of range", function () {
257
+ var testString = PropertyFactory.create("String");
258
+ testString.setValue("ABCDEFG");
259
259
  var fn = function () {
260
- testString.setRange(5, 'xxxxxx');
260
+ testString.setRange(5, "xxxxxx");
261
261
  };
262
262
  expect(fn).to.throw();
263
263
  });
264
- it('setRange should throw if in_offset is not an integer', function () {
265
- var testString = PropertyFactory.create('String');
266
- testString.setValue('ABCDEFG');
264
+ it("setRange should throw if in_offset is not an integer", function () {
265
+ var testString = PropertyFactory.create("String");
266
+ testString.setValue("ABCDEFG");
267
267
  var fn = function () {
268
- testString.setRange('test', 'xx');
268
+ testString.setRange("test", "xx");
269
269
  };
270
270
  expect(fn).to.throw(MSG.NOT_NUMBER);
271
271
  });
272
- it('shift should remove a single letter at the beginning of the string', function () {
273
- var testString = PropertyFactory.create('String');
274
- testString.setValue('ABCDEFG');
272
+ it("shift should remove a single letter at the beginning of the string", function () {
273
+ var testString = PropertyFactory.create("String");
274
+ testString.setValue("ABCDEFG");
275
275
  testString.shift();
276
- expect(testString.getValue()).to.equal('BCDEFG');
277
- expect(testString.shift()).to.equal('B');
276
+ expect(testString.getValue()).to.equal("BCDEFG");
277
+ expect(testString.shift()).to.equal("B");
278
278
  });
279
- it('unshift should add letters at the beginning of a string and return the length of the string', function () {
280
- var testString = PropertyFactory.create('String');
281
- testString.setValue('ABC');
282
- testString.unshift('DE');
283
- expect(testString.getValue()).to.equal('DEABC');
284
- expect(testString.unshift('FGH')).to.equal(8);
279
+ it("unshift should add letters at the beginning of a string and return the length of the string", function () {
280
+ var testString = PropertyFactory.create("String");
281
+ testString.setValue("ABC");
282
+ testString.unshift("DE");
283
+ expect(testString.getValue()).to.equal("DEABC");
284
+ expect(testString.unshift("FGH")).to.equal(8);
285
285
  });
286
286
  });
287
- describe('change set specification should be met', function () {
288
- it('Should handle inserts correctly', function () {
289
- var t = PropertyFactory.create('String');
290
- t.value = 'test';
287
+ describe("change set specification should be met", function () {
288
+ it("Should handle inserts correctly", function () {
289
+ var t = PropertyFactory.create("String");
290
+ t.value = "test";
291
291
  t.cleanDirty();
292
- t.insert(2, '_test_');
293
- expect(t.serialize({ 'dirtyOnly': true })).to.deep.equal({
294
- 'insert': [[2, '_test_']],
292
+ t.insert(2, "_test_");
293
+ expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
294
+ insert: [[2, "_test_"]],
295
295
  });
296
296
  });
297
- it('Should handle push correctly', function () {
298
- var t = PropertyFactory.create('String');
299
- t.value = 'test';
297
+ it("Should handle push correctly", function () {
298
+ var t = PropertyFactory.create("String");
299
+ t.value = "test";
300
300
  t.cleanDirty();
301
- t.push('_test_');
302
- expect(t.serialize({ 'dirtyOnly': true })).to.deep.equal({
303
- 'insert': [[4, '_test_']],
301
+ t.push("_test_");
302
+ expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
303
+ insert: [[4, "_test_"]],
304
304
  });
305
305
  });
306
- it('Should handle modifies correctly', function () {
307
- var t = PropertyFactory.create('String');
308
- t.value = 'test';
306
+ it("Should handle modifies correctly", function () {
307
+ var t = PropertyFactory.create("String");
308
+ t.value = "test";
309
309
  t.cleanDirty();
310
- t.setRange(1, '_x_');
311
- expect(t.serialize({ 'dirtyOnly': true })).to.deep.equal({
312
- 'modify': [[1, '_x_']],
310
+ t.setRange(1, "_x_");
311
+ expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
312
+ modify: [[1, "_x_"]],
313
313
  });
314
314
  });
315
315
  });
316
- describe('squashing', function () {
316
+ describe("squashing", function () {
317
317
  // Helper function to test the squashing for different containers
318
318
  var innerTestChangeSetSquashing = function (io_testProperty, io_stringProperty, io_initialChangeset, in_options, in_collection) {
319
319
  var squashedChangeset = new ChangeSet();
@@ -322,7 +322,7 @@ describe('StringProperty', function () {
322
322
  var callbacks = in_options.callbacks;
323
323
  for (var i = 0; i < callbacks.length; i++) {
324
324
  callbacks[i](io_stringProperty);
325
- var changes = io_testProperty.serialize({ 'dirtyOnly': true });
325
+ var changes = io_testProperty.serialize({ dirtyOnly: true });
326
326
  io_testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
327
327
  BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
328
328
  squashedChangeset.applyChangeSet(changes);
@@ -345,13 +345,13 @@ describe('StringProperty', function () {
345
345
  // be given as first parameter
346
346
  //
347
347
  var testChangeSetSquashing = function (in_options) {
348
- var testProperty = PropertyFactory.create('autodesk.tests:SimpleStringTestProperty-1.0.0');
349
- var nodeTestProperty = PropertyFactory.create('NodeProperty');
350
- var stringInNodeProperty = PropertyFactory.create('String');
351
- nodeTestProperty.insert('stringProperty', stringInNodeProperty);
352
- var mapTestProperty = PropertyFactory.create('map<>');
353
- var stringInMapProperty = PropertyFactory.create('String');
354
- mapTestProperty.insert('stringProperty', stringInMapProperty);
348
+ var testProperty = PropertyFactory.create("autodesk.tests:SimpleStringTestProperty-1.0.0");
349
+ var nodeTestProperty = PropertyFactory.create("NodeProperty");
350
+ var stringInNodeProperty = PropertyFactory.create("String");
351
+ nodeTestProperty.insert("stringProperty", stringInNodeProperty);
352
+ var mapTestProperty = PropertyFactory.create("map<>");
353
+ var stringInMapProperty = PropertyFactory.create("String");
354
+ mapTestProperty.insert("stringProperty", stringInMapProperty);
355
355
  if (in_options.pre) {
356
356
  in_options.pre(testProperty._properties.stringProperty);
357
357
  in_options.pre(stringInNodeProperty);
@@ -368,7 +368,7 @@ describe('StringProperty', function () {
368
368
  innerTestChangeSetSquashing(mapTestProperty, stringInMapProperty, initialChangesetMap, in_options, true);
369
369
  if (!initialChangeset.getSerializedChangeSet().String) {
370
370
  // empty changeset
371
- expect(testProperty.serialize().String.stringProperty).to.equal('');
371
+ expect(testProperty.serialize().String.stringProperty).to.equal("");
372
372
  }
373
373
  else {
374
374
  // according to the spec, the String changeset can either be a string or (insert|modify|remove) style
@@ -380,36 +380,33 @@ describe('StringProperty', function () {
380
380
  }
381
381
  if (!initialChangesetNode.getSerializedChangeSet().insert) {
382
382
  // empty changeset
383
- expect(nodeTestProperty.serialize().insert.String.stringProperty).to.equal('');
383
+ expect(nodeTestProperty.serialize().insert.String.stringProperty).to.equal("");
384
384
  }
385
385
  else {
386
386
  // according to the spec, the String changeset can either be a string or (insert|modify|remove) style
387
- var nodeInitialChangesetString = initialChangesetNode.getSerializedChangeSet()
388
- .insert.String.stringProperty;
387
+ var nodeInitialChangesetString = initialChangesetNode.getSerializedChangeSet().insert.String.stringProperty;
389
388
  if (!_.isString(nodeInitialChangesetString)) {
390
389
  nodeInitialChangesetString = nodeInitialChangesetString.insert[0][1];
391
390
  }
392
- expect(nodeInitialChangesetString).to.deep.equal(nodeTestProperty.serialize()
393
- .insert.String.stringProperty);
391
+ expect(nodeInitialChangesetString).to.deep.equal(nodeTestProperty.serialize().insert.String.stringProperty);
394
392
  }
395
393
  if (!initialChangesetMap.getSerializedChangeSet().insert) {
396
394
  // empty changeset
397
- expect(mapTestProperty.serialize().insert.String.stringProperty).to.equal('');
395
+ expect(mapTestProperty.serialize().insert.String.stringProperty).to.equal("");
398
396
  }
399
397
  else {
400
398
  // according to the spec, the String changeset can either be a string or (insert|modify|remove) style
401
- var mapInitialChangesetString = initialChangesetMap.getSerializedChangeSet()
402
- .insert.String.stringProperty;
399
+ var mapInitialChangesetString = initialChangesetMap.getSerializedChangeSet().insert.String.stringProperty;
403
400
  if (!_.isString(mapInitialChangesetString)) {
404
401
  mapInitialChangesetString = mapInitialChangesetString.insert[0][1];
405
402
  }
406
403
  expect(mapInitialChangesetString).to.deep.equal(mapTestProperty.serialize().insert.String.stringProperty);
407
404
  }
408
405
  };
409
- it('should work for multiple independent inserts', function () {
406
+ it("should work for multiple independent inserts", function () {
410
407
  testChangeSetSquashing({ callbacks: [insertText, insertText, insertText] });
411
408
  });
412
- it('should work for inserts followed by removes', function () {
409
+ it("should work for inserts followed by removes", function () {
413
410
  testChangeSetSquashing({
414
411
  callbacks: [insertText, insertText, removeText, removeText],
415
412
  post: function (changeset) {
@@ -417,12 +414,12 @@ describe('StringProperty', function () {
417
414
  },
418
415
  });
419
416
  });
420
- it('should work for mixed modifies and inserts', function () {
417
+ it("should work for mixed modifies and inserts", function () {
421
418
  testChangeSetSquashing({
422
419
  callbacks: [insertText, modifyText, insertText, modifyText],
423
420
  });
424
421
  });
425
- it('an insert, modify and a remove should give an empty changeset', function () {
422
+ it("an insert, modify and a remove should give an empty changeset", function () {
426
423
  testChangeSetSquashing({
427
424
  callbacks: [insertText, modifyText, removeText],
428
425
  post: function (changeset) {
@@ -430,84 +427,84 @@ describe('StringProperty', function () {
430
427
  },
431
428
  });
432
429
  });
433
- it('work for modifies after an already existing insert', function () {
430
+ it("work for modifies after an already existing insert", function () {
434
431
  testChangeSetSquashing({
435
432
  pre: insertText,
436
433
  callbacks: [modifyText, modifyText],
437
434
  });
438
435
  });
439
- it('of modify and remove after an already existing insert should work', function () {
436
+ it("of modify and remove after an already existing insert should work", function () {
440
437
  testChangeSetSquashing({
441
438
  pre: insertText,
442
439
  callbacks: [modifyText, removeText],
443
440
  post: function (changeset) {
444
- expect(changeset.String.stringProperty).to.have.all.keys('remove');
441
+ expect(changeset.String.stringProperty).to.have.all.keys("remove");
445
442
  },
446
443
  });
447
444
  });
448
- it('modify after set should work', function () {
445
+ it("modify after set should work", function () {
449
446
  testChangeSetSquashing({
450
447
  callbacks: [setText, modifyText],
451
448
  post: function (changeset) {
452
- expect(changeset.String.stringProperty).to.equal('y');
449
+ expect(changeset.String.stringProperty).to.equal("y");
453
450
  },
454
451
  });
455
452
  });
456
- it('set after pre-insert and insert should work', function () {
453
+ it("set after pre-insert and insert should work", function () {
457
454
  testChangeSetSquashing({
458
455
  pre: insertText,
459
456
  callbacks: [insertText, modifyText, setText],
460
457
  post: function (changeset) {
461
- expect(changeset.String.stringProperty).to.equal('s');
458
+ expect(changeset.String.stringProperty).to.equal("s");
462
459
  },
463
460
  });
464
461
  });
465
- it('insert after set should work', function () {
462
+ it("insert after set should work", function () {
466
463
  testChangeSetSquashing({
467
464
  callbacks: [setText, insertText],
468
465
  post: function (changeset) {
469
- expect(changeset.String.stringProperty).to.equal('xs');
466
+ expect(changeset.String.stringProperty).to.equal("xs");
470
467
  },
471
468
  });
472
469
  });
473
- it('insert, set, insert/modify should work', function () {
470
+ it("insert, set, insert/modify should work", function () {
474
471
  testChangeSetSquashing({
475
472
  callbacks: [insertText, setText, insertText, modifyText],
476
473
  post: function (changeset) {
477
- expect(changeset.String.stringProperty).to.equal('ys');
474
+ expect(changeset.String.stringProperty).to.equal("ys");
478
475
  },
479
476
  });
480
477
  });
481
- it('insert, set, insert/modify, set should work', function () {
478
+ it("insert, set, insert/modify, set should work", function () {
482
479
  testChangeSetSquashing({
483
480
  callbacks: [insertText, setText, insertText, modifyText, setText],
484
481
  post: function (changeset) {
485
- expect(changeset.String.stringProperty).to.equal('s');
482
+ expect(changeset.String.stringProperty).to.equal("s");
486
483
  },
487
484
  });
488
485
  });
489
486
  });
490
- describe('Rebasing', function () {
487
+ describe("Rebasing", function () {
491
488
  var createPropertyForRebaseTestByTemplate = function () {
492
- return PropertyFactory.create('autodesk.tests:SimpleStringTestProperty-1.0.0');
489
+ return PropertyFactory.create("autodesk.tests:SimpleStringTestProperty-1.0.0");
493
490
  };
494
491
  var createNodePropertyForRebase = function () {
495
- var nodeTestProperty = PropertyFactory.create('NodeProperty');
496
- var stringInNodeProperty = PropertyFactory.create('String');
497
- nodeTestProperty.insert('stringProperty', stringInNodeProperty);
492
+ var nodeTestProperty = PropertyFactory.create("NodeProperty");
493
+ var stringInNodeProperty = PropertyFactory.create("String");
494
+ nodeTestProperty.insert("stringProperty", stringInNodeProperty);
498
495
  return nodeTestProperty;
499
496
  };
500
497
  var createMapPropertyForRebase = function () {
501
- var mapTestProperty = PropertyFactory.create('map<>');
502
- var stringInNodeProperty = PropertyFactory.create('String');
503
- mapTestProperty.insert('stringProperty', stringInNodeProperty);
498
+ var mapTestProperty = PropertyFactory.create("map<>");
499
+ var stringInNodeProperty = PropertyFactory.create("String");
500
+ mapTestProperty.insert("stringProperty", stringInNodeProperty);
504
501
  return mapTestProperty;
505
502
  };
506
503
  var getStringPropertyFromNode = function (in_testProperty) {
507
504
  return in_testProperty._properties.stringProperty;
508
505
  };
509
506
  var getStringPropertyFromMap = function (in_testProperty) {
510
- return in_testProperty.get('stringProperty');
507
+ return in_testProperty.get("stringProperty");
511
508
  };
512
509
  var testRebasingInner = function (in_creator, in_getInnerProperty, in_options, in_isCollection) {
513
510
  // Prepare the initial state
@@ -562,7 +559,7 @@ describe('StringProperty', function () {
562
559
  }
563
560
  if (!combinedSerialized.String) {
564
561
  // empty changeset
565
- expect(finalChangeSet.String.stringProperty).to.equal('');
562
+ expect(finalChangeSet.String.stringProperty).to.equal("");
566
563
  }
567
564
  else {
568
565
  // according to the spec, the String changeset can either be a string or (insert|modify|remove) style
@@ -589,20 +586,20 @@ describe('StringProperty', function () {
589
586
  testRebasingInner(createNodePropertyForRebase, getStringPropertyFromNode, in_options, true);
590
587
  testRebasingInner(createMapPropertyForRebase, getStringPropertyFromMap, in_options, true);
591
588
  };
592
- it('with a NOP should be possible', function () {
589
+ it("with a NOP should be possible", function () {
593
590
  testRebasing({
594
591
  op2: insertText,
595
592
  compareToSequential: true,
596
593
  });
597
594
  });
598
- it('with independent inserts should be possible', function () {
595
+ it("with independent inserts should be possible", function () {
599
596
  testRebasing({
600
597
  op1: insertText,
601
598
  op2: insertText,
602
599
  compareToSequential: true,
603
600
  });
604
601
  });
605
- it('with independent removes should be possible', function () {
602
+ it("with independent removes should be possible", function () {
606
603
  testRebasing({
607
604
  prepare: function (root) {
608
605
  insertText(root);
@@ -617,7 +614,7 @@ describe('StringProperty', function () {
617
614
  compareToSequential: true,
618
615
  });
619
616
  });
620
- it('with a modify and a remove should possible', function () {
617
+ it("with a modify and a remove should possible", function () {
621
618
  testRebasing({
622
619
  prepare: insertText,
623
620
  op1: modifyText,
@@ -625,7 +622,7 @@ describe('StringProperty', function () {
625
622
  compareToSequential: true,
626
623
  });
627
624
  });
628
- it('with a remove and a modify should possible', function () {
625
+ it("with a remove and a modify should possible", function () {
629
626
  testRebasing({
630
627
  prepare: insertText,
631
628
  op1: removeText,
@@ -634,11 +631,11 @@ describe('StringProperty', function () {
634
631
  checkResult: function (conflicts, changeSet) {
635
632
  expect(conflicts).to.have.length(1);
636
633
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
637
- expect(conflicts[0].path).to.be.equal('stringProperty');
634
+ expect(conflicts[0].path).to.be.equal("stringProperty");
638
635
  },
639
636
  });
640
637
  });
641
- it('with two compatible removes should be possible', function () {
638
+ it("with two compatible removes should be possible", function () {
642
639
  testRebasing({
643
640
  prepare: insertText,
644
641
  op1: removeText,
@@ -649,14 +646,14 @@ describe('StringProperty', function () {
649
646
  },
650
647
  });
651
648
  });
652
- it('with two independent modifies should be possible', function () {
649
+ it("with two independent modifies should be possible", function () {
653
650
  testRebasing({
654
651
  prepare: function (root) {
655
- root.insertRange(0, 'ab');
652
+ root.insertRange(0, "ab");
656
653
  },
657
654
  op1: modifyText,
658
655
  op2: function (root) {
659
- root.setRange(1, 'z');
656
+ root.setRange(1, "z");
660
657
  },
661
658
  compareToSequential: true,
662
659
  checkResult: function (conflicts, changeSet) {
@@ -665,23 +662,23 @@ describe('StringProperty', function () {
665
662
  });
666
663
  });
667
664
  // TODO: test with the same value
668
- it('with two conflicting modifies should be possible and report a conflict', function () {
665
+ it("with two conflicting modifies should be possible and report a conflict", function () {
669
666
  testRebasing({
670
667
  prepare: insertText,
671
668
  op1: function (stringProp) {
672
- stringProp.setRange(0, 'j');
669
+ stringProp.setRange(0, "j");
673
670
  },
674
671
  op2: modifyText,
675
672
  compareToSequential: true,
676
673
  checkResult: function (conflicts, changeSet) {
677
674
  expect(conflicts).to.have.length(1);
678
- expect(changeSet.String.stringProperty.modify[0][1]).to.equal('y');
675
+ expect(changeSet.String.stringProperty.modify[0][1]).to.equal("y");
679
676
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
680
- expect(conflicts[0].path).to.be.equal('stringProperty');
677
+ expect(conflicts[0].path).to.be.equal("stringProperty");
681
678
  },
682
679
  });
683
680
  });
684
- it('with modify followed by remove+insert should work', function () {
681
+ it("with modify followed by remove+insert should work", function () {
685
682
  testRebasing({
686
683
  prepare: insertText,
687
684
  op1: modifyText,
@@ -693,12 +690,12 @@ describe('StringProperty', function () {
693
690
  checkResult: function (conflicts, changeSet) {
694
691
  expect(conflicts).to.have.length(1);
695
692
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.REMOVE_AFTER_MODIFY);
696
- expect(conflicts[0].path).to.be.equal('stringProperty');
697
- expect(changeSet.String.stringProperty).to.have.all.keys('remove', 'insert');
693
+ expect(conflicts[0].path).to.be.equal("stringProperty");
694
+ expect(changeSet.String.stringProperty).to.have.all.keys("remove", "insert");
698
695
  },
699
696
  });
700
697
  });
701
- it('with remove + insert followed by modify should report conflict', function () {
698
+ it("with remove + insert followed by modify should report conflict", function () {
702
699
  testRebasing({
703
700
  prepare: insertText,
704
701
  op1: function (root) {
@@ -710,11 +707,11 @@ describe('StringProperty', function () {
710
707
  checkResult: function (conflicts, changeSet) {
711
708
  expect(conflicts).to.have.length(1);
712
709
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
713
- expect(conflicts[0].path).to.be.equal('stringProperty');
710
+ expect(conflicts[0].path).to.be.equal("stringProperty");
714
711
  },
715
712
  });
716
713
  });
717
- it('with conflicting inserts should report conflict', function () {
714
+ it("with conflicting inserts should report conflict", function () {
718
715
  testRebasing({
719
716
  prepare: insertText,
720
717
  op1: insertText,
@@ -723,51 +720,55 @@ describe('StringProperty', function () {
723
720
  checkResult: function (conflicts, changeSet) {
724
721
  expect(conflicts).to.have.length(1);
725
722
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.INSERTED_ENTRY_WITH_SAME_KEY);
726
- expect(conflicts[0].path).to.be.equal('stringProperty');
723
+ expect(conflicts[0].path).to.be.equal("stringProperty");
727
724
  },
728
725
  });
729
726
  });
730
- it('with conflicting remove and insert should keep the insert and move it to the correct position', function () {
727
+ it("with conflicting remove and insert should keep the insert and move it to the correct position", function () {
731
728
  testRebasing({
732
729
  prepare: function (p) {
733
- p.insertRange(0, '0123456');
730
+ p.insertRange(0, "0123456");
734
731
  },
735
732
  op1: function (p) {
736
733
  p.removeRange(2, 5);
737
734
  },
738
735
  op2: function (p) {
739
- p.insertRange(5, 't');
736
+ p.insertRange(5, "t");
740
737
  },
741
738
  compareToSequential: false,
742
739
  checkResult: function (conflicts, changeSet) {
743
740
  expect(conflicts).to.have.length(0);
744
741
  expect(changeSet).to.deep.equal({
745
- 'String': { stringProperty: { insert: [[2, 't']] } },
742
+ String: { stringProperty: { insert: [[2, "t"]] } },
746
743
  });
747
744
  },
748
745
  });
749
746
  });
750
- it('with touching remove and insert should not report conflict and keep them', function () {
747
+ it("with touching remove and insert should not report conflict and keep them", function () {
751
748
  testRebasing({
752
749
  prepare: function (p) {
753
- p.insertRange(0, '0123456');
750
+ p.insertRange(0, "0123456");
754
751
  },
755
752
  op1: function (p) {
756
753
  p.removeRange(2, 3);
757
754
  },
758
755
  op2: function (p) {
759
- p.insertRange(5, 'b');
760
- p.insertRange(2, 'a');
756
+ p.insertRange(5, "b");
757
+ p.insertRange(2, "a");
761
758
  },
762
759
  compareToSequential: false,
763
760
  checkResult: function (conflicts, rebasedCS2, combinedChangeSet) {
764
761
  expect(conflicts).to.have.length(0);
765
- expect(rebasedCS2).to.deep.equal({ 'String': { stringProperty: { insert: [[2, 'ab']] } } });
766
- expect(combinedChangeSet).to.deep.equal({ 'String': { 'stringProperty': '01ab56' } });
762
+ expect(rebasedCS2).to.deep.equal({
763
+ String: { stringProperty: { insert: [[2, "ab"]] } },
764
+ });
765
+ expect(combinedChangeSet).to.deep.equal({
766
+ String: { stringProperty: "01ab56" },
767
+ });
767
768
  },
768
769
  });
769
770
  });
770
- it('with conflicting set and insert should report a conflict', function () {
771
+ it("with conflicting set and insert should report a conflict", function () {
771
772
  testRebasing({
772
773
  prepare: insertText,
773
774
  op1: setText,
@@ -776,12 +777,12 @@ describe('StringProperty', function () {
776
777
  checkResult: function (conflicts, changeSet) {
777
778
  expect(conflicts).to.have.length(1);
778
779
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
779
- expect(conflicts[0].path).to.be.equal('stringProperty');
780
- expect(changeSet.String.stringProperty).to.be.equal('s');
780
+ expect(conflicts[0].path).to.be.equal("stringProperty");
781
+ expect(changeSet.String.stringProperty).to.be.equal("s");
781
782
  },
782
783
  });
783
784
  });
784
- it('with conflicting insert and set should report a conflict', function () {
785
+ it("with conflicting insert and set should report a conflict", function () {
785
786
  testRebasing({
786
787
  prepare: insertText,
787
788
  op1: insertText,
@@ -790,56 +791,63 @@ describe('StringProperty', function () {
790
791
  checkResult: function (conflicts, changeSet) {
791
792
  expect(conflicts).to.have.length(1);
792
793
  expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
793
- expect(conflicts[0].path).to.be.equal('stringProperty');
794
- expect(changeSet.String.stringProperty).to.be.equal('s');
794
+ expect(conflicts[0].path).to.be.equal("stringProperty");
795
+ expect(changeSet.String.stringProperty).to.be.equal("s");
795
796
  },
796
797
  });
797
798
  });
798
- it('should correctly handle boundary cases', function () {
799
+ it("should correctly handle boundary cases", function () {
799
800
  var testChangeSet = function (in_CS, in_CS2) {
800
- var root = PropertyFactory.create('NodeProperty');
801
- var initialString = PropertyFactory.create('String');
802
- root.insert('str', initialString);
803
- initialString.value = 'AAAAAA';
801
+ var root = PropertyFactory.create("NodeProperty");
802
+ var initialString = PropertyFactory.create("String");
803
+ root.insert("str", initialString);
804
+ initialString.value = "AAAAAA";
804
805
  root.applyChangeSet(in_CS);
805
806
  if (in_CS2) {
806
807
  root.applyChangeSet(in_CS2);
807
808
  }
808
809
  return initialString.value;
809
810
  };
810
- var CS1 = new ChangeSet({ modify: { String: { str: { 'remove': [[2, 2]] } } } });
811
- var CS2 = new ChangeSet({ modify: { String: { str: { 'insert': [[2, '-'], [4, '-']] } } } });
812
- expect(testChangeSet(CS1.getSerializedChangeSet())).to.equal('AAAA');
813
- expect(testChangeSet(CS2.getSerializedChangeSet())).to.equal('AA-AA-AA');
811
+ var CS1 = new ChangeSet({ modify: { String: { str: { remove: [[2, 2]] } } } });
812
+ var CS2 = new ChangeSet({
813
+ modify: {
814
+ String: {
815
+ str: {
816
+ insert: [
817
+ [2, "-"],
818
+ [4, "-"],
819
+ ],
820
+ },
821
+ },
822
+ },
823
+ });
824
+ expect(testChangeSet(CS1.getSerializedChangeSet())).to.equal("AAAA");
825
+ expect(testChangeSet(CS2.getSerializedChangeSet())).to.equal("AA-AA-AA");
814
826
  var conflicts = [];
815
827
  var rebasedCS1 = CS2._rebaseChangeSet(deepCopy(CS1.getSerializedChangeSet()), conflicts);
816
828
  var rebasedCS2 = CS1._rebaseChangeSet(deepCopy(CS2.getSerializedChangeSet()), conflicts);
817
829
  expect(rebasedCS1.modify.String.str.remove.length).to.equal(1);
818
- expect(testChangeSet(CS2.getSerializedChangeSet(), rebasedCS1)).to.equal('AA--AA');
819
- expect(testChangeSet(CS1.getSerializedChangeSet(), rebasedCS2)).to.equal('AA--AA');
830
+ expect(testChangeSet(CS2.getSerializedChangeSet(), rebasedCS1)).to.equal("AA--AA");
831
+ expect(testChangeSet(CS1.getSerializedChangeSet(), rebasedCS2)).to.equal("AA--AA");
820
832
  });
821
833
  });
822
834
  it('field "length" in schema should be ignored', function () {
823
835
  var SchemaStringWithLength = {
824
- typeid: 'autodesk.tests:SchemaStringWithLength-1.0.0',
825
- properties: [
826
- { id: 'stringProperty', typeid: 'String', length: 4 },
827
- ],
836
+ typeid: "autodesk.tests:SchemaStringWithLength-1.0.0",
837
+ properties: [{ id: "stringProperty", typeid: "String", length: 4 }],
828
838
  };
829
839
  PropertyFactory.register(SchemaStringWithLength);
830
840
  var prop = PropertyFactory.create(SchemaStringWithLength.typeid);
831
- expect(prop.get('stringProperty').getValue()).to.equal('');
841
+ expect(prop.get("stringProperty").getValue()).to.equal("");
832
842
  });
833
843
  it.skip('@bugfix field "length" not a number in schema should be ignored', function () {
834
844
  var SchemaStringWithStringLength = {
835
- typeid: 'autodesk.tests:SchemaStringWithStringLength-1.0.0',
836
- properties: [
837
- { id: 'stringProperty', typeid: 'String', length: '4' },
838
- ],
845
+ typeid: "autodesk.tests:SchemaStringWithStringLength-1.0.0",
846
+ properties: [{ id: "stringProperty", typeid: "String", length: "4" }],
839
847
  };
840
848
  PropertyFactory.register(SchemaStringWithStringLength);
841
849
  var prop = PropertyFactory.create(SchemaStringWithStringLength.typeid);
842
- expect(prop.get('stringProperty').getValue()).to.equal('');
850
+ expect(prop.get("stringProperty").getValue()).to.equal("");
843
851
  });
844
852
  });
845
853
  //# sourceMappingURL=stringProperty.spec.js.map