@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,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(
|
|
9
|
-
const { MSG } = require(
|
|
10
|
-
const _ = require(
|
|
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(
|
|
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:
|
|
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(
|
|
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,
|
|
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,
|
|
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 =
|
|
40
|
+
stringProp.value = "s";
|
|
43
41
|
};
|
|
44
|
-
describe(
|
|
45
|
-
it(
|
|
46
|
-
expect(myStringProp.value).to.equal(
|
|
47
|
-
expect(myStringProp.getValue()).to.equal(
|
|
48
|
-
expect(myStringProp.serialize({
|
|
49
|
-
expect(myStringProp.serialize({
|
|
50
|
-
});
|
|
51
|
-
it(
|
|
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,
|
|
54
|
-
expect(myStringProp.value).to.equal(
|
|
55
|
-
expect(myStringProp.getValue()).to.equal(
|
|
56
|
-
myStringProp.insertRange(2,
|
|
57
|
-
expect(myStringProp.value).to.equal(
|
|
58
|
-
expect(myStringProp.getValue()).to.equal(
|
|
59
|
-
changeSetWithEntries = myStringProp.serialize({
|
|
60
|
-
expect(myStringProp.serialize({
|
|
61
|
-
var CS = myStringProp.serialize({
|
|
62
|
-
expect(CS.insert &&
|
|
63
|
-
|
|
64
|
-
|
|
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(
|
|
70
|
-
expect(myStringProp.getValue()).to.equal(
|
|
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([
|
|
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(
|
|
77
|
-
var deserializedNode = PropertyFactory.create(
|
|
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(
|
|
84
|
+
it("inserting at a bad position should throw an exception", function () {
|
|
89
85
|
expect(function () {
|
|
90
|
-
myStringProp.insertRange(2242,
|
|
86
|
+
myStringProp.insertRange(2242, "x");
|
|
91
87
|
}).to.throw();
|
|
92
88
|
});
|
|
93
|
-
it(
|
|
94
|
-
var testString = PropertyFactory.create(
|
|
95
|
-
testString.value =
|
|
96
|
-
testString.insertRange(0,
|
|
97
|
-
expect(testString.value).to.equal(
|
|
98
|
-
expect(testString.getValue()).to.equal(
|
|
99
|
-
expect(testString.serialize({
|
|
100
|
-
});
|
|
101
|
-
it(
|
|
102
|
-
var testString = PropertyFactory.create(
|
|
103
|
-
testString.value =
|
|
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(
|
|
106
|
-
expect(testString.getValue()).to.equal(
|
|
107
|
-
expect(testString.serialize({
|
|
108
|
-
});
|
|
109
|
-
it(
|
|
110
|
-
var testString = PropertyFactory.create(
|
|
111
|
-
testString.value =
|
|
112
|
-
testString.setRange(1,
|
|
113
|
-
expect(testString.value).to.equal(
|
|
114
|
-
expect(testString.getValue()).to.equal(
|
|
115
|
-
expect(testString.serialize({
|
|
116
|
-
});
|
|
117
|
-
it(
|
|
118
|
-
var testString = PropertyFactory.create(
|
|
119
|
-
testString.value =
|
|
120
|
-
expect(testString.serialize({
|
|
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 =
|
|
123
|
-
expect(testString.serialize({
|
|
124
|
-
testString.insertRange(2,
|
|
125
|
-
expect(testString.serialize({
|
|
126
|
-
});
|
|
127
|
-
it(
|
|
128
|
-
var testString = PropertyFactory.create(
|
|
129
|
-
testString.value =
|
|
130
|
-
expect(testString.get(2)).to.equal(
|
|
131
|
-
});
|
|
132
|
-
it(
|
|
133
|
-
var testString = PropertyFactory.create(
|
|
134
|
-
expect(testString.getFullTypeid()).to.equal(
|
|
135
|
-
});
|
|
136
|
-
it(
|
|
137
|
-
var testString = PropertyFactory.create(
|
|
138
|
-
testString.setValue(
|
|
139
|
-
testString.insert(1,
|
|
140
|
-
expect(testString.getValue()).to.equal(
|
|
141
|
-
});
|
|
142
|
-
it(
|
|
143
|
-
var testString = PropertyFactory.create(
|
|
144
|
-
testString.setValue(
|
|
145
|
-
testString.insertRange(1,
|
|
146
|
-
expect(testString.getValue()).to.equal(
|
|
147
|
-
});
|
|
148
|
-
it(
|
|
149
|
-
testString = PropertyFactory.create(
|
|
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(
|
|
152
|
-
node.insert(
|
|
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(
|
|
165
|
-
var testString = PropertyFactory.create(
|
|
166
|
-
testString.setValue(
|
|
167
|
-
testString.insertRange(1, [
|
|
168
|
-
expect(testString.getValue()).to.equal(
|
|
169
|
-
});
|
|
170
|
-
it(
|
|
171
|
-
var testString = PropertyFactory.create(
|
|
172
|
-
testString.setValue(
|
|
173
|
-
testString.insertRange(1, [
|
|
174
|
-
expect(testString.getValue()).to.equal(
|
|
175
|
-
});
|
|
176
|
-
it(
|
|
177
|
-
var testString = PropertyFactory.create(
|
|
178
|
-
testString.setValue(
|
|
179
|
-
testString.push(
|
|
180
|
-
expect(testString.getValue()).to.equal(
|
|
181
|
-
expect(testString.push(
|
|
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(
|
|
185
|
-
it(
|
|
186
|
-
var testString = PropertyFactory.create(
|
|
187
|
-
testString.setValue(
|
|
188
|
-
expect(testString.getValue()).to.equal(
|
|
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(
|
|
193
|
-
var testString = PropertyFactory.create(
|
|
194
|
-
testString.setValue(
|
|
195
|
-
expect(testString.getEntriesReadOnly()).to.equal(
|
|
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(
|
|
198
|
-
var testString = PropertyFactory.create(
|
|
199
|
-
testString.setValue(
|
|
200
|
-
expect(testString.getIds()).to.deep.equal([
|
|
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(
|
|
203
|
-
var testString = PropertyFactory.create(
|
|
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(
|
|
201
|
+
testString.setValue("AAAAA");
|
|
206
202
|
expect(testString.getLength()).to.equal(5);
|
|
207
203
|
});
|
|
208
|
-
it(
|
|
209
|
-
var testString = PropertyFactory.create(
|
|
210
|
-
testString.setValue(
|
|
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(
|
|
208
|
+
expect(testString.getValue()).to.equal("ABCD");
|
|
213
209
|
});
|
|
214
|
-
it(
|
|
215
|
-
var testString = PropertyFactory.create(
|
|
216
|
-
testString.setValue(
|
|
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(
|
|
219
|
-
expect(testString.remove(1)).to.equal(
|
|
214
|
+
expect(testString.getValue()).to.equal("ABDE");
|
|
215
|
+
expect(testString.remove(1)).to.equal("B");
|
|
220
216
|
});
|
|
221
|
-
it(
|
|
222
|
-
var testString = PropertyFactory.create(
|
|
223
|
-
testString.setValue(
|
|
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(
|
|
226
|
-
expect(testString.removeRange(2, 3)).to.equal(
|
|
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(
|
|
230
|
-
testString.setValue(
|
|
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(
|
|
235
|
-
var testString = PropertyFactory.create(
|
|
236
|
-
testString.setValue(
|
|
237
|
-
testString.set(3,
|
|
238
|
-
expect(testString.getValue()).to.equal(
|
|
239
|
-
});
|
|
240
|
-
it(
|
|
241
|
-
var testString = PropertyFactory.create(
|
|
242
|
-
testString.setValue(
|
|
243
|
-
expect(function () {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
testString.
|
|
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,
|
|
260
|
+
testString.setRange(5, "xxxxxx");
|
|
261
261
|
};
|
|
262
262
|
expect(fn).to.throw();
|
|
263
263
|
});
|
|
264
|
-
it(
|
|
265
|
-
var testString = PropertyFactory.create(
|
|
266
|
-
testString.setValue(
|
|
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(
|
|
268
|
+
testString.setRange("test", "xx");
|
|
269
269
|
};
|
|
270
270
|
expect(fn).to.throw(MSG.NOT_NUMBER);
|
|
271
271
|
});
|
|
272
|
-
it(
|
|
273
|
-
var testString = PropertyFactory.create(
|
|
274
|
-
testString.setValue(
|
|
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(
|
|
277
|
-
expect(testString.shift()).to.equal(
|
|
276
|
+
expect(testString.getValue()).to.equal("BCDEFG");
|
|
277
|
+
expect(testString.shift()).to.equal("B");
|
|
278
278
|
});
|
|
279
|
-
it(
|
|
280
|
-
var testString = PropertyFactory.create(
|
|
281
|
-
testString.setValue(
|
|
282
|
-
testString.unshift(
|
|
283
|
-
expect(testString.getValue()).to.equal(
|
|
284
|
-
expect(testString.unshift(
|
|
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(
|
|
288
|
-
it(
|
|
289
|
-
var t = PropertyFactory.create(
|
|
290
|
-
t.value =
|
|
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,
|
|
293
|
-
expect(t.serialize({
|
|
294
|
-
|
|
292
|
+
t.insert(2, "_test_");
|
|
293
|
+
expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
294
|
+
insert: [[2, "_test_"]],
|
|
295
295
|
});
|
|
296
296
|
});
|
|
297
|
-
it(
|
|
298
|
-
var t = PropertyFactory.create(
|
|
299
|
-
t.value =
|
|
297
|
+
it("Should handle push correctly", function () {
|
|
298
|
+
var t = PropertyFactory.create("String");
|
|
299
|
+
t.value = "test";
|
|
300
300
|
t.cleanDirty();
|
|
301
|
-
t.push(
|
|
302
|
-
expect(t.serialize({
|
|
303
|
-
|
|
301
|
+
t.push("_test_");
|
|
302
|
+
expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
303
|
+
insert: [[4, "_test_"]],
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
|
-
it(
|
|
307
|
-
var t = PropertyFactory.create(
|
|
308
|
-
t.value =
|
|
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,
|
|
311
|
-
expect(t.serialize({
|
|
312
|
-
|
|
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(
|
|
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({
|
|
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(
|
|
349
|
-
var nodeTestProperty = PropertyFactory.create(
|
|
350
|
-
var stringInNodeProperty = PropertyFactory.create(
|
|
351
|
-
nodeTestProperty.insert(
|
|
352
|
-
var mapTestProperty = PropertyFactory.create(
|
|
353
|
-
var stringInMapProperty = PropertyFactory.create(
|
|
354
|
-
mapTestProperty.insert(
|
|
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(
|
|
406
|
+
it("should work for multiple independent inserts", function () {
|
|
410
407
|
testChangeSetSquashing({ callbacks: [insertText, insertText, insertText] });
|
|
411
408
|
});
|
|
412
|
-
it(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
441
|
+
expect(changeset.String.stringProperty).to.have.all.keys("remove");
|
|
445
442
|
},
|
|
446
443
|
});
|
|
447
444
|
});
|
|
448
|
-
it(
|
|
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(
|
|
449
|
+
expect(changeset.String.stringProperty).to.equal("y");
|
|
453
450
|
},
|
|
454
451
|
});
|
|
455
452
|
});
|
|
456
|
-
it(
|
|
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(
|
|
458
|
+
expect(changeset.String.stringProperty).to.equal("s");
|
|
462
459
|
},
|
|
463
460
|
});
|
|
464
461
|
});
|
|
465
|
-
it(
|
|
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(
|
|
466
|
+
expect(changeset.String.stringProperty).to.equal("xs");
|
|
470
467
|
},
|
|
471
468
|
});
|
|
472
469
|
});
|
|
473
|
-
it(
|
|
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(
|
|
474
|
+
expect(changeset.String.stringProperty).to.equal("ys");
|
|
478
475
|
},
|
|
479
476
|
});
|
|
480
477
|
});
|
|
481
|
-
it(
|
|
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(
|
|
482
|
+
expect(changeset.String.stringProperty).to.equal("s");
|
|
486
483
|
},
|
|
487
484
|
});
|
|
488
485
|
});
|
|
489
486
|
});
|
|
490
|
-
describe(
|
|
487
|
+
describe("Rebasing", function () {
|
|
491
488
|
var createPropertyForRebaseTestByTemplate = function () {
|
|
492
|
-
return PropertyFactory.create(
|
|
489
|
+
return PropertyFactory.create("autodesk.tests:SimpleStringTestProperty-1.0.0");
|
|
493
490
|
};
|
|
494
491
|
var createNodePropertyForRebase = function () {
|
|
495
|
-
var nodeTestProperty = PropertyFactory.create(
|
|
496
|
-
var stringInNodeProperty = PropertyFactory.create(
|
|
497
|
-
nodeTestProperty.insert(
|
|
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(
|
|
502
|
-
var stringInNodeProperty = PropertyFactory.create(
|
|
503
|
-
mapTestProperty.insert(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
634
|
+
expect(conflicts[0].path).to.be.equal("stringProperty");
|
|
638
635
|
},
|
|
639
636
|
});
|
|
640
637
|
});
|
|
641
|
-
it(
|
|
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(
|
|
649
|
+
it("with two independent modifies should be possible", function () {
|
|
653
650
|
testRebasing({
|
|
654
651
|
prepare: function (root) {
|
|
655
|
-
root.insertRange(0,
|
|
652
|
+
root.insertRange(0, "ab");
|
|
656
653
|
},
|
|
657
654
|
op1: modifyText,
|
|
658
655
|
op2: function (root) {
|
|
659
|
-
root.setRange(1,
|
|
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(
|
|
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,
|
|
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(
|
|
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(
|
|
677
|
+
expect(conflicts[0].path).to.be.equal("stringProperty");
|
|
681
678
|
},
|
|
682
679
|
});
|
|
683
680
|
});
|
|
684
|
-
it(
|
|
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(
|
|
697
|
-
expect(changeSet.String.stringProperty).to.have.all.keys(
|
|
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(
|
|
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(
|
|
710
|
+
expect(conflicts[0].path).to.be.equal("stringProperty");
|
|
714
711
|
},
|
|
715
712
|
});
|
|
716
713
|
});
|
|
717
|
-
it(
|
|
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(
|
|
723
|
+
expect(conflicts[0].path).to.be.equal("stringProperty");
|
|
727
724
|
},
|
|
728
725
|
});
|
|
729
726
|
});
|
|
730
|
-
it(
|
|
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,
|
|
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,
|
|
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
|
-
|
|
742
|
+
String: { stringProperty: { insert: [[2, "t"]] } },
|
|
746
743
|
});
|
|
747
744
|
},
|
|
748
745
|
});
|
|
749
746
|
});
|
|
750
|
-
it(
|
|
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,
|
|
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,
|
|
760
|
-
p.insertRange(2,
|
|
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({
|
|
766
|
-
|
|
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(
|
|
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(
|
|
780
|
-
expect(changeSet.String.stringProperty).to.be.equal(
|
|
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(
|
|
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(
|
|
794
|
-
expect(changeSet.String.stringProperty).to.be.equal(
|
|
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(
|
|
799
|
+
it("should correctly handle boundary cases", function () {
|
|
799
800
|
var testChangeSet = function (in_CS, in_CS2) {
|
|
800
|
-
var root = PropertyFactory.create(
|
|
801
|
-
var initialString = PropertyFactory.create(
|
|
802
|
-
root.insert(
|
|
803
|
-
initialString.value =
|
|
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: {
|
|
811
|
-
var CS2 = new ChangeSet({
|
|
812
|
-
|
|
813
|
-
|
|
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(
|
|
819
|
-
expect(testChangeSet(CS1.getSerializedChangeSet(), rebasedCS2)).to.equal(
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
850
|
+
expect(prop.get("stringProperty").getValue()).to.equal("");
|
|
843
851
|
});
|
|
844
852
|
});
|
|
845
853
|
//# sourceMappingURL=stringProperty.spec.js.map
|