@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
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
* described in /src/properties/enumProperty.js
|
|
8
8
|
*/
|
|
9
9
|
var PropertyFactory, TestEnumTemplate, TestInlineEnumTemplate, TestEnumArrayTemplate, BaseProperty, ChangeSet, TestBaseContainingEnumTemplate, MSG, deepCopy, _;
|
|
10
|
-
describe(
|
|
10
|
+
describe("Test EnumProperty", function () {
|
|
11
11
|
/**
|
|
12
12
|
* Get all the objects we need in this test here.
|
|
13
13
|
*/
|
|
14
14
|
before(function () {
|
|
15
|
-
PropertyFactory = require(
|
|
16
|
-
BaseProperty = require(
|
|
17
|
-
ChangeSet = require(
|
|
18
|
-
MSG = require(
|
|
19
|
-
_ = require(
|
|
15
|
+
PropertyFactory = require("../..").PropertyFactory;
|
|
16
|
+
BaseProperty = require("../..").BaseProperty;
|
|
17
|
+
ChangeSet = require("@fluid-experimental/property-changeset").ChangeSet;
|
|
18
|
+
MSG = require("@fluid-experimental/property-common").constants.MSG;
|
|
19
|
+
_ = require("lodash");
|
|
20
20
|
deepCopy = _.cloneDeep;
|
|
21
21
|
// the following templates are copies from the specification
|
|
22
22
|
// disableling the single quote rule to keep exact copies
|
|
@@ -60,8 +60,16 @@ describe('Test EnumProperty', function () {
|
|
|
60
60
|
typeid: "Enum",
|
|
61
61
|
properties: [
|
|
62
62
|
{ id: "A", value: 0, annotation: { description: "The Letter A." } },
|
|
63
|
-
{
|
|
64
|
-
|
|
63
|
+
{
|
|
64
|
+
id: "B",
|
|
65
|
+
value: 76596785,
|
|
66
|
+
annotation: { description: "The Letter B." },
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "C",
|
|
70
|
+
value: -199999,
|
|
71
|
+
annotation: { description: "The Letter C." },
|
|
72
|
+
},
|
|
65
73
|
],
|
|
66
74
|
},
|
|
67
75
|
],
|
|
@@ -70,28 +78,35 @@ describe('Test EnumProperty', function () {
|
|
|
70
78
|
};
|
|
71
79
|
PropertyFactory._reregister(TestInlineEnumTemplate);
|
|
72
80
|
TestBaseContainingEnumTemplate = {
|
|
73
|
-
typeid:
|
|
74
|
-
properties: [
|
|
75
|
-
|
|
81
|
+
typeid: "autodesk.core:CustomWithEnumID-1.0.0",
|
|
82
|
+
properties: [
|
|
83
|
+
{
|
|
84
|
+
id: "MyEnum",
|
|
85
|
+
typeid: "autodesk.core:UnitsEnum-1.0.0",
|
|
76
86
|
},
|
|
77
87
|
],
|
|
78
88
|
};
|
|
79
89
|
PropertyFactory._reregister(TestBaseContainingEnumTemplate);
|
|
80
90
|
TestEnumArrayTemplate = {
|
|
81
|
-
typeid:
|
|
82
|
-
properties: [
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
typeid: "autodesk.core:EnumArrayTestID-1.0.0",
|
|
92
|
+
properties: [
|
|
93
|
+
{
|
|
94
|
+
id: "MyEnumArray",
|
|
95
|
+
typeid: "autodesk.core:UnitsEnum-1.0.0",
|
|
96
|
+
context: "array",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
85
99
|
};
|
|
86
100
|
PropertyFactory._reregister(TestEnumArrayTemplate);
|
|
87
101
|
});
|
|
88
|
-
it(
|
|
102
|
+
it("@bugFix should not modify the registered template", function () {
|
|
89
103
|
let enumTemplate = {
|
|
90
104
|
typeid: "autodesk.core:testEnum-1.0.0",
|
|
91
105
|
annotation: { description: "The metric units" },
|
|
92
|
-
properties: [
|
|
106
|
+
properties: [
|
|
107
|
+
{
|
|
93
108
|
typeid: "Enum",
|
|
94
|
-
id:
|
|
109
|
+
id: "preset",
|
|
95
110
|
properties: [
|
|
96
111
|
{ id: "m", value: 1, annotation: { description: "meter" } },
|
|
97
112
|
{ id: "cm", value: 2, annotation: { description: "centimeter" } },
|
|
@@ -105,79 +120,79 @@ describe('Test EnumProperty', function () {
|
|
|
105
120
|
expect(copyOfTemplate).to.deep.equal(enumTemplate);
|
|
106
121
|
expect(PropertyFactory.getTemplate(copyOfTemplate.typeid).serialize()).to.deep.equal(copyOfTemplate);
|
|
107
122
|
});
|
|
108
|
-
it(
|
|
109
|
-
var enumProp = PropertyFactory.create(
|
|
110
|
-
enumProp.setEnumByString(
|
|
123
|
+
it("should correctly set/get the Enum values", function () {
|
|
124
|
+
var enumProp = PropertyFactory.create("autodesk.core:UnitsEnum-1.0.0");
|
|
125
|
+
enumProp.setEnumByString("cm");
|
|
111
126
|
expect(enumProp.getValue()).to.equal(2);
|
|
112
|
-
expect(enumProp.getEnumString()).to.equal(
|
|
113
|
-
enumProp.setEnumByString(
|
|
127
|
+
expect(enumProp.getEnumString()).to.equal("cm");
|
|
128
|
+
enumProp.setEnumByString("mm");
|
|
114
129
|
expect(enumProp.getValue()).to.equal(3);
|
|
115
|
-
expect(enumProp.getEnumString()).to.equal(
|
|
116
|
-
var enumInlineProp = PropertyFactory.create(
|
|
130
|
+
expect(enumProp.getEnumString()).to.equal("mm");
|
|
131
|
+
var enumInlineProp = PropertyFactory.create("Adsk.Core:UI.Border-1.0.0");
|
|
117
132
|
var inlinedEnum = enumInlineProp._properties.lineType;
|
|
118
133
|
inlinedEnum.setEnumByString("solid");
|
|
119
134
|
expect(inlinedEnum.getValue()).to.equal(100);
|
|
120
|
-
expect(inlinedEnum.getEnumString()).to.equal(
|
|
135
|
+
expect(inlinedEnum.getEnumString()).to.equal("solid");
|
|
121
136
|
var secondLevelInlineProperty = enumInlineProp._properties.style.secondLevelInlineEnum;
|
|
122
|
-
secondLevelInlineProperty.setEnumByString(
|
|
137
|
+
secondLevelInlineProperty.setEnumByString("B");
|
|
123
138
|
expect(secondLevelInlineProperty.getValue()).to.equal(76596785);
|
|
124
|
-
expect(secondLevelInlineProperty.getEnumString()).to.equal(
|
|
139
|
+
expect(secondLevelInlineProperty.getEnumString()).to.equal("B");
|
|
125
140
|
enumInlineProp._properties.style.thickness.value = 5;
|
|
126
141
|
var firstOne = enumInlineProp.serialize();
|
|
127
|
-
var anotherEnumInlineProp = PropertyFactory.create(
|
|
142
|
+
var anotherEnumInlineProp = PropertyFactory.create("Adsk.Core:UI.Border-1.0.0");
|
|
128
143
|
anotherEnumInlineProp.deserialize(firstOne);
|
|
129
144
|
var anotherOne = anotherEnumInlineProp.serialize();
|
|
130
145
|
expect(firstOne).to.deep.equal(anotherOne);
|
|
131
146
|
});
|
|
132
|
-
it(
|
|
133
|
-
var enumProp = PropertyFactory.create(
|
|
147
|
+
it("should throw on setting invalid Enum strings", function () {
|
|
148
|
+
var enumProp = PropertyFactory.create("autodesk.core:UnitsEnum-1.0.0");
|
|
134
149
|
expect(function () {
|
|
135
|
-
enumProp.setEnumByString(
|
|
150
|
+
enumProp.setEnumByString("BadGuy");
|
|
136
151
|
}).to.throw();
|
|
137
152
|
});
|
|
138
|
-
it(
|
|
139
|
-
var enumProp = PropertyFactory.create(
|
|
153
|
+
it("should throw on setting invalid Enum values", function () {
|
|
154
|
+
var enumProp = PropertyFactory.create("autodesk.core:UnitsEnum-1.0.0");
|
|
140
155
|
expect(function () {
|
|
141
156
|
enumProp.setValue(23);
|
|
142
157
|
}).to.throw();
|
|
143
158
|
});
|
|
144
|
-
it(
|
|
145
|
-
var enum1 = PropertyFactory.create(
|
|
159
|
+
it("should correctly squash Enums", function () {
|
|
160
|
+
var enum1 = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
146
161
|
enum1._properties.MyEnum.value = 1;
|
|
147
|
-
var squashedChangeset = new ChangeSet(enum1.serialize({
|
|
162
|
+
var squashedChangeset = new ChangeSet(enum1.serialize({ dirtyOnly: false }));
|
|
148
163
|
enum1._properties.MyEnum.value = 2;
|
|
149
|
-
var changes = enum1.serialize({
|
|
164
|
+
var changes = enum1.serialize({ dirtyOnly: true });
|
|
150
165
|
squashedChangeset.applyChangeSet(changes);
|
|
151
|
-
var serializedChangeset = enum1.serialize({
|
|
166
|
+
var serializedChangeset = enum1.serialize({ dirtyOnly: false });
|
|
152
167
|
expect(serializedChangeset).to.deep.equal(squashedChangeset.getSerializedChangeSet());
|
|
153
168
|
});
|
|
154
|
-
it(
|
|
155
|
-
var enumProp = PropertyFactory.create(
|
|
156
|
-
expect(enumProp.get(
|
|
169
|
+
it("should have a default value that is the lowest valid value", function () {
|
|
170
|
+
var enumProp = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
171
|
+
expect(enumProp.get("MyEnum").value).to.equal(1);
|
|
157
172
|
});
|
|
158
|
-
it(
|
|
159
|
-
var enumProp = PropertyFactory.create(
|
|
160
|
-
expect(enumProp.get(
|
|
173
|
+
it("should have a default value of 0 if 0 is a valid value", function () {
|
|
174
|
+
var enumProp = PropertyFactory.create("Adsk.Core:UI.Border-1.0.0");
|
|
175
|
+
expect(enumProp.get("style").get("secondLevelInlineEnum").value).to.equal(0);
|
|
161
176
|
});
|
|
162
|
-
it(
|
|
163
|
-
var enumProp = PropertyFactory.create(
|
|
164
|
-
var myNode = PropertyFactory.create(
|
|
165
|
-
myNode.insert(
|
|
177
|
+
it("should be possible to dynamically add an Enum to a NodeProperty", function () {
|
|
178
|
+
var enumProp = PropertyFactory.create("autodesk.core:UnitsEnum-1.0.0");
|
|
179
|
+
var myNode = PropertyFactory.create("NodeProperty");
|
|
180
|
+
myNode.insert("myEnum", enumProp);
|
|
166
181
|
myNode._properties.myEnum.value = 2;
|
|
167
|
-
var myNodeCopy = PropertyFactory.create(
|
|
168
|
-
myNodeCopy.deserialize(myNode.serialize({
|
|
182
|
+
var myNodeCopy = PropertyFactory.create("NodeProperty");
|
|
183
|
+
myNodeCopy.deserialize(myNode.serialize({ dirtyOnly: false }));
|
|
169
184
|
// test if the dictionary of the copy is initialized correctly
|
|
170
|
-
expect(myNodeCopy._properties.myEnum.getEnumString()).to.equal(
|
|
185
|
+
expect(myNodeCopy._properties.myEnum.getEnumString()).to.equal("cm");
|
|
171
186
|
// test the consitency of the copy
|
|
172
|
-
expect(myNode.serialize({
|
|
187
|
+
expect(myNode.serialize({ dirtyOnly: false })).to.deep.equal(myNodeCopy.serialize({ dirtyOnly: false }));
|
|
173
188
|
});
|
|
174
|
-
it(
|
|
175
|
-
var baseProperty1 = PropertyFactory.create(
|
|
189
|
+
it("should correctly rebase Properties containing Enum values and correctly show conflicts", function () {
|
|
190
|
+
var baseProperty1 = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
176
191
|
// Create two copies of this state
|
|
177
|
-
var baseProperty2 = PropertyFactory.create(
|
|
178
|
-
baseProperty2.deserialize(baseProperty1.serialize({
|
|
179
|
-
var baseProperty3 = PropertyFactory.create(
|
|
180
|
-
baseProperty3.deserialize(baseProperty1.serialize({
|
|
192
|
+
var baseProperty2 = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
193
|
+
baseProperty2.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
194
|
+
var baseProperty3 = PropertyFactory.create("autodesk.core:CustomWithEnumID-1.0.0");
|
|
195
|
+
baseProperty3.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
181
196
|
// Make sure the states are clear
|
|
182
197
|
baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
183
198
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
@@ -187,72 +202,75 @@ describe('Test EnumProperty', function () {
|
|
|
187
202
|
baseProperty1._properties.MyEnum.value = 2;
|
|
188
203
|
baseProperty2._properties.MyEnum.value = 3;
|
|
189
204
|
// Get the ChangeSets
|
|
190
|
-
var changeSet1 = new ChangeSet(baseProperty1.serialize({
|
|
191
|
-
var changeSet2 = baseProperty2.serialize({
|
|
205
|
+
var changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));
|
|
206
|
+
var changeSet2 = baseProperty2.serialize({ dirtyOnly: true });
|
|
192
207
|
// Perform the actual rebase
|
|
193
208
|
var conflicts = [];
|
|
194
209
|
changeSet1._rebaseChangeSet(changeSet2, conflicts);
|
|
195
210
|
// check result
|
|
196
211
|
expect(changeSet1.getSerializedChangeSet()).to.deep.equal({
|
|
197
|
-
|
|
212
|
+
"enum<autodesk.core:UnitsEnum-1.0.0>": {
|
|
198
213
|
MyEnum: 2,
|
|
199
214
|
},
|
|
200
215
|
});
|
|
201
216
|
expect(conflicts).to.have.length(1);
|
|
202
217
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
203
|
-
expect(conflicts[0].path).to.be.equal(
|
|
204
|
-
expect(conflicts[0].conflictingChange[
|
|
218
|
+
expect(conflicts[0].path).to.be.equal("");
|
|
219
|
+
expect(conflicts[0].conflictingChange["enum<autodesk.core:UnitsEnum-1.0.0>"].MyEnum).to.be.equal(2);
|
|
205
220
|
});
|
|
206
|
-
it(
|
|
207
|
-
var enum1 = PropertyFactory.create(
|
|
221
|
+
it("specialized EnumArrayProperty should work correctly", function () {
|
|
222
|
+
var enum1 = PropertyFactory.create("autodesk.core:EnumArrayTestID-1.0.0");
|
|
208
223
|
var enumArray = enum1._properties.MyEnumArray;
|
|
209
|
-
enumArray.insertRange(0, [1,
|
|
210
|
-
enumArray.setRange(2, [
|
|
224
|
+
enumArray.insertRange(0, [1, "cm", "mm", 3]);
|
|
225
|
+
enumArray.setRange(2, ["m"]);
|
|
211
226
|
enumArray.remove(0, 1);
|
|
212
|
-
expect(enumArray.getEnumString(2)).to.equal(
|
|
227
|
+
expect(enumArray.getEnumString(2)).to.equal("mm");
|
|
213
228
|
expect(enumArray.serialize()).to.deep.equal({
|
|
214
|
-
|
|
215
|
-
[0, [2, 1, 3]],
|
|
216
|
-
],
|
|
229
|
+
insert: [[0, [2, 1, 3]]],
|
|
217
230
|
});
|
|
218
231
|
});
|
|
219
|
-
it(
|
|
220
|
-
var enum1 = PropertyFactory.create(
|
|
232
|
+
it(".setRange should throw an error when in_offset is not an integer", function () {
|
|
233
|
+
var enum1 = PropertyFactory.create("autodesk.core:EnumArrayTestID-1.0.0");
|
|
221
234
|
var enumArray = enum1._properties.MyEnumArray;
|
|
222
|
-
enumArray.insertRange(0, [1,
|
|
223
|
-
expect(() => {
|
|
224
|
-
.
|
|
235
|
+
enumArray.insertRange(0, [1, "cm", "mm"]);
|
|
236
|
+
expect(() => {
|
|
237
|
+
enumArray.setRange("test", ["m"]);
|
|
238
|
+
}).to.throw(MSG.NOT_NUMBER);
|
|
225
239
|
});
|
|
226
|
-
it(
|
|
227
|
-
var enum1 = PropertyFactory.create(
|
|
240
|
+
it(".setRange should throw an error when in_array is not an array", function () {
|
|
241
|
+
var enum1 = PropertyFactory.create("autodesk.core:EnumArrayTestID-1.0.0");
|
|
228
242
|
var enumArray = enum1._properties.MyEnumArray;
|
|
229
|
-
enumArray.insertRange(0, [1,
|
|
230
|
-
expect(() => {
|
|
231
|
-
.
|
|
243
|
+
enumArray.insertRange(0, [1, "cm", "mm"]);
|
|
244
|
+
expect(() => {
|
|
245
|
+
enumArray.setRange(2, "m");
|
|
246
|
+
}).to.throw(MSG.IN_ARRAY_NOT_ARRAY + "EnumArrayProperty.setRange");
|
|
232
247
|
});
|
|
233
|
-
it(
|
|
234
|
-
var enum1 = PropertyFactory.create(
|
|
248
|
+
it(".set should throw an error when in_offset is not an integer", function () {
|
|
249
|
+
var enum1 = PropertyFactory.create("autodesk.core:EnumArrayTestID-1.0.0");
|
|
235
250
|
var enumArray = enum1._properties.MyEnumArray;
|
|
236
|
-
enumArray.insertRange(0, [1,
|
|
237
|
-
expect(() => {
|
|
238
|
-
.
|
|
251
|
+
enumArray.insertRange(0, [1, "cm", "mm"]);
|
|
252
|
+
expect(() => {
|
|
253
|
+
enumArray.set("test", "m");
|
|
254
|
+
}).to.throw(MSG.NOT_NUMBER);
|
|
239
255
|
});
|
|
240
|
-
it(
|
|
241
|
-
var enum1 = PropertyFactory.create(
|
|
256
|
+
it(".set should throw an error when in_value is an array", function () {
|
|
257
|
+
var enum1 = PropertyFactory.create("autodesk.core:EnumArrayTestID-1.0.0");
|
|
242
258
|
var enumArray = enum1._properties.MyEnumArray;
|
|
243
|
-
enumArray.insertRange(0, [1,
|
|
244
|
-
expect(() => {
|
|
259
|
+
enumArray.insertRange(0, [1, "cm", "mm"]);
|
|
260
|
+
expect(() => {
|
|
261
|
+
enumArray.set(2, ["m"]);
|
|
262
|
+
}).to.throw(MSG.VALUE_STRING_OR_NUMBER);
|
|
245
263
|
});
|
|
246
|
-
it(
|
|
264
|
+
it("isPrimitiveType should evaluate to true", function () {
|
|
247
265
|
var enum1 = PropertyFactory.create(TestEnumTemplate.typeid);
|
|
248
266
|
expect(enum1.isPrimitiveType()).to.equal(true);
|
|
249
267
|
});
|
|
250
|
-
it(
|
|
251
|
-
var enumProp = PropertyFactory.create(
|
|
268
|
+
it(".getValidEnumList should return expected enum list", function () {
|
|
269
|
+
var enumProp = PropertyFactory.create("autodesk.core:UnitsEnum-1.0.0");
|
|
252
270
|
var enumList = enumProp.getValidEnumList();
|
|
253
|
-
expect(enumList).to.have.nested.property(
|
|
254
|
-
expect(enumList).to.have.nested.property(
|
|
255
|
-
expect(enumList).to.have.nested.property(
|
|
271
|
+
expect(enumList).to.have.nested.property("m.value", 1);
|
|
272
|
+
expect(enumList).to.have.nested.property("cm.value", 2);
|
|
273
|
+
expect(enumList).to.have.nested.property("mm.value", 3);
|
|
256
274
|
});
|
|
257
275
|
});
|
|
258
276
|
//# sourceMappingURL=enumProperty.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumProperty.spec.js","sourceRoot":"","sources":["../../../src/test/properties/enumProperty.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,IAAI,eAAe,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,qBAAqB,EAChF,YAAY,EAAE,SAAS,EAAE,8BAA8B,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAE9E,QAAQ,CAAC,mBAAmB,EAAE;IAC1B;;OAEG;IACH,MAAM,CAAC;QACH,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC;QACnD,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC;QAC7C,SAAS,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC,SAAS,CAAC;QACxE,GAAG,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;QACnE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtB,QAAQ,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QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;QACvE,IAAI,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACxD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test the functions of a EnumProperty object\n * described in /src/properties/enumProperty.js\n */\n\nvar PropertyFactory, TestEnumTemplate, TestInlineEnumTemplate, TestEnumArrayTemplate,\n BaseProperty, ChangeSet, TestBaseContainingEnumTemplate, MSG, deepCopy, _;\n\ndescribe('Test EnumProperty', function() {\n /**\n * Get all the objects we need in this test here.\n */\n before(function() {\n PropertyFactory = require('../..').PropertyFactory;\n BaseProperty = require('../..').BaseProperty;\n ChangeSet = require('@fluid-experimental/property-changeset').ChangeSet;\n MSG = require('@fluid-experimental/property-common').constants.MSG;\n _ = require('lodash');\n deepCopy = _.cloneDeep;\n\n // the following templates are copies from the specification\n // disableling the single quote rule to keep exact copies\n TestEnumTemplate = {\n typeid: \"autodesk.core:UnitsEnum-1.0.0\",\n inherits: \"Enum\",\n annotation: { description: \"The metric units\" },\n properties: [\n { id: \"m\", value: 1, annotation: { description: \"meter\" } },\n { id: \"cm\", value: 2, annotation: { description: \"centimeter\" } },\n { id: \"mm\", value: 3, annotation: { description: \"millimeter\" } },\n ],\n };\n PropertyFactory._reregister(TestEnumTemplate);\n\n // Enums can also be defined in line in a template\n TestInlineEnumTemplate = {\n typeid: \"Adsk.Core:UI.Border-1.0.0\",\n properties: [\n {\n id: \"lineType\",\n typeid: \"Enum\",\n properties: [\n { id: \"solid\", value: 100, annotation: { description: \"solid line\" } },\n { id: \"dashed\", value: 200, annotation: { description: \"dashed line\" } },\n { id: \"dotted\", value: 300, annotation: { description: \"dotted line\" } },\n ],\n },\n {\n id: \"style\",\n properties: [\n {\n id: \"thickness\",\n typeid: \"Uint32\",\n annotation: {\n description: \"border thickness in Pixels\",\n unit: \"Adsk.Core:Units.Imaging-1.0.0\",\n },\n },\n {\n id: \"secondLevelInlineEnum\",\n typeid: \"Enum\",\n properties: [\n { id: \"A\", value: 0, annotation: { description: \"The Letter A.\" } },\n { id: \"B\", value: 76596785, annotation: { description: \"The Letter B.\" } },\n { id: \"C\", value: -199999, annotation: { description: \"The Letter C.\" } },\n ],\n },\n ],\n },\n ],\n };\n\n PropertyFactory._reregister(TestInlineEnumTemplate);\n\n TestBaseContainingEnumTemplate = {\n typeid: 'autodesk.core:CustomWithEnumID-1.0.0',\n properties: [{\n id: 'MyEnum', typeid: 'autodesk.core:UnitsEnum-1.0.0',\n },\n ],\n };\n PropertyFactory._reregister(TestBaseContainingEnumTemplate);\n\n TestEnumArrayTemplate = {\n typeid: 'autodesk.core:EnumArrayTestID-1.0.0',\n properties: [{\n id: 'MyEnumArray', typeid: 'autodesk.core:UnitsEnum-1.0.0', context: 'array',\n }],\n };\n PropertyFactory._reregister(TestEnumArrayTemplate);\n });\n\n it('@bugFix should not modify the registered template', function() {\n let enumTemplate = {\n typeid: \"autodesk.core:testEnum-1.0.0\",\n annotation: { description: \"The metric units\" },\n properties: [{\n typeid: \"Enum\",\n id: 'preset',\n properties: [\n { id: \"m\", value: 1, annotation: { description: \"meter\" } },\n { id: \"cm\", value: 2, annotation: { description: \"centimeter\" } },\n { id: \"mm\", value: 3, annotation: { description: \"millimeter\" } },\n ],\n },\n ],\n };\n let copyOfTemplate = deepCopy(enumTemplate);\n PropertyFactory._reregister(enumTemplate);\n expect(copyOfTemplate).to.deep.equal(enumTemplate);\n expect(PropertyFactory.getTemplate(copyOfTemplate.typeid).serialize()).to.deep.equal(copyOfTemplate);\n });\n\n it('should correctly set/get the Enum values', function() {\n var enumProp = PropertyFactory.create('autodesk.core:UnitsEnum-1.0.0');\n\n enumProp.setEnumByString('cm');\n expect(enumProp.getValue()).to.equal(2);\n expect(enumProp.getEnumString()).to.equal('cm');\n\n enumProp.setEnumByString('mm');\n expect(enumProp.getValue()).to.equal(3);\n expect(enumProp.getEnumString()).to.equal('mm');\n\n var enumInlineProp = PropertyFactory.create('Adsk.Core:UI.Border-1.0.0');\n var inlinedEnum = enumInlineProp._properties.lineType;\n inlinedEnum.setEnumByString(\"solid\");\n expect(inlinedEnum.getValue()).to.equal(100);\n expect(inlinedEnum.getEnumString()).to.equal('solid');\n\n var secondLevelInlineProperty = enumInlineProp._properties.style.secondLevelInlineEnum;\n secondLevelInlineProperty.setEnumByString('B');\n expect(secondLevelInlineProperty.getValue()).to.equal(76596785);\n expect(secondLevelInlineProperty.getEnumString()).to.equal('B');\n\n enumInlineProp._properties.style.thickness.value = 5;\n\n var firstOne = enumInlineProp.serialize();\n var anotherEnumInlineProp = PropertyFactory.create('Adsk.Core:UI.Border-1.0.0');\n anotherEnumInlineProp.deserialize(firstOne);\n var anotherOne = anotherEnumInlineProp.serialize();\n expect(firstOne).to.deep.equal(anotherOne);\n });\n\n it('should throw on setting invalid Enum strings', function() {\n var enumProp = PropertyFactory.create('autodesk.core:UnitsEnum-1.0.0');\n expect(function() {\n enumProp.setEnumByString('BadGuy');\n }).to.throw();\n });\n\n it('should throw on setting invalid Enum values', function() {\n var enumProp = PropertyFactory.create('autodesk.core:UnitsEnum-1.0.0');\n expect(function() {\n enumProp.setValue(23);\n }).to.throw();\n });\n\n it('should correctly squash Enums', function() {\n var enum1 = PropertyFactory.create('autodesk.core:CustomWithEnumID-1.0.0');\n enum1._properties.MyEnum.value = 1;\n var squashedChangeset = new ChangeSet(enum1.serialize({ 'dirtyOnly': false }));\n\n enum1._properties.MyEnum.value = 2;\n var changes = enum1.serialize({ 'dirtyOnly': true });\n squashedChangeset.applyChangeSet(changes);\n\n var serializedChangeset = enum1.serialize({ 'dirtyOnly': false });\n expect(serializedChangeset).to.deep.equal(squashedChangeset.getSerializedChangeSet());\n });\n\n it('should have a default value that is the lowest valid value', function() {\n var enumProp = PropertyFactory.create('autodesk.core:CustomWithEnumID-1.0.0');\n expect(enumProp.get('MyEnum').value).to.equal(1);\n });\n\n it('should have a default value of 0 if 0 is a valid value', function() {\n var enumProp = PropertyFactory.create('Adsk.Core:UI.Border-1.0.0');\n expect(enumProp.get('style').get('secondLevelInlineEnum').value).to.equal(0);\n });\n\n it('should be possible to dynamically add an Enum to a NodeProperty', function() {\n var enumProp = PropertyFactory.create('autodesk.core:UnitsEnum-1.0.0');\n var myNode = PropertyFactory.create('NodeProperty');\n myNode.insert('myEnum', enumProp);\n myNode._properties.myEnum.value = 2;\n var myNodeCopy = PropertyFactory.create('NodeProperty');\n myNodeCopy.deserialize(myNode.serialize({ 'dirtyOnly': false }));\n // test if the dictionary of the copy is initialized correctly\n expect(myNodeCopy._properties.myEnum.getEnumString()).to.equal('cm');\n\n // test the consitency of the copy\n expect(myNode.serialize({ 'dirtyOnly': false })).to.deep.equal(myNodeCopy.serialize({ 'dirtyOnly': false }));\n });\n\n it('should correctly rebase Properties containing Enum values and correctly show conflicts', function() {\n var baseProperty1 = PropertyFactory.create('autodesk.core:CustomWithEnumID-1.0.0');\n\n // Create two copies of this state\n var baseProperty2 = PropertyFactory.create('autodesk.core:CustomWithEnumID-1.0.0');\n baseProperty2.deserialize(baseProperty1.serialize({ 'dirtyOnly': false }));\n var baseProperty3 = PropertyFactory.create('autodesk.core:CustomWithEnumID-1.0.0');\n baseProperty3.deserialize(baseProperty1.serialize({ 'dirtyOnly': false }));\n\n // Make sure the states are clear\n baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |\n BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n baseProperty2.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |\n BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n\n // Apply the operations to the two properties in parallel\n baseProperty1._properties.MyEnum.value = 2;\n baseProperty2._properties.MyEnum.value = 3;\n\n // Get the ChangeSets\n var changeSet1 = new ChangeSet(baseProperty1.serialize({ 'dirtyOnly': true }));\n var changeSet2 = baseProperty2.serialize({ 'dirtyOnly': true });\n\n // Perform the actual rebase\n var conflicts = [];\n changeSet1._rebaseChangeSet(changeSet2, conflicts);\n\n // check result\n expect(changeSet1.getSerializedChangeSet()).to.deep.equal({\n 'enum<autodesk.core:UnitsEnum-1.0.0>': {\n MyEnum: 2,\n },\n });\n expect(conflicts).to.have.length(1);\n expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);\n expect(conflicts[0].path).to.be.equal('');\n expect(conflicts[0].conflictingChange['enum<autodesk.core:UnitsEnum-1.0.0>'].MyEnum).to.be.equal(2);\n });\n\n it('specialized EnumArrayProperty should work correctly', function() {\n var enum1 = PropertyFactory.create('autodesk.core:EnumArrayTestID-1.0.0');\n var enumArray = enum1._properties.MyEnumArray;\n enumArray.insertRange(0, [1, 'cm', 'mm', 3]);\n enumArray.setRange(2, ['m']);\n enumArray.remove(0, 1);\n expect(enumArray.getEnumString(2)).to.equal('mm');\n expect(enumArray.serialize()).to.deep.equal(\n {\n 'insert': [\n [0, [2, 1, 3]],\n ],\n },\n );\n });\n\n it('.setRange should throw an error when in_offset is not an integer', function() {\n var enum1 = PropertyFactory.create('autodesk.core:EnumArrayTestID-1.0.0');\n var enumArray = enum1._properties.MyEnumArray;\n enumArray.insertRange(0, [1, 'cm', 'mm']);\n expect(() => { enumArray.setRange('test', ['m']); })\n .to.throw(MSG.NOT_NUMBER);\n });\n\n it('.setRange should throw an error when in_array is not an array', function() {\n var enum1 = PropertyFactory.create('autodesk.core:EnumArrayTestID-1.0.0');\n var enumArray = enum1._properties.MyEnumArray;\n enumArray.insertRange(0, [1, 'cm', 'mm']);\n expect(() => { enumArray.setRange(2, 'm'); })\n .to.throw(MSG.IN_ARRAY_NOT_ARRAY + 'EnumArrayProperty.setRange');\n });\n\n it('.set should throw an error when in_offset is not an integer', function() {\n var enum1 = PropertyFactory.create('autodesk.core:EnumArrayTestID-1.0.0');\n var enumArray = enum1._properties.MyEnumArray;\n enumArray.insertRange(0, [1, 'cm', 'mm']);\n expect(() => { enumArray.set('test', 'm'); })\n .to.throw(MSG.NOT_NUMBER);\n });\n\n it('.set should throw an error when in_value is an array', function() {\n var enum1 = PropertyFactory.create('autodesk.core:EnumArrayTestID-1.0.0');\n var enumArray = enum1._properties.MyEnumArray;\n enumArray.insertRange(0, [1, 'cm', 'mm']);\n expect(() => { enumArray.set(2, ['m']); }).to.throw(MSG.VALUE_STRING_OR_NUMBER);\n });\n\n it('isPrimitiveType should evaluate to true', function() {\n var enum1 = PropertyFactory.create(TestEnumTemplate.typeid);\n expect(enum1.isPrimitiveType()).to.equal(true);\n });\n\n it('.getValidEnumList should return expected enum list', function() {\n var enumProp = PropertyFactory.create('autodesk.core:UnitsEnum-1.0.0');\n var enumList = enumProp.getValidEnumList();\n expect(enumList).to.have.nested.property('m.value', 1);\n expect(enumList).to.have.nested.property('cm.value', 2);\n expect(enumList).to.have.nested.property('mm.value', 3);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"enumProperty.spec.js","sourceRoot":"","sources":["../../../src/test/properties/enumProperty.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,IAAI,eAAe,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,SAAS,EACT,8BAA8B,EAC9B,GAAG,EACH,QAAQ,EACR,CAAC,CAAC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,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC7C,IAAI,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE;QACxD,IAAI,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;QACvE,IAAI,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACxD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test the functions of a EnumProperty object\n * described in /src/properties/enumProperty.js\n */\n\nvar PropertyFactory,\n\tTestEnumTemplate,\n\tTestInlineEnumTemplate,\n\tTestEnumArrayTemplate,\n\tBaseProperty,\n\tChangeSet,\n\tTestBaseContainingEnumTemplate,\n\tMSG,\n\tdeepCopy,\n\t_;\n\ndescribe(\"Test EnumProperty\", function () {\n\t/**\n\t * Get all the objects we need in this test here.\n\t */\n\tbefore(function () {\n\t\tPropertyFactory = require(\"../..\").PropertyFactory;\n\t\tBaseProperty = require(\"../..\").BaseProperty;\n\t\tChangeSet = require(\"@fluid-experimental/property-changeset\").ChangeSet;\n\t\tMSG = require(\"@fluid-experimental/property-common\").constants.MSG;\n\t\t_ = require(\"lodash\");\n\t\tdeepCopy = _.cloneDeep;\n\n\t\t// the following templates are copies from the specification\n\t\t// disableling the single quote rule to keep exact copies\n\t\tTestEnumTemplate = {\n\t\t\ttypeid: \"autodesk.core:UnitsEnum-1.0.0\",\n\t\t\tinherits: \"Enum\",\n\t\t\tannotation: { description: \"The metric units\" },\n\t\t\tproperties: [\n\t\t\t\t{ id: \"m\", value: 1, annotation: { description: \"meter\" } },\n\t\t\t\t{ id: \"cm\", value: 2, annotation: { description: \"centimeter\" } },\n\t\t\t\t{ id: \"mm\", value: 3, annotation: { description: \"millimeter\" } },\n\t\t\t],\n\t\t};\n\t\tPropertyFactory._reregister(TestEnumTemplate);\n\n\t\t// Enums can also be defined in line in a template\n\t\tTestInlineEnumTemplate = {\n\t\t\ttypeid: \"Adsk.Core:UI.Border-1.0.0\",\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tid: \"lineType\",\n\t\t\t\t\ttypeid: \"Enum\",\n\t\t\t\t\tproperties: [\n\t\t\t\t\t\t{ id: \"solid\", value: 100, annotation: { description: \"solid line\" } },\n\t\t\t\t\t\t{ id: \"dashed\", value: 200, annotation: { description: \"dashed line\" } },\n\t\t\t\t\t\t{ id: \"dotted\", value: 300, annotation: { description: \"dotted line\" } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"style\",\n\t\t\t\t\tproperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"thickness\",\n\t\t\t\t\t\t\ttypeid: \"Uint32\",\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\tdescription: \"border thickness in Pixels\",\n\t\t\t\t\t\t\t\tunit: \"Adsk.Core:Units.Imaging-1.0.0\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"secondLevelInlineEnum\",\n\t\t\t\t\t\t\ttypeid: \"Enum\",\n\t\t\t\t\t\t\tproperties: [\n\t\t\t\t\t\t\t\t{ id: \"A\", value: 0, annotation: { description: \"The Letter A.\" } },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"B\",\n\t\t\t\t\t\t\t\t\tvalue: 76596785,\n\t\t\t\t\t\t\t\t\tannotation: { description: \"The Letter B.\" },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"C\",\n\t\t\t\t\t\t\t\t\tvalue: -199999,\n\t\t\t\t\t\t\t\t\tannotation: { description: \"The Letter C.\" },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\n\t\tPropertyFactory._reregister(TestInlineEnumTemplate);\n\n\t\tTestBaseContainingEnumTemplate = {\n\t\t\ttypeid: \"autodesk.core:CustomWithEnumID-1.0.0\",\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tid: \"MyEnum\",\n\t\t\t\t\ttypeid: \"autodesk.core:UnitsEnum-1.0.0\",\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tPropertyFactory._reregister(TestBaseContainingEnumTemplate);\n\n\t\tTestEnumArrayTemplate = {\n\t\t\ttypeid: \"autodesk.core:EnumArrayTestID-1.0.0\",\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tid: \"MyEnumArray\",\n\t\t\t\t\ttypeid: \"autodesk.core:UnitsEnum-1.0.0\",\n\t\t\t\t\tcontext: \"array\",\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tPropertyFactory._reregister(TestEnumArrayTemplate);\n\t});\n\n\tit(\"@bugFix should not modify the registered template\", function () {\n\t\tlet enumTemplate = {\n\t\t\ttypeid: \"autodesk.core:testEnum-1.0.0\",\n\t\t\tannotation: { description: \"The metric units\" },\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\ttypeid: \"Enum\",\n\t\t\t\t\tid: \"preset\",\n\t\t\t\t\tproperties: [\n\t\t\t\t\t\t{ id: \"m\", value: 1, annotation: { description: \"meter\" } },\n\t\t\t\t\t\t{ id: \"cm\", value: 2, annotation: { description: \"centimeter\" } },\n\t\t\t\t\t\t{ id: \"mm\", value: 3, annotation: { description: \"millimeter\" } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tlet copyOfTemplate = deepCopy(enumTemplate);\n\t\tPropertyFactory._reregister(enumTemplate);\n\t\texpect(copyOfTemplate).to.deep.equal(enumTemplate);\n\t\texpect(PropertyFactory.getTemplate(copyOfTemplate.typeid).serialize()).to.deep.equal(\n\t\t\tcopyOfTemplate,\n\t\t);\n\t});\n\n\tit(\"should correctly set/get the Enum values\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:UnitsEnum-1.0.0\");\n\n\t\tenumProp.setEnumByString(\"cm\");\n\t\texpect(enumProp.getValue()).to.equal(2);\n\t\texpect(enumProp.getEnumString()).to.equal(\"cm\");\n\n\t\tenumProp.setEnumByString(\"mm\");\n\t\texpect(enumProp.getValue()).to.equal(3);\n\t\texpect(enumProp.getEnumString()).to.equal(\"mm\");\n\n\t\tvar enumInlineProp = PropertyFactory.create(\"Adsk.Core:UI.Border-1.0.0\");\n\t\tvar inlinedEnum = enumInlineProp._properties.lineType;\n\t\tinlinedEnum.setEnumByString(\"solid\");\n\t\texpect(inlinedEnum.getValue()).to.equal(100);\n\t\texpect(inlinedEnum.getEnumString()).to.equal(\"solid\");\n\n\t\tvar secondLevelInlineProperty = enumInlineProp._properties.style.secondLevelInlineEnum;\n\t\tsecondLevelInlineProperty.setEnumByString(\"B\");\n\t\texpect(secondLevelInlineProperty.getValue()).to.equal(76596785);\n\t\texpect(secondLevelInlineProperty.getEnumString()).to.equal(\"B\");\n\n\t\tenumInlineProp._properties.style.thickness.value = 5;\n\n\t\tvar firstOne = enumInlineProp.serialize();\n\t\tvar anotherEnumInlineProp = PropertyFactory.create(\"Adsk.Core:UI.Border-1.0.0\");\n\t\tanotherEnumInlineProp.deserialize(firstOne);\n\t\tvar anotherOne = anotherEnumInlineProp.serialize();\n\t\texpect(firstOne).to.deep.equal(anotherOne);\n\t});\n\n\tit(\"should throw on setting invalid Enum strings\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:UnitsEnum-1.0.0\");\n\t\texpect(function () {\n\t\t\tenumProp.setEnumByString(\"BadGuy\");\n\t\t}).to.throw();\n\t});\n\n\tit(\"should throw on setting invalid Enum values\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:UnitsEnum-1.0.0\");\n\t\texpect(function () {\n\t\t\tenumProp.setValue(23);\n\t\t}).to.throw();\n\t});\n\n\tit(\"should correctly squash Enums\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:CustomWithEnumID-1.0.0\");\n\t\tenum1._properties.MyEnum.value = 1;\n\t\tvar squashedChangeset = new ChangeSet(enum1.serialize({ dirtyOnly: false }));\n\n\t\tenum1._properties.MyEnum.value = 2;\n\t\tvar changes = enum1.serialize({ dirtyOnly: true });\n\t\tsquashedChangeset.applyChangeSet(changes);\n\n\t\tvar serializedChangeset = enum1.serialize({ dirtyOnly: false });\n\t\texpect(serializedChangeset).to.deep.equal(squashedChangeset.getSerializedChangeSet());\n\t});\n\n\tit(\"should have a default value that is the lowest valid value\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:CustomWithEnumID-1.0.0\");\n\t\texpect(enumProp.get(\"MyEnum\").value).to.equal(1);\n\t});\n\n\tit(\"should have a default value of 0 if 0 is a valid value\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"Adsk.Core:UI.Border-1.0.0\");\n\t\texpect(enumProp.get(\"style\").get(\"secondLevelInlineEnum\").value).to.equal(0);\n\t});\n\n\tit(\"should be possible to dynamically add an Enum to a NodeProperty\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:UnitsEnum-1.0.0\");\n\t\tvar myNode = PropertyFactory.create(\"NodeProperty\");\n\t\tmyNode.insert(\"myEnum\", enumProp);\n\t\tmyNode._properties.myEnum.value = 2;\n\t\tvar myNodeCopy = PropertyFactory.create(\"NodeProperty\");\n\t\tmyNodeCopy.deserialize(myNode.serialize({ dirtyOnly: false }));\n\t\t// test if the dictionary of the copy is initialized correctly\n\t\texpect(myNodeCopy._properties.myEnum.getEnumString()).to.equal(\"cm\");\n\n\t\t// test the consitency of the copy\n\t\texpect(myNode.serialize({ dirtyOnly: false })).to.deep.equal(\n\t\t\tmyNodeCopy.serialize({ dirtyOnly: false }),\n\t\t);\n\t});\n\n\tit(\"should correctly rebase Properties containing Enum values and correctly show conflicts\", function () {\n\t\tvar baseProperty1 = PropertyFactory.create(\"autodesk.core:CustomWithEnumID-1.0.0\");\n\n\t\t// Create two copies of this state\n\t\tvar baseProperty2 = PropertyFactory.create(\"autodesk.core:CustomWithEnumID-1.0.0\");\n\t\tbaseProperty2.deserialize(baseProperty1.serialize({ dirtyOnly: false }));\n\t\tvar baseProperty3 = PropertyFactory.create(\"autodesk.core:CustomWithEnumID-1.0.0\");\n\t\tbaseProperty3.deserialize(baseProperty1.serialize({ dirtyOnly: false }));\n\n\t\t// Make sure the states are clear\n\t\tbaseProperty1.cleanDirty(\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY |\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\t\tbaseProperty2.cleanDirty(\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY |\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\n\t\t// Apply the operations to the two properties in parallel\n\t\tbaseProperty1._properties.MyEnum.value = 2;\n\t\tbaseProperty2._properties.MyEnum.value = 3;\n\n\t\t// Get the ChangeSets\n\t\tvar changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));\n\t\tvar changeSet2 = baseProperty2.serialize({ dirtyOnly: true });\n\n\t\t// Perform the actual rebase\n\t\tvar conflicts = [];\n\t\tchangeSet1._rebaseChangeSet(changeSet2, conflicts);\n\n\t\t// check result\n\t\texpect(changeSet1.getSerializedChangeSet()).to.deep.equal({\n\t\t\t\"enum<autodesk.core:UnitsEnum-1.0.0>\": {\n\t\t\t\tMyEnum: 2,\n\t\t\t},\n\t\t});\n\t\texpect(conflicts).to.have.length(1);\n\t\texpect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);\n\t\texpect(conflicts[0].path).to.be.equal(\"\");\n\t\texpect(\n\t\t\tconflicts[0].conflictingChange[\"enum<autodesk.core:UnitsEnum-1.0.0>\"].MyEnum,\n\t\t).to.be.equal(2);\n\t});\n\n\tit(\"specialized EnumArrayProperty should work correctly\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:EnumArrayTestID-1.0.0\");\n\t\tvar enumArray = enum1._properties.MyEnumArray;\n\t\tenumArray.insertRange(0, [1, \"cm\", \"mm\", 3]);\n\t\tenumArray.setRange(2, [\"m\"]);\n\t\tenumArray.remove(0, 1);\n\t\texpect(enumArray.getEnumString(2)).to.equal(\"mm\");\n\t\texpect(enumArray.serialize()).to.deep.equal({\n\t\t\tinsert: [[0, [2, 1, 3]]],\n\t\t});\n\t});\n\n\tit(\".setRange should throw an error when in_offset is not an integer\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:EnumArrayTestID-1.0.0\");\n\t\tvar enumArray = enum1._properties.MyEnumArray;\n\t\tenumArray.insertRange(0, [1, \"cm\", \"mm\"]);\n\t\texpect(() => {\n\t\t\tenumArray.setRange(\"test\", [\"m\"]);\n\t\t}).to.throw(MSG.NOT_NUMBER);\n\t});\n\n\tit(\".setRange should throw an error when in_array is not an array\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:EnumArrayTestID-1.0.0\");\n\t\tvar enumArray = enum1._properties.MyEnumArray;\n\t\tenumArray.insertRange(0, [1, \"cm\", \"mm\"]);\n\t\texpect(() => {\n\t\t\tenumArray.setRange(2, \"m\");\n\t\t}).to.throw(MSG.IN_ARRAY_NOT_ARRAY + \"EnumArrayProperty.setRange\");\n\t});\n\n\tit(\".set should throw an error when in_offset is not an integer\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:EnumArrayTestID-1.0.0\");\n\t\tvar enumArray = enum1._properties.MyEnumArray;\n\t\tenumArray.insertRange(0, [1, \"cm\", \"mm\"]);\n\t\texpect(() => {\n\t\t\tenumArray.set(\"test\", \"m\");\n\t\t}).to.throw(MSG.NOT_NUMBER);\n\t});\n\n\tit(\".set should throw an error when in_value is an array\", function () {\n\t\tvar enum1 = PropertyFactory.create(\"autodesk.core:EnumArrayTestID-1.0.0\");\n\t\tvar enumArray = enum1._properties.MyEnumArray;\n\t\tenumArray.insertRange(0, [1, \"cm\", \"mm\"]);\n\t\texpect(() => {\n\t\t\tenumArray.set(2, [\"m\"]);\n\t\t}).to.throw(MSG.VALUE_STRING_OR_NUMBER);\n\t});\n\n\tit(\"isPrimitiveType should evaluate to true\", function () {\n\t\tvar enum1 = PropertyFactory.create(TestEnumTemplate.typeid);\n\t\texpect(enum1.isPrimitiveType()).to.equal(true);\n\t});\n\n\tit(\".getValidEnumList should return expected enum list\", function () {\n\t\tvar enumProp = PropertyFactory.create(\"autodesk.core:UnitsEnum-1.0.0\");\n\t\tvar enumList = enumProp.getValidEnumList();\n\t\texpect(enumList).to.have.nested.property(\"m.value\", 1);\n\t\texpect(enumList).to.have.nested.property(\"cm.value\", 2);\n\t\texpect(enumList).to.have.nested.property(\"mm.value\", 3);\n\t});\n});\n"]}
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview In this file, we will test Float32 object described in /src/properties/float32.js
|
|
7
7
|
*/
|
|
8
|
-
describe(
|
|
8
|
+
describe("Float32", function () {
|
|
9
9
|
var Float32Property;
|
|
10
10
|
/**
|
|
11
11
|
* Get all the objects we need in this test here.
|
|
12
12
|
*/
|
|
13
13
|
before(function () {
|
|
14
|
-
Float32Property = require(
|
|
14
|
+
Float32Property = require("../../properties/floatProperties").Float32Property;
|
|
15
15
|
});
|
|
16
|
-
describe(
|
|
17
|
-
it(
|
|
16
|
+
describe("Checking the value stored in ValueProperty", function () {
|
|
17
|
+
it("should return the same value", function (done) {
|
|
18
18
|
var fp;
|
|
19
19
|
var error;
|
|
20
20
|
const value = 100;
|
|
21
21
|
try {
|
|
22
|
-
fp = new Float32Property({ id:
|
|
22
|
+
fp = new Float32Property({ id: "temperature" });
|
|
23
23
|
fp.setValue(value);
|
|
24
24
|
}
|
|
25
25
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"float32.spec.js","sourceRoot":"","sources":["../../../src/test/properties/float32.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,QAAQ,CAAC,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"float32.spec.js","sourceRoot":"","sources":["../../../src/test/properties/float32.spec.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,QAAQ,CAAC,SAAS,EAAE;IACnB,IAAI,eAAe,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC;QACN,eAAe,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC,eAAe,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,4CAA4C,EAAE;QACtD,EAAE,CAAC,8BAA8B,EAAE,UAAU,IAAI;YAChD,IAAI,EAAE,CAAC;YACP,IAAI,KAAK,CAAC;YACV,MAAM,KAAK,GAAG,GAAG,CAAC;YAClB,IAAI;gBACH,EAAE,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;gBAChD,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACnB;YAAC,OAAO,CAAC,EAAE;gBACX,KAAK,GAAG,CAAC,CAAC;aACV;oBAAS;gBACT,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC9B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAClC,IAAI,EAAE,CAAC;aACP;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test Float32 object described in /src/properties/float32.js\n */\n\ndescribe(\"Float32\", function () {\n\tvar Float32Property;\n\n\t/**\n\t * Get all the objects we need in this test here.\n\t */\n\tbefore(function () {\n\t\tFloat32Property = require(\"../../properties/floatProperties\").Float32Property;\n\t});\n\n\tdescribe(\"Checking the value stored in ValueProperty\", function () {\n\t\tit(\"should return the same value\", function (done) {\n\t\t\tvar fp;\n\t\t\tvar error;\n\t\t\tconst value = 100;\n\t\t\ttry {\n\t\t\t\tfp = new Float32Property({ id: \"temperature\" });\n\t\t\t\tfp.setValue(value);\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t} finally {\n\t\t\t\texpect(fp).to.not.equal(null);\n\t\t\t\texpect(fp.getValue()).to.equal(value);\n\t\t\t\texpect(error).to.equal(undefined);\n\t\t\t\tdone();\n\t\t\t}\n\t\t});\n\t});\n});\n"]}
|