@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview In this file, we will test the set property object described in /src/properties/setProperty.js
|
|
7
7
|
*/
|
|
8
|
-
const { ChangeSet } = require(
|
|
9
|
-
const { generateGUID } = require(
|
|
10
|
-
const _ = require(
|
|
11
|
-
const { PropertyFactory } = require(
|
|
12
|
-
const { BaseProperty } = require(
|
|
13
|
-
describe(
|
|
8
|
+
const { ChangeSet } = require("@fluid-experimental/property-changeset");
|
|
9
|
+
const { generateGUID } = require("@fluid-experimental/property-common").GuidUtils;
|
|
10
|
+
const _ = require("lodash");
|
|
11
|
+
const { PropertyFactory } = require("../..");
|
|
12
|
+
const { BaseProperty } = require("../..");
|
|
13
|
+
describe("SetProperty", function () {
|
|
14
14
|
var PATH_TOKENS;
|
|
15
15
|
var changeSetWithTwoChildren, changeSetWithTwoChildren_full, removalChangeSet;
|
|
16
16
|
var myNode, childNode1, childNode2, children;
|
|
@@ -18,24 +18,24 @@ describe('SetProperty', function () {
|
|
|
18
18
|
PATH_TOKENS = BaseProperty.PATH_TOKENS;
|
|
19
19
|
// Register a template with a set property for the tests
|
|
20
20
|
var TestPropertyTemplate = {
|
|
21
|
-
typeid:
|
|
22
|
-
inherits: [
|
|
21
|
+
typeid: "autodesk.tests:TestPropertyID-1.0.0",
|
|
22
|
+
inherits: ["NamedProperty"],
|
|
23
23
|
properties: [
|
|
24
|
-
{ id:
|
|
25
|
-
{ id:
|
|
26
|
-
{ id:
|
|
24
|
+
{ id: "stringProperty", typeid: "String" },
|
|
25
|
+
{ id: "stringProperty2", typeid: "String" },
|
|
26
|
+
{ id: "children", context: "set", typeid: "NamedProperty" },
|
|
27
27
|
],
|
|
28
28
|
};
|
|
29
29
|
PropertyFactory._reregister(TestPropertyTemplate);
|
|
30
|
-
myNode = PropertyFactory.create(
|
|
31
|
-
childNode1 = PropertyFactory.create(
|
|
32
|
-
childNode2 = PropertyFactory.create(
|
|
30
|
+
myNode = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
31
|
+
childNode1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
32
|
+
childNode2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
33
33
|
children = myNode._properties.children;
|
|
34
34
|
});
|
|
35
35
|
// Helper functions for the test cases
|
|
36
36
|
// Inserts a node with the given guid (a new one is generated when undefined)
|
|
37
37
|
var insertNodeInRootWithGuid = function (guid, root) {
|
|
38
|
-
var child = PropertyFactory.create(
|
|
38
|
+
var child = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
39
39
|
if (guid) {
|
|
40
40
|
child._properties.guid.value = guid;
|
|
41
41
|
}
|
|
@@ -55,7 +55,7 @@ describe('SetProperty', function () {
|
|
|
55
55
|
while (leaf._properties.children.getAsArray().length > 0) {
|
|
56
56
|
leaf = leaf._properties.children.getAsArray()[0];
|
|
57
57
|
}
|
|
58
|
-
var child = PropertyFactory.create(
|
|
58
|
+
var child = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
59
59
|
leaf._properties.children.insert(child);
|
|
60
60
|
};
|
|
61
61
|
// Removes the first node from the root
|
|
@@ -69,131 +69,156 @@ describe('SetProperty', function () {
|
|
|
69
69
|
while (leaf._properties.children.getAsArray().length > 0) {
|
|
70
70
|
leaf = leaf._properties.children.getAsArray()[0];
|
|
71
71
|
}
|
|
72
|
-
leaf._properties.stringProperty.value = leaf._properties.stringProperty.value +
|
|
72
|
+
leaf._properties.stringProperty.value = leaf._properties.stringProperty.value + "+";
|
|
73
73
|
};
|
|
74
|
-
describe(
|
|
75
|
-
it(
|
|
74
|
+
describe("Testing creation, assignment and serialization", function () {
|
|
75
|
+
it("should be empty at the beginning", function () {
|
|
76
76
|
expect(children.getEntriesReadOnly()).to.be.empty;
|
|
77
77
|
expect(children._serialize(true)).to.be.empty;
|
|
78
78
|
});
|
|
79
|
-
it(
|
|
79
|
+
it("should be possible to insert children", function () {
|
|
80
80
|
// Test insertion of the first child
|
|
81
81
|
children.insert(childNode1);
|
|
82
82
|
expect(children.has(childNode1.getGuid())).to.be.ok;
|
|
83
83
|
expect(!children.has(childNode2.getGuid())).to.be.ok;
|
|
84
84
|
expect(children.get(childNode2.getGuid())).to.equal(undefined);
|
|
85
85
|
expect(childNode1.getParent()).to.equal(children);
|
|
86
|
-
var CS = children.serialize({
|
|
86
|
+
var CS = children.serialize({ dirtyOnly: true });
|
|
87
87
|
expect(CS.insert &&
|
|
88
|
-
CS.insert[
|
|
89
|
-
_.keys(CS.insert[
|
|
90
|
-
_.keys(CS.insert[
|
|
88
|
+
CS.insert["autodesk.tests:TestPropertyID-1.0.0"] &&
|
|
89
|
+
_.keys(CS.insert["autodesk.tests:TestPropertyID-1.0.0"]).length === 1 &&
|
|
90
|
+
_.keys(CS.insert["autodesk.tests:TestPropertyID-1.0.0"])[0] ===
|
|
91
|
+
childNode1.getGuid()).to.be.ok;
|
|
91
92
|
// Test insertion of the second child
|
|
92
93
|
children.insert(childNode2);
|
|
93
94
|
expect(children.has(childNode2.getGuid())).to.be.ok;
|
|
94
95
|
expect(children.get(childNode2.getGuid())).to.equal(childNode2);
|
|
95
|
-
changeSetWithTwoChildren = children.serialize({
|
|
96
|
+
changeSetWithTwoChildren = children.serialize({ dirtyOnly: true });
|
|
96
97
|
expect(changeSetWithTwoChildren.insert &&
|
|
97
|
-
changeSetWithTwoChildren.insert[
|
|
98
|
-
_.keys(changeSetWithTwoChildren.insert[
|
|
99
|
-
|
|
100
|
-
_.includes(_.keys(changeSetWithTwoChildren.insert[
|
|
101
|
-
|
|
98
|
+
changeSetWithTwoChildren.insert["autodesk.tests:TestPropertyID-1.0.0"] &&
|
|
99
|
+
_.keys(changeSetWithTwoChildren.insert["autodesk.tests:TestPropertyID-1.0.0"])
|
|
100
|
+
.length === 2 &&
|
|
101
|
+
_.includes(_.keys(changeSetWithTwoChildren.insert["autodesk.tests:TestPropertyID-1.0.0"]), childNode1.getGuid()) &&
|
|
102
|
+
_.includes(_.keys(changeSetWithTwoChildren.insert["autodesk.tests:TestPropertyID-1.0.0"]), childNode2.getGuid())).to.be.ok;
|
|
103
|
+
changeSetWithTwoChildren_full = children.serialize({ dirtyOnly: false });
|
|
102
104
|
expect(changeSetWithTwoChildren).to.deep.equal(changeSetWithTwoChildren_full);
|
|
103
105
|
});
|
|
104
|
-
it(
|
|
106
|
+
it(".get and .resolvePath should work", function () {
|
|
105
107
|
expect(children.get(childNode1.getGuid())).to.equal(childNode1);
|
|
106
|
-
expect(children.resolvePath(
|
|
107
|
-
expect(children.get([PATH_TOKENS.ROOT,
|
|
108
|
-
expect(children.resolvePath(
|
|
109
|
-
expect(children.get([PATH_TOKENS.UP,
|
|
110
|
-
});
|
|
111
|
-
it(
|
|
112
|
-
var myNode1 = PropertyFactory.create(
|
|
113
|
-
var childNode3 = PropertyFactory.create(
|
|
114
|
-
var childNode4 = PropertyFactory.create(
|
|
108
|
+
expect(children.resolvePath("/children[" + childNode1.getGuid() + "]")).to.equal(childNode1);
|
|
109
|
+
expect(children.get([PATH_TOKENS.ROOT, "children", childNode1.getGuid()])).to.equal(childNode1);
|
|
110
|
+
expect(children.resolvePath("../children[" + childNode1.getGuid() + "]")).to.equal(childNode1);
|
|
111
|
+
expect(children.get([PATH_TOKENS.UP, "children", childNode1.getGuid()])).to.equal(childNode1);
|
|
112
|
+
});
|
|
113
|
+
it(".remove should return the item removed", function () {
|
|
114
|
+
var myNode1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
115
|
+
var childNode3 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
116
|
+
var childNode4 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
115
117
|
var mySet = myNode1._properties.children;
|
|
116
118
|
mySet.insert(childNode3);
|
|
117
119
|
mySet.insert(childNode4);
|
|
118
120
|
expect(mySet.remove(childNode3)).to.deep.equal(childNode3);
|
|
119
121
|
expect(mySet.remove(childNode4.getGuid())).to.deep.equal(childNode4);
|
|
120
122
|
});
|
|
121
|
-
it(
|
|
122
|
-
var myNode1 = PropertyFactory.create(
|
|
123
|
-
var childNode3 = PropertyFactory.create(
|
|
124
|
-
var childNode4 = PropertyFactory.create(
|
|
123
|
+
it("getValues should work", function () {
|
|
124
|
+
var myNode1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
125
|
+
var childNode3 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
126
|
+
var childNode4 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
125
127
|
var mySet = myNode1._properties.children;
|
|
126
128
|
mySet.insert(childNode3);
|
|
127
129
|
mySet.insert(childNode4);
|
|
128
130
|
var guid = myNode1.getGuid();
|
|
129
131
|
var guidChild3 = childNode3.getGuid();
|
|
130
132
|
var guidChild4 = childNode4.getGuid();
|
|
131
|
-
expect(function () {
|
|
133
|
+
expect(function () {
|
|
134
|
+
myNode1.getValues();
|
|
135
|
+
}).to.not.throw();
|
|
132
136
|
var expectedStr = '{"stringProperty":"",' +
|
|
133
137
|
'"stringProperty2":"",' +
|
|
134
138
|
'"children":{"' +
|
|
135
|
-
guidChild3 +
|
|
139
|
+
guidChild3 +
|
|
140
|
+
'":{"stringProperty":"",' +
|
|
136
141
|
'"stringProperty2":"",' +
|
|
137
142
|
'"children":{},' +
|
|
138
|
-
'"guid":"' +
|
|
139
|
-
|
|
143
|
+
'"guid":"' +
|
|
144
|
+
guidChild3 +
|
|
145
|
+
'"},' +
|
|
146
|
+
'"' +
|
|
147
|
+
guidChild4 +
|
|
148
|
+
'":{"stringProperty":"",' +
|
|
140
149
|
'"stringProperty2":"",' +
|
|
141
150
|
'"children":{},' +
|
|
142
|
-
'"guid":"' +
|
|
143
|
-
|
|
151
|
+
'"guid":"' +
|
|
152
|
+
guidChild4 +
|
|
153
|
+
'"}},' +
|
|
154
|
+
'"guid":"' +
|
|
155
|
+
guid +
|
|
156
|
+
'"}';
|
|
144
157
|
expect(JSON.stringify(myNode1.getValues())).to.equal(expectedStr);
|
|
145
158
|
});
|
|
146
|
-
it(
|
|
159
|
+
it("should output a pretty string with prettyPrint()", function () {
|
|
147
160
|
var guid = myNode.getGuid();
|
|
148
161
|
var guidChild1 = childNode1.getGuid();
|
|
149
162
|
var guidChild2 = childNode2.getGuid();
|
|
150
|
-
var expectedPrettyStr = guid +
|
|
163
|
+
var expectedPrettyStr = guid +
|
|
164
|
+
" (autodesk.tests:TestPropertyID-1.0.0):\n" +
|
|
151
165
|
' stringProperty (String): ""\n' +
|
|
152
166
|
' stringProperty2 (String): ""\n' +
|
|
153
|
-
|
|
154
|
-
|
|
167
|
+
" children (Set of NamedProperty):\n" +
|
|
168
|
+
" " +
|
|
169
|
+
guidChild1 +
|
|
170
|
+
" (autodesk.tests:TestPropertyID-1.0.0):\n" +
|
|
155
171
|
' stringProperty (String): ""\n' +
|
|
156
172
|
' stringProperty2 (String): ""\n' +
|
|
157
|
-
|
|
158
|
-
' guid (String): "' +
|
|
159
|
-
|
|
173
|
+
" children (Set of NamedProperty):\n" +
|
|
174
|
+
' guid (String): "' +
|
|
175
|
+
guidChild1 +
|
|
176
|
+
'"\n' +
|
|
177
|
+
" " +
|
|
178
|
+
guidChild2 +
|
|
179
|
+
" (autodesk.tests:TestPropertyID-1.0.0):\n" +
|
|
160
180
|
' stringProperty (String): ""\n' +
|
|
161
181
|
' stringProperty2 (String): ""\n' +
|
|
162
|
-
|
|
163
|
-
' guid (String): "' +
|
|
164
|
-
|
|
165
|
-
|
|
182
|
+
" children (Set of NamedProperty):\n" +
|
|
183
|
+
' guid (String): "' +
|
|
184
|
+
guidChild2 +
|
|
185
|
+
'"\n' +
|
|
186
|
+
' guid (String): "' +
|
|
187
|
+
guid +
|
|
188
|
+
'"\n';
|
|
189
|
+
var prettyStr = "";
|
|
166
190
|
myNode.prettyPrint(function (str) {
|
|
167
|
-
prettyStr += str +
|
|
191
|
+
prettyStr += str + "\n";
|
|
168
192
|
});
|
|
169
193
|
expect(prettyStr).to.equal(expectedPrettyStr);
|
|
170
194
|
});
|
|
171
|
-
it(
|
|
195
|
+
it("Should track dirtiness", function () {
|
|
172
196
|
children.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
|
|
173
|
-
expect(children._serialize(true, false, BaseProperty.MODIFIED_STATE_FLAGS.DIRTY)).to.be
|
|
197
|
+
expect(children._serialize(true, false, BaseProperty.MODIFIED_STATE_FLAGS.DIRTY)).to.be
|
|
198
|
+
.empty;
|
|
174
199
|
expect(children._serialize(true, false, BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE)).deep.equal(changeSetWithTwoChildren_full);
|
|
175
|
-
expect(children.serialize({
|
|
200
|
+
expect(children.serialize({ dirtyOnly: false })).deep.equal(changeSetWithTwoChildren_full);
|
|
176
201
|
});
|
|
177
|
-
it(
|
|
202
|
+
it("Should handle removals correctly", function () {
|
|
178
203
|
children.remove(childNode1);
|
|
179
204
|
expect(childNode1.getParent()).to.be.undefined;
|
|
180
205
|
children.remove(childNode2.getGuid());
|
|
181
206
|
expect(children._serialize(true, false, BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE)).to.be.empty;
|
|
182
207
|
expect(children._serialize(false)).to.be.empty;
|
|
183
208
|
removalChangeSet = children.serialize({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
209
|
+
dirtyOnly: true,
|
|
210
|
+
includeRootTypeid: false,
|
|
211
|
+
dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY,
|
|
187
212
|
});
|
|
188
|
-
expect(removalChangeSet).to.have.all.keys([
|
|
213
|
+
expect(removalChangeSet).to.have.all.keys(["remove"]);
|
|
189
214
|
expect(removalChangeSet.remove).to.have.length(2);
|
|
190
215
|
expect(removalChangeSet.remove).to.contain(childNode1.getGuid());
|
|
191
216
|
expect(removalChangeSet.remove).to.contain(childNode1.getGuid());
|
|
192
217
|
});
|
|
193
|
-
it(
|
|
194
|
-
var deserializedNode = PropertyFactory.create(
|
|
218
|
+
it("Should support deserialization", function () {
|
|
219
|
+
var deserializedNode = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
195
220
|
var deserializedChanges1 = deserializedNode._properties.children.deserialize(changeSetWithTwoChildren);
|
|
196
|
-
var CS4 = deserializedNode._properties.children.serialize({
|
|
221
|
+
var CS4 = deserializedNode._properties.children.serialize({ dirtyOnly: false });
|
|
197
222
|
expect(CS4).to.deep.equal(changeSetWithTwoChildren);
|
|
198
223
|
expect(deserializedChanges1).to.deep.equal(changeSetWithTwoChildren);
|
|
199
224
|
var deserializedChanges2 = deserializedNode._properties.children.deserialize(changeSetWithTwoChildren);
|
|
@@ -201,145 +226,152 @@ describe('SetProperty', function () {
|
|
|
201
226
|
var deserializedChanges3 = deserializedNode._properties.children.deserialize({});
|
|
202
227
|
expect(deserializedChanges3).to.deep.equal(removalChangeSet);
|
|
203
228
|
});
|
|
204
|
-
it(
|
|
205
|
-
var deserializedNode = PropertyFactory.create(
|
|
206
|
-
var deserializedNode2 = PropertyFactory.create(
|
|
207
|
-
var namedProperty = PropertyFactory.create(
|
|
229
|
+
it("Should support deserialization for inserts and removes", function () {
|
|
230
|
+
var deserializedNode = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
231
|
+
var deserializedNode2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
232
|
+
var namedProperty = PropertyFactory.create("NamedProperty");
|
|
208
233
|
deserializedNode._properties.children.insert(namedProperty);
|
|
209
|
-
deserializedNode2.deserialize(deserializedNode.serialize({
|
|
210
|
-
expect(deserializedNode2.serialize({
|
|
234
|
+
deserializedNode2.deserialize(deserializedNode.serialize({ dirtyOnly: false }));
|
|
235
|
+
expect(deserializedNode2.serialize({ dirtyOnly: false })).to.deep.equal(deserializedNode.serialize({ dirtyOnly: false }));
|
|
211
236
|
deserializedNode._properties.children.remove(namedProperty);
|
|
212
|
-
deserializedNode2.deserialize(deserializedNode.serialize({
|
|
213
|
-
expect(deserializedNode2.serialize({
|
|
237
|
+
deserializedNode2.deserialize(deserializedNode.serialize({ dirtyOnly: false }));
|
|
238
|
+
expect(deserializedNode2.serialize({ dirtyOnly: false })).to.deep.equal(deserializedNode.serialize({ dirtyOnly: false }));
|
|
214
239
|
});
|
|
215
|
-
it(
|
|
216
|
-
var modifyNode1 = PropertyFactory.create(
|
|
217
|
-
var modifyNode2 = PropertyFactory.create(
|
|
240
|
+
it("Should track modifies", function () {
|
|
241
|
+
var modifyNode1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
242
|
+
var modifyNode2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
218
243
|
modifyNode1._properties.children.deserialize(changeSetWithTwoChildren);
|
|
219
244
|
modifyNode2._properties.children.deserialize(changeSetWithTwoChildren);
|
|
220
245
|
modifyNode1._properties.children.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
221
246
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
222
247
|
var child1 = modifyNode1._properties.children.get(childNode1.getGuid());
|
|
223
|
-
child1._properties.stringProperty.value =
|
|
248
|
+
child1._properties.stringProperty.value = "modify test";
|
|
224
249
|
var modifyChangeSet = modifyNode1._properties.children._serialize(true);
|
|
225
250
|
modifyNode2._properties.children.applyChangeSet(modifyChangeSet);
|
|
226
|
-
expect(modifyNode2._properties.children._serialize(false))
|
|
227
|
-
.to.deep.equal(modifyNode1._properties.children._serialize(false));
|
|
251
|
+
expect(modifyNode2._properties.children._serialize(false)).to.deep.equal(modifyNode1._properties.children._serialize(false));
|
|
228
252
|
});
|
|
229
|
-
it(
|
|
230
|
-
var node1 = PropertyFactory.create(
|
|
231
|
-
var node2 = PropertyFactory.create(
|
|
232
|
-
var node3 = PropertyFactory.create(
|
|
253
|
+
it("Should support hierarchical properties", function () {
|
|
254
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
255
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
256
|
+
var node3 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
233
257
|
// Create a hierarchy of three nodes
|
|
234
258
|
node1._properties.children.insert(node2);
|
|
235
259
|
node2._properties.children.insert(node3);
|
|
236
|
-
node3._properties.stringProperty.value =
|
|
260
|
+
node3._properties.stringProperty.value = "test";
|
|
237
261
|
// Check that deserializing and serializing works with a hierarchy
|
|
238
|
-
var hierarchicalChangeSet = node1.serialize({
|
|
239
|
-
var deserializedNode = PropertyFactory.create(
|
|
262
|
+
var hierarchicalChangeSet = node1.serialize({ dirtyOnly: true });
|
|
263
|
+
var deserializedNode = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
240
264
|
deserializedNode.deserialize(hierarchicalChangeSet);
|
|
241
265
|
var child1 = deserializedNode._properties.children.getAsArray()[0];
|
|
242
266
|
expect(child1).to.not.equal(undefined);
|
|
243
267
|
var child2 = child1._properties.children.getAsArray()[0];
|
|
244
268
|
expect(child2).to.not.equal(undefined);
|
|
245
|
-
expect(child2._properties.stringProperty.value).to.equal(
|
|
269
|
+
expect(child2._properties.stringProperty.value).to.equal("test");
|
|
246
270
|
// Test that hierarchical modifies work
|
|
247
271
|
node1.cleanDirty();
|
|
248
|
-
node3._properties.stringProperty.value =
|
|
249
|
-
var hierarchicalModifyChangeSet = node1.serialize({
|
|
272
|
+
node3._properties.stringProperty.value = "test2";
|
|
273
|
+
var hierarchicalModifyChangeSet = node1.serialize({ dirtyOnly: true });
|
|
250
274
|
deserializedNode.applyChangeSet(hierarchicalModifyChangeSet);
|
|
251
275
|
child1 = deserializedNode._properties.children.getAsArray()[0];
|
|
252
276
|
expect(child1).to.not.equal(undefined);
|
|
253
277
|
child2 = child1._properties.children.getAsArray()[0];
|
|
254
278
|
expect(child2).to.not.equal(undefined);
|
|
255
|
-
expect(child2._properties.stringProperty.value).to.equal(
|
|
279
|
+
expect(child2._properties.stringProperty.value).to.equal("test2");
|
|
256
280
|
});
|
|
257
|
-
it(
|
|
258
|
-
var set = PropertyFactory.create(
|
|
259
|
-
|
|
281
|
+
it("adding a NamedNodeProperty should be possible", function () {
|
|
282
|
+
var set = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0")._properties
|
|
283
|
+
.children;
|
|
284
|
+
var namedNodeProp = PropertyFactory.create("NamedNodeProperty");
|
|
260
285
|
set.insert(namedNodeProp);
|
|
261
286
|
expect(set.has(namedNodeProp.getGuid())).to.be.true;
|
|
262
287
|
expect(set.get(namedNodeProp.getGuid())).to.equal(namedNodeProp);
|
|
263
288
|
});
|
|
264
|
-
it(
|
|
265
|
-
var rootNode = PropertyFactory.create(
|
|
266
|
-
var node = PropertyFactory.create(
|
|
289
|
+
it("path creation and resolution should work for entries of the map", function () {
|
|
290
|
+
var rootNode = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
291
|
+
var node = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
267
292
|
rootNode._properties.children.insert(node);
|
|
268
293
|
// Test whether the returned paths are correct
|
|
269
|
-
expect(node.getAbsolutePath()).to.equal(
|
|
270
|
-
expect(node.getRelativePath(node)).to.equal(
|
|
271
|
-
expect(node.getRelativePath(rootNode.resolvePath(
|
|
272
|
-
expect(rootNode.getRelativePath(node)).to.equal(
|
|
273
|
-
expect(rootNode.resolvePath(
|
|
274
|
-
expect(rootNode.resolvePath(
|
|
294
|
+
expect(node.getAbsolutePath()).to.equal("/children[" + node.getGuid() + "]");
|
|
295
|
+
expect(node.getRelativePath(node)).to.equal("");
|
|
296
|
+
expect(node.getRelativePath(rootNode.resolvePath("children"))).to.equal("[" + node.getGuid() + "]");
|
|
297
|
+
expect(rootNode.getRelativePath(node)).to.equal("../../");
|
|
298
|
+
expect(rootNode.resolvePath("children[" + node.getGuid() + "]")).to.equal(node);
|
|
299
|
+
expect(rootNode.resolvePath("children").resolvePath("[" + node.getGuid() + "]")).to.equal(node);
|
|
275
300
|
// Test whether they are updated correctly
|
|
276
301
|
rootNode._properties.children.remove(node);
|
|
277
302
|
// After removal the old paths should be undefined
|
|
278
|
-
expect(rootNode.resolvePath(
|
|
279
|
-
expect(rootNode.resolvePath(
|
|
303
|
+
expect(rootNode.resolvePath("children[" + node.getGuid() + "]")).to.be.undefined;
|
|
304
|
+
expect(rootNode.resolvePath("children").resolvePath("[" + node.getGuid() + "]")).to.be
|
|
305
|
+
.undefined;
|
|
280
306
|
// And the node should have an empty absolute path
|
|
281
|
-
expect(node.getAbsolutePath()).to.equal(
|
|
307
|
+
expect(node.getAbsolutePath()).to.equal("/");
|
|
282
308
|
});
|
|
283
|
-
describe(
|
|
309
|
+
describe("Setting values", function () {
|
|
284
310
|
before(function () {
|
|
285
311
|
var SetValueEntryTemplate = {
|
|
286
|
-
typeid:
|
|
287
|
-
inherits: [
|
|
288
|
-
properties: [{ id:
|
|
312
|
+
typeid: "autodesk.tests:SetValueEntry-1.0.0",
|
|
313
|
+
inherits: ["NamedProperty"],
|
|
314
|
+
properties: [{ id: "string", typeid: "String" }],
|
|
289
315
|
};
|
|
290
316
|
var SetValueTemplate = {
|
|
291
|
-
typeid:
|
|
292
|
-
properties: [
|
|
317
|
+
typeid: "autodesk.tests:SetValue-1.0.0",
|
|
318
|
+
properties: [
|
|
319
|
+
{ id: "set", typeid: "autodesk.tests:SetValueEntry-1.0.0", context: "set" },
|
|
320
|
+
],
|
|
293
321
|
};
|
|
294
322
|
PropertyFactory.register(SetValueEntryTemplate);
|
|
295
323
|
PropertyFactory.register(SetValueTemplate);
|
|
296
324
|
});
|
|
297
|
-
it(
|
|
298
|
-
var setValueEntry1 = PropertyFactory.create(
|
|
299
|
-
string:
|
|
325
|
+
it("should set values for a list of property inputs", function () {
|
|
326
|
+
var setValueEntry1 = PropertyFactory.create("autodesk.tests:SetValueEntry-1.0.0", null, {
|
|
327
|
+
string: "I am a string 1",
|
|
300
328
|
});
|
|
301
|
-
var setValueEntry2 = PropertyFactory.create(
|
|
302
|
-
string:
|
|
329
|
+
var setValueEntry2 = PropertyFactory.create("autodesk.tests:SetValueEntry-1.0.0", null, {
|
|
330
|
+
string: "I am a string 2",
|
|
303
331
|
});
|
|
304
|
-
var setValue = PropertyFactory.create(
|
|
305
|
-
setValue.get(
|
|
306
|
-
expect(setValue.get(
|
|
307
|
-
expect(setValue.get(
|
|
308
|
-
expect(setValue.get(
|
|
332
|
+
var setValue = PropertyFactory.create("autodesk.tests:SetValue-1.0.0");
|
|
333
|
+
setValue.get("set").setValues([setValueEntry1, setValueEntry2]);
|
|
334
|
+
expect(setValue.get("set").getAsArray().length).to.equal(2);
|
|
335
|
+
expect(setValue.get("set").getAsArray()[0].get("string").getValue()).to.equal("I am a string 1");
|
|
336
|
+
expect(setValue.get("set").getAsArray()[1].get("string").getValue()).to.equal("I am a string 2");
|
|
309
337
|
});
|
|
310
|
-
it(
|
|
311
|
-
var setValue = PropertyFactory.create(
|
|
312
|
-
setValue
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
expect(setValue.get(
|
|
338
|
+
it("should set values for a list of untyped inputs", function () {
|
|
339
|
+
var setValue = PropertyFactory.create("autodesk.tests:SetValue-1.0.0");
|
|
340
|
+
setValue
|
|
341
|
+
.get("set")
|
|
342
|
+
.setValues([{ string: "I am a string 1" }, { string: "I am a string 2" }]);
|
|
343
|
+
expect(setValue.get("set").getAsArray().length).to.equal(2);
|
|
344
|
+
expect(setValue.get("set").getAsArray()[0].get("string").getValue()).to.equal("I am a string 1");
|
|
345
|
+
expect(setValue.get("set").getAsArray()[1].get("string").getValue()).to.equal("I am a string 2");
|
|
316
346
|
});
|
|
317
|
-
it(
|
|
318
|
-
var setValueEntry1 = PropertyFactory.create(
|
|
319
|
-
string:
|
|
347
|
+
it("should update values for existing keys and create new ones for non-existing keys", function () {
|
|
348
|
+
var setValueEntry1 = PropertyFactory.create("autodesk.tests:SetValueEntry-1.0.0", null, {
|
|
349
|
+
string: "I am a string 1",
|
|
320
350
|
});
|
|
321
|
-
var setValueEntry2 = PropertyFactory.create(
|
|
322
|
-
string:
|
|
351
|
+
var setValueEntry2 = PropertyFactory.create("autodesk.tests:SetValueEntry-1.0.0", null, {
|
|
352
|
+
string: "I am a string 2",
|
|
323
353
|
});
|
|
324
|
-
var setValue = PropertyFactory.create(
|
|
325
|
-
setValue.get(
|
|
326
|
-
setValueEntry1.get(
|
|
327
|
-
setValue
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
expect(setValue.get(
|
|
331
|
-
expect(setValue.get(
|
|
332
|
-
|
|
333
|
-
setValue.get(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
expect(setValue.get(
|
|
337
|
-
expect(setValue.get(
|
|
338
|
-
expect(setValue.get(
|
|
354
|
+
var setValue = PropertyFactory.create("autodesk.tests:SetValue-1.0.0");
|
|
355
|
+
setValue.get("set").setValues([setValueEntry1, setValueEntry2]);
|
|
356
|
+
setValueEntry1.get("string").setValue("I am a string 1, overriden");
|
|
357
|
+
setValue
|
|
358
|
+
.get("set")
|
|
359
|
+
.setValues([setValueEntry1, setValueEntry2, { string: "I am a string 3" }]);
|
|
360
|
+
expect(setValue.get("set").getAsArray().length).to.equal(3);
|
|
361
|
+
expect(setValue.get("set").getAsArray()[0].get("string").getValue()).to.equal("I am a string 1, overriden");
|
|
362
|
+
expect(setValue.get("set").getAsArray()[1].get("string").getValue()).to.equal("I am a string 2");
|
|
363
|
+
expect(setValue.get("set").getAsArray()[2].get("string").getValue()).to.equal("I am a string 3");
|
|
364
|
+
setValueEntry2.get("string").setValue("I am a string 2, overriden");
|
|
365
|
+
setValue.get("set").setValues([{ string: "I am a string 4" }, setValueEntry2]);
|
|
366
|
+
expect(setValue.get("set").getAsArray().length).to.equal(4);
|
|
367
|
+
expect(setValue.get("set").getAsArray()[0].get("string").getValue()).to.equal("I am a string 1, overriden");
|
|
368
|
+
expect(setValue.get("set").getAsArray()[3].get("string").getValue()).to.equal("I am a string 2, overriden");
|
|
369
|
+
expect(setValue.get("set").getAsArray()[1].get("string").getValue()).to.equal("I am a string 3");
|
|
370
|
+
expect(setValue.get("set").getAsArray()[2].get("string").getValue()).to.equal("I am a string 4");
|
|
339
371
|
});
|
|
340
372
|
});
|
|
341
373
|
});
|
|
342
|
-
describe(
|
|
374
|
+
describe("squashing", function () {
|
|
343
375
|
//
|
|
344
376
|
// Helper function which takes a sequence of callbacks that are successively executed
|
|
345
377
|
// and the changes applied by the callbacks are separately tracked and squashed in a
|
|
@@ -349,19 +381,19 @@ describe('SetProperty', function () {
|
|
|
349
381
|
// be given as first parameter
|
|
350
382
|
//
|
|
351
383
|
var testChangeSetSquashing = function (in_options) {
|
|
352
|
-
var testProperty = PropertyFactory.create(
|
|
384
|
+
var testProperty = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
353
385
|
var callbacks = in_options.callbacks;
|
|
354
386
|
if (in_options.pre) {
|
|
355
387
|
in_options.pre(testProperty);
|
|
356
388
|
}
|
|
357
|
-
var initialChangeset = new ChangeSet(testProperty.serialize({
|
|
389
|
+
var initialChangeset = new ChangeSet(testProperty.serialize({ dirtyOnly: false }));
|
|
358
390
|
initialChangeset.setIsNormalized(true);
|
|
359
391
|
var squashedChangeset = new ChangeSet();
|
|
360
392
|
testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
361
393
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
362
394
|
for (var i = 0; i < callbacks.length; i++) {
|
|
363
395
|
callbacks[i](testProperty);
|
|
364
|
-
var changes = testProperty.serialize({
|
|
396
|
+
var changes = testProperty.serialize({ dirtyOnly: true });
|
|
365
397
|
testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
366
398
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
367
399
|
squashedChangeset.applyChangeSet(changes);
|
|
@@ -372,62 +404,88 @@ describe('SetProperty', function () {
|
|
|
372
404
|
initialChangeset.applyChangeSet(squashedChangeset.getSerializedChangeSet());
|
|
373
405
|
expect(initialChangeset.getSerializedChangeSet()).to.deep.equal(testProperty.serialize());
|
|
374
406
|
};
|
|
375
|
-
it(
|
|
376
|
-
testChangeSetSquashing({
|
|
407
|
+
it("should work for multiple independent inserts", function () {
|
|
408
|
+
testChangeSetSquashing({
|
|
409
|
+
callbacks: [insertNodeInRoot, insertNodeInRoot, insertNodeInRoot],
|
|
410
|
+
});
|
|
377
411
|
});
|
|
378
|
-
it(
|
|
379
|
-
testChangeSetSquashing({
|
|
412
|
+
it("should work for multiple hierarchical inserts", function () {
|
|
413
|
+
testChangeSetSquashing({
|
|
414
|
+
callbacks: [insertNodeAsLeaf, insertNodeAsLeaf, insertNodeAsLeaf],
|
|
415
|
+
});
|
|
380
416
|
});
|
|
381
|
-
it(
|
|
417
|
+
it("should work for inserts followed by removes", function () {
|
|
382
418
|
testChangeSetSquashing({
|
|
383
|
-
callbacks: [
|
|
419
|
+
callbacks: [
|
|
420
|
+
insertNodeInRoot,
|
|
421
|
+
insertNodeInRoot,
|
|
422
|
+
removeFirstNodeInRoot,
|
|
423
|
+
removeFirstNodeInRoot,
|
|
424
|
+
],
|
|
384
425
|
post: function (changeset) {
|
|
385
426
|
expect(changeset).to.be.empty;
|
|
386
427
|
},
|
|
387
428
|
});
|
|
388
429
|
});
|
|
389
|
-
it(
|
|
430
|
+
it("should work for a tree removal", function () {
|
|
390
431
|
testChangeSetSquashing({
|
|
391
|
-
callbacks: [
|
|
432
|
+
callbacks: [
|
|
433
|
+
insertNodeAsLeaf,
|
|
434
|
+
insertNodeAsLeaf,
|
|
435
|
+
insertNodeAsLeaf,
|
|
436
|
+
removeFirstNodeInRoot,
|
|
437
|
+
],
|
|
392
438
|
post: function (changeset) {
|
|
393
439
|
expect(changeset).to.be.empty;
|
|
394
440
|
},
|
|
395
441
|
});
|
|
396
442
|
});
|
|
397
|
-
it(
|
|
443
|
+
it("should work for modifies in a tree", function () {
|
|
398
444
|
testChangeSetSquashing({
|
|
399
|
-
callbacks: [
|
|
445
|
+
callbacks: [
|
|
446
|
+
insertNodeAsLeaf,
|
|
447
|
+
insertNodeAsLeaf,
|
|
448
|
+
insertNodeAsLeaf,
|
|
449
|
+
modifyLeaf,
|
|
450
|
+
modifyLeaf,
|
|
451
|
+
],
|
|
400
452
|
});
|
|
401
453
|
});
|
|
402
|
-
it(
|
|
454
|
+
it("an insert, modify and a remove should give an empty changeset", function () {
|
|
403
455
|
testChangeSetSquashing({
|
|
404
|
-
callbacks: [
|
|
456
|
+
callbacks: [
|
|
457
|
+
insertNodeAsLeaf,
|
|
458
|
+
insertNodeAsLeaf,
|
|
459
|
+
modifyLeaf,
|
|
460
|
+
modifyLeaf,
|
|
461
|
+
removeFirstNodeInRoot,
|
|
462
|
+
],
|
|
405
463
|
post: function (changeset) {
|
|
406
464
|
expect(changeset).to.be.empty;
|
|
407
465
|
},
|
|
408
466
|
});
|
|
409
467
|
});
|
|
410
|
-
it(
|
|
468
|
+
it("work for modifies after an already existing insert", function () {
|
|
411
469
|
testChangeSetSquashing({
|
|
412
470
|
pre: insertNodeInRoot,
|
|
413
471
|
callbacks: [modifyLeaf, modifyLeaf],
|
|
414
472
|
});
|
|
415
473
|
});
|
|
416
|
-
it(
|
|
474
|
+
it("of modify and remove after an already existing insert should work", function () {
|
|
417
475
|
testChangeSetSquashing({
|
|
418
476
|
pre: insertNodeInRoot,
|
|
419
477
|
callbacks: [modifyLeaf, removeFirstNodeInRoot],
|
|
420
478
|
post: function (changeset) {
|
|
421
|
-
expect(changeset[
|
|
479
|
+
expect(changeset["set<NamedProperty>"].children).to.have.all.keys("remove");
|
|
422
480
|
},
|
|
423
481
|
});
|
|
424
482
|
});
|
|
425
|
-
it(
|
|
483
|
+
it("of a replace operation should be possible", function () {
|
|
426
484
|
// Create two nodes with the same GUID
|
|
427
|
-
var node1 = PropertyFactory.create(
|
|
428
|
-
var node2 = PropertyFactory.create(
|
|
485
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
486
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
429
487
|
node2._properties.guid.value = node1._properties.guid.value;
|
|
430
|
-
node2._properties.stringProperty.value =
|
|
488
|
+
node2._properties.stringProperty.value = "testString2";
|
|
431
489
|
testChangeSetSquashing({
|
|
432
490
|
pre: function (root) {
|
|
433
491
|
root._properties.children.insert(node1);
|
|
@@ -439,22 +497,22 @@ describe('SetProperty', function () {
|
|
|
439
497
|
},
|
|
440
498
|
],
|
|
441
499
|
post: function (changeset) {
|
|
442
|
-
expect(changeset[
|
|
500
|
+
expect(changeset["set<NamedProperty>"].children).to.have.all.keys("remove", "insert");
|
|
443
501
|
},
|
|
444
502
|
});
|
|
445
503
|
});
|
|
446
504
|
});
|
|
447
|
-
describe(
|
|
505
|
+
describe("Rebasing", function () {
|
|
448
506
|
var testRebasing = function (in_options) {
|
|
449
507
|
// Prepare the initial state
|
|
450
|
-
var baseProperty1 = PropertyFactory.create(
|
|
508
|
+
var baseProperty1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
451
509
|
if (in_options.prepare) {
|
|
452
510
|
in_options.prepare(baseProperty1);
|
|
453
511
|
}
|
|
454
512
|
// Create two copies of this state
|
|
455
|
-
var baseProperty2 = PropertyFactory.create(
|
|
513
|
+
var baseProperty2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
456
514
|
baseProperty2.deserialize(baseProperty1.serialize());
|
|
457
|
-
var baseProperty3 = PropertyFactory.create(
|
|
515
|
+
var baseProperty3 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
458
516
|
baseProperty3.deserialize(baseProperty1.serialize());
|
|
459
517
|
// Make sure the states are clear
|
|
460
518
|
baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
@@ -472,8 +530,8 @@ describe('SetProperty', function () {
|
|
|
472
530
|
in_options.op2(baseProperty2);
|
|
473
531
|
}
|
|
474
532
|
// Get the ChangeSets
|
|
475
|
-
var changeSet1 = new ChangeSet(baseProperty1.serialize({
|
|
476
|
-
var changeSet2 = baseProperty2.serialize({
|
|
533
|
+
var changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));
|
|
534
|
+
var changeSet2 = baseProperty2.serialize({ dirtyOnly: true });
|
|
477
535
|
// Perform the actual rebase
|
|
478
536
|
var conflicts = [];
|
|
479
537
|
changeSet1._rebaseChangeSet(changeSet2, conflicts);
|
|
@@ -488,29 +546,29 @@ describe('SetProperty', function () {
|
|
|
488
546
|
if (in_options.op2) {
|
|
489
547
|
in_options.op2(baseProperty3);
|
|
490
548
|
}
|
|
491
|
-
var finalChangeSet = baseProperty3.serialize({
|
|
549
|
+
var finalChangeSet = baseProperty3.serialize({ dirtyOnly: false });
|
|
492
550
|
expect(finalChangeSet).to.be.deep.equal(combinedChangeSet.getSerializedChangeSet());
|
|
493
551
|
}
|
|
494
552
|
if (in_options.checkResult) {
|
|
495
553
|
in_options.checkResult(conflicts, changeSet2, combinedChangeSet);
|
|
496
554
|
}
|
|
497
555
|
};
|
|
498
|
-
it(
|
|
556
|
+
it("with a NOP should be possible", function () {
|
|
499
557
|
testRebasing({
|
|
500
558
|
op2: insertUniqueNodeInRoot(),
|
|
501
559
|
compareToSequential: true,
|
|
502
560
|
});
|
|
503
561
|
});
|
|
504
|
-
it(
|
|
562
|
+
it("with independent inserts should be possible", function () {
|
|
505
563
|
testRebasing({
|
|
506
564
|
op1: insertUniqueNodeInRoot(),
|
|
507
565
|
op2: insertUniqueNodeInRoot(),
|
|
508
566
|
compareToSequential: true,
|
|
509
567
|
});
|
|
510
568
|
});
|
|
511
|
-
it(
|
|
512
|
-
var node1 = PropertyFactory.create(
|
|
513
|
-
var node2 = PropertyFactory.create(
|
|
569
|
+
it("with independent removes should be possible", function () {
|
|
570
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
571
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
514
572
|
testRebasing({
|
|
515
573
|
prepare: function (root) {
|
|
516
574
|
root._properties.children.insert(node1);
|
|
@@ -525,8 +583,8 @@ describe('SetProperty', function () {
|
|
|
525
583
|
compareToSequential: true,
|
|
526
584
|
});
|
|
527
585
|
});
|
|
528
|
-
it(
|
|
529
|
-
var node1 = PropertyFactory.create(
|
|
586
|
+
it("with a modify and a remove should possible", function () {
|
|
587
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
530
588
|
testRebasing({
|
|
531
589
|
prepare: function (root) {
|
|
532
590
|
root._properties.children.insert(node1);
|
|
@@ -536,8 +594,8 @@ describe('SetProperty', function () {
|
|
|
536
594
|
compareToSequential: true,
|
|
537
595
|
});
|
|
538
596
|
});
|
|
539
|
-
it(
|
|
540
|
-
var node1 = PropertyFactory.create(
|
|
597
|
+
it("with a remove and a modify should possible", function () {
|
|
598
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
541
599
|
testRebasing({
|
|
542
600
|
prepare: function (root) {
|
|
543
601
|
root._properties.children.insert(node1);
|
|
@@ -548,13 +606,13 @@ describe('SetProperty', function () {
|
|
|
548
606
|
checkResult: function (conflicts, changeSet) {
|
|
549
607
|
expect(conflicts).to.have.length(1);
|
|
550
608
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
|
|
551
|
-
expect(conflicts[0].path).to.be.equal(
|
|
609
|
+
expect(conflicts[0].path).to.be.equal("children[" + node1.getGuid() + "]");
|
|
552
610
|
expect(ChangeSet.isEmptyChangeSet(changeSet)).to.be.ok;
|
|
553
611
|
},
|
|
554
612
|
});
|
|
555
613
|
});
|
|
556
|
-
it(
|
|
557
|
-
var node1 = PropertyFactory.create(
|
|
614
|
+
it("with two compatible removes should be possible", function () {
|
|
615
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
558
616
|
testRebasing({
|
|
559
617
|
prepare: function (root) {
|
|
560
618
|
root._properties.children.insert(node1);
|
|
@@ -571,17 +629,19 @@ describe('SetProperty', function () {
|
|
|
571
629
|
},
|
|
572
630
|
});
|
|
573
631
|
});
|
|
574
|
-
it(
|
|
575
|
-
var node1 = PropertyFactory.create(
|
|
632
|
+
it("with two indendent recursive modifies should be possible", function () {
|
|
633
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
576
634
|
testRebasing({
|
|
577
635
|
prepare: function (root) {
|
|
578
636
|
root._properties.children.insert(node1);
|
|
579
637
|
},
|
|
580
638
|
op1: function (root) {
|
|
581
|
-
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
639
|
+
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
640
|
+
"a";
|
|
582
641
|
},
|
|
583
642
|
op2: function (root) {
|
|
584
|
-
root._properties.children.getAsArray()[0]._properties.stringProperty2.value =
|
|
643
|
+
root._properties.children.getAsArray()[0]._properties.stringProperty2.value =
|
|
644
|
+
"a";
|
|
585
645
|
},
|
|
586
646
|
compareToSequential: true,
|
|
587
647
|
checkResult: function (conflicts, changeSet) {
|
|
@@ -589,36 +649,38 @@ describe('SetProperty', function () {
|
|
|
589
649
|
},
|
|
590
650
|
});
|
|
591
651
|
});
|
|
592
|
-
it(
|
|
593
|
-
var node1 = PropertyFactory.create(
|
|
652
|
+
it("with two conflicting recursive modifies should be possible and report a conflict", function () {
|
|
653
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
594
654
|
testRebasing({
|
|
595
655
|
prepare: function (root) {
|
|
596
656
|
root._properties.children.insert(node1);
|
|
597
657
|
},
|
|
598
658
|
op1: function (root) {
|
|
599
|
-
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
659
|
+
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
660
|
+
"a";
|
|
600
661
|
},
|
|
601
662
|
op2: function (root) {
|
|
602
|
-
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
663
|
+
root._properties.children.getAsArray()[0]._properties.stringProperty.value =
|
|
664
|
+
"a";
|
|
603
665
|
},
|
|
604
666
|
compareToSequential: true,
|
|
605
667
|
checkResult: function (conflicts, changeSet) {
|
|
606
668
|
expect(conflicts).to.have.length(1);
|
|
607
669
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
608
|
-
expect(conflicts[0].path).to.be.equal(
|
|
670
|
+
expect(conflicts[0].path).to.be.equal("children[" + node1.getGuid() + "].stringProperty");
|
|
609
671
|
},
|
|
610
672
|
});
|
|
611
673
|
});
|
|
612
|
-
it(
|
|
674
|
+
it("with modify followed by remove+insert should work", function () {
|
|
613
675
|
var node1;
|
|
614
676
|
testRebasing({
|
|
615
677
|
prepare: function (root) {
|
|
616
|
-
node1 = PropertyFactory.create(
|
|
678
|
+
node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
617
679
|
root._properties.children.insert(node1);
|
|
618
680
|
},
|
|
619
681
|
op1: modifyLeaf,
|
|
620
682
|
op2: function (root) {
|
|
621
|
-
var node2 = PropertyFactory.create(
|
|
683
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
622
684
|
node2._properties.guid.value = node1._properties.guid.value;
|
|
623
685
|
root._properties.children.remove(node1);
|
|
624
686
|
root._properties.children.insert(node2);
|
|
@@ -627,19 +689,19 @@ describe('SetProperty', function () {
|
|
|
627
689
|
checkResult: function (conflicts, changeSet) {
|
|
628
690
|
expect(conflicts).to.have.length(1);
|
|
629
691
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.REMOVE_AFTER_MODIFY);
|
|
630
|
-
expect(conflicts[0].path).to.be.equal(
|
|
631
|
-
expect(changeSet[
|
|
692
|
+
expect(conflicts[0].path).to.be.equal("children[" + node1.getGuid() + "]");
|
|
693
|
+
expect(changeSet["set<NamedProperty>"].children).to.have.all.keys("remove", "insert");
|
|
632
694
|
},
|
|
633
695
|
});
|
|
634
696
|
});
|
|
635
|
-
it(
|
|
636
|
-
var node1 = PropertyFactory.create(
|
|
697
|
+
it("with remove+insert followed by modify should report conflict", function () {
|
|
698
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
637
699
|
testRebasing({
|
|
638
700
|
prepare: function (root) {
|
|
639
701
|
root._properties.children.insert(node1);
|
|
640
702
|
},
|
|
641
703
|
op1: function (root) {
|
|
642
|
-
var node2 = PropertyFactory.create(
|
|
704
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
643
705
|
node2._properties.guid.value = node1._properties.guid.value;
|
|
644
706
|
root._properties.children.remove(node1);
|
|
645
707
|
root._properties.children.insert(node2);
|
|
@@ -649,14 +711,14 @@ describe('SetProperty', function () {
|
|
|
649
711
|
checkResult: function (conflicts, changeSet) {
|
|
650
712
|
expect(conflicts).to.have.length(1);
|
|
651
713
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT);
|
|
652
|
-
expect(conflicts[0].path).to.be.equal(
|
|
714
|
+
expect(conflicts[0].path).to.be.equal("children[" + node1.getGuid() + "]");
|
|
653
715
|
},
|
|
654
716
|
});
|
|
655
717
|
});
|
|
656
|
-
it(
|
|
657
|
-
var node = PropertyFactory.create(
|
|
658
|
-
var node1 = PropertyFactory.create(
|
|
659
|
-
var node2 = PropertyFactory.create(
|
|
718
|
+
it("with remove+insert followed by remove+insert should report conflict", function () {
|
|
719
|
+
var node = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
720
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
721
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
660
722
|
node1._properties.guid.value = node._properties.guid.value;
|
|
661
723
|
node2._properties.guid.value = node._properties.guid.value;
|
|
662
724
|
testRebasing({
|
|
@@ -673,17 +735,16 @@ describe('SetProperty', function () {
|
|
|
673
735
|
checkResult: function (conflicts, changeSet) {
|
|
674
736
|
expect(conflicts).to.have.length(1);
|
|
675
737
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
676
|
-
expect(conflicts[0].path).to.be.equal(
|
|
738
|
+
expect(conflicts[0].path).to.be.equal("children[" + node.getGuid() + "]");
|
|
677
739
|
},
|
|
678
740
|
});
|
|
679
741
|
});
|
|
680
|
-
it(
|
|
681
|
-
var node1 = PropertyFactory.create(
|
|
682
|
-
var node2 = PropertyFactory.create(
|
|
742
|
+
it("with conflicting inserts should report conflict", function () {
|
|
743
|
+
var node1 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
744
|
+
var node2 = PropertyFactory.create("autodesk.tests:TestPropertyID-1.0.0");
|
|
683
745
|
node2._properties.guid.value = node1._properties.guid.value;
|
|
684
746
|
testRebasing({
|
|
685
|
-
prepare: function (root) {
|
|
686
|
-
},
|
|
747
|
+
prepare: function (root) { },
|
|
687
748
|
op1: function (root) {
|
|
688
749
|
root._properties.children.insert(node1);
|
|
689
750
|
},
|
|
@@ -695,7 +756,7 @@ describe('SetProperty', function () {
|
|
|
695
756
|
expect(ChangeSet.isEmptyChangeSet(changeSet)).to.be.ok;
|
|
696
757
|
expect(conflicts).to.have.length(1);
|
|
697
758
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.INSERTED_ENTRY_WITH_SAME_KEY);
|
|
698
|
-
expect(conflicts[0].path).to.be.equal(
|
|
759
|
+
expect(conflicts[0].path).to.be.equal("children[" + node1.getGuid() + "]");
|
|
699
760
|
},
|
|
700
761
|
});
|
|
701
762
|
});
|