Skip to content

Commit 4d36a8a

Browse files
committed
【fix】修复测试,feature.properties没有ID了,使用feature.id review by liqian
1 parent 492a478 commit 4d36a8a

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

examples/leaflet/02_editFeatures.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
var deleteParams = new SuperMap.EditFeaturesParameters({
188188
dataSourceName: "World",
189189
dataSetName: "Capitals",
190-
IDs: [e.layer.feature.properties.ID],
190+
IDs: [e.layer.feature.id],
191191
editType: "delete"
192192
});
193193
featureService.editFeatures(deleteParams, function (serviceResult) {

examples/mapboxgl/02_editFeatures.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_editSingle"></h5><
248248
var deleteParams = new SuperMap.EditFeaturesParameters({
249249
dataSourceName: "World",
250250
dataSetName: "Capitals",
251-
IDs: [e.features[0].properties.ID],
251+
IDs: [e.features[0].id],
252252
editType: "delete"
253253
});
254254

examples/openlayers/02_editFeatures.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_editSingle"></h5><
317317
map.forEachFeatureAtPixel(e.pixel, function (feature) {
318318
//只删选中第一个要素:
319319
if (!deletedId) {
320-
deletedId = feature.getProperties().ID;
320+
deletedId = feature.getId();
321321
var deleteParams = new SuperMap.EditFeaturesParameters({
322322
dataSourceName: "World",
323323
dataSetName: "Capitals",

test/common/iServer/FindMTSPPathsServiceSpec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ describe('FindMTSPPathsService', () => {
6565
expect(analystResult[0].edgeFeatures.features).not.toBeNull();
6666
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
6767
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
68-
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(4786);
68+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(4786);
6969
expect(analystResult[0].nodeFeatures).not.toBeNull();
70-
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(1575);
70+
expect(analystResult[0].nodeFeatures.features[0].is-disabled).toEqual(1575);
7171
expect(analystResult[0].pathGuideItems).not.toBeNull();
7272
expect(analystResult[0].route).not.toBeNull();
7373
findMTSPPathsService.destroy();
@@ -134,9 +134,9 @@ describe('FindMTSPPathsService', () => {
134134
expect(analystResult[0].edgeFeatures.features).not.toBeNull();
135135
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
136136
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
137-
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(4786);
137+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(4786);
138138
expect(analystResult[0].nodeFeatures).not.toBeNull();
139-
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(1575);
139+
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(1575);
140140
expect(analystResult[0].pathGuideItems).not.toBeNull();
141141
expect(analystResult[0].route).not.toBeNull();
142142
findMTSPPathsService.destroy();
@@ -199,9 +199,9 @@ describe('FindMTSPPathsService', () => {
199199
expect(analystResult[0].edgeFeatures.features).not.toBeNull();
200200
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
201201
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
202-
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(4786);
202+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(4786);
203203
expect(analystResult[0].nodeFeatures).not.toBeNull();
204-
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(1575);
204+
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(1575);
205205
expect(analystResult[0].route).not.toBeNull();
206206
findMTSPPathsService.destroy();
207207
expect(findMTSPPathsService.EVENT_TYPES).toBeNull();

test/common/iServer/FindPathServiceSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ describe('FindPathService', () => {
6969
expect(analystResult[0].edgeFeatures.features).not.toBeNull();
7070
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
7171
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
72-
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(4786);
72+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(4786);
7373
expect(analystResult[0].nodeFeatures).not.toBeNull();
74-
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(1575);
74+
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(1575);
7575
expect(analystResult[0].pathGuideItems).not.toBeNull();
7676
expect(analystResult[0].route).not.toBeNull();
7777
findPathService.destroy();

test/common/iServer/FindTSPPathsServiceSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('FindTSPPathsService', () => {
7272
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(6569);
7373
expect(analystResult[0].edgeFeatures.features[0].geometry.type).toBe("LineString");
7474
expect(analystResult[0].edgeFeatures.features[0].geometry.coordinates.length).toBeGreaterThan(0);
75-
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(6569);
75+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(6569);
7676
expect(analystResult[0].nodeFeatures).not.toBeNull();
7777
expect(analystResult[0].nodeFeatures.type).toEqual("FeatureCollection");
7878
expect(analystResult[0].nodeFeatures.features).not.toBeNull();
@@ -86,7 +86,7 @@ describe('FindTSPPathsService', () => {
8686
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(1575);
8787
expect(analystResult[0].nodeFeatures.features[0].geometry.type).toBe("Point");
8888
expect(analystResult[0].nodeFeatures.features[0].geometry.coordinates.length).toBeGreaterThan(0);
89-
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(1575);
89+
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(1575);
9090
expect(analystResult[0].pathGuideItems).not.toBeNull();
9191
expect(analystResult[0].pathGuideItems.type).toBe("FeatureCollection");
9292
expect(analystResult[0].pathGuideItems.features.length).toBeGreaterThan(0);

test/leaflet/widgets/dataservicequery/DataServiceQueryViewSpec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ describe('leaflet_DataServiceQuery_DataServiceQueryView', () => {
6161
expect(serviceResult.features).not.toBeNull();
6262
expect(serviceResult.features.length).toBe(3);
6363
let features = serviceResult.features;
64-
expect(features[0].properties.ID).toBe(1);
65-
expect(features[1].properties.ID).toBe(2);
66-
expect(features[2].properties.ID).toBe(3);
64+
expect(features[0].id).toBe(1);
65+
expect(features[1].id).toBe(2);
66+
expect(features[2].id).toBe(3);
6767
done();
6868
} catch (exception) {
6969
console.log("'getFeatureByID'案例失败:" + exception.name + ":" + exception.message);
@@ -95,7 +95,7 @@ describe('leaflet_DataServiceQuery_DataServiceQueryView', () => {
9595
expect(serviceResult.features).not.toBeNull();
9696
expect(serviceResult.features.length).toBe(1);
9797
let features = serviceResult.features;
98-
expect(features[0].properties.ID).toBe(1);
98+
expect(features[0].id).toBe(1);
9999
done();
100100
} catch (exception) {
101101
console.log("'getFeatureBySQL'案例失败:" + exception.name + ":" + exception.message);

test/mapboxgl/services/SurfaceAnalysisSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ describe('mapboxgl_SpatialAnalystService_surfaceAnalysis', () => {
6060
var features = serviceResult.result.recordset.features.features;
6161
expect(features.length).toEqual(1);
6262
expect(features[0].id).toEqual(2);
63-
expect(features[0].properties.ID).toEqual(2);
64-
expect(features[0].properties.ID).toEqual(2);
63+
expect(features[0].id).toEqual(2);
64+
expect(features[0].id).toEqual(2);
6565
expect(features[0].type).toEqual("Feature");
6666
expect(features[0].geometry.type).toEqual("LineString");
6767
expect(features[0].geometry.coordinates.length).toEqual(7);

test/openlayers/services/GetFeaturesByGeometrySpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('openlayers_FeatureService_getFeaturesByGeometry', () => {
5151
expect(features[i].id).not.toBeNull();
5252
expect(features[i].type).toEqual("Feature");
5353
expect(features[i].properties).not.toBeNull();
54-
expect(features[i].properties.ID).toEqual(features[i].id);
54+
expect(features[i].id).toEqual(features[i].id);
5555
expect(features[i].geometry.type).toEqual("MultiPolygon");
5656
expect(features[i].geometry.coordinates[0][0].length).toBeGreaterThan(0);
5757
for (var j = 0; j < features[i].geometry.coordinates[0][0].length; j++) {

0 commit comments

Comments
 (0)