Skip to content

Commit 6b1f8c3

Browse files
committed
【fix】UT
1 parent d6c95af commit 6b1f8c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/common/commontypes/geometry/LinearRing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class LinearRing extends LineString {
4343
components = [components];
4444
}
4545
let len = components.length;
46-
if (components[0].equals(components[components.length - 1])) {
46+
if (len > 1 && components[0].equals(components[components.length - 1])) {
4747
len = components.length - 1;
4848
}
4949
for (var i = 0; i < len; i++) {

test/openlayers/core/UtilSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('openlayers_Util', () => {
116116
var lineString = polygon.components[0];
117117
expect(lineString instanceof LinearRing).toBeTruthy();
118118
expect(lineString.components).not.toBeNull();
119-
expect(lineString.components.length).toBe(3);
119+
expect(lineString.components.length).toBe(4);
120120
var point = lineString.components[0];
121121
expect(point instanceof Point).toBeTruthy();
122122
expect(point.x).toBe(-2);

0 commit comments

Comments
 (0)