2gis-maps
Version:
Interactive 2GIS maps API, based on Leaflet
63 lines (56 loc) • 2.31 kB
JavaScript
/*global describe:false, it:false, expect:false */
describe('Polygon', function () {
var polygonPointSet = [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ]
],
innerPoints = [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ]
],
outerPoints = [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ]
];
describe('#inside', function () {
it('should return true if points are inside', function () {
for (var i = 0; i < innerPoints.length; i++) {
expect(DG.PolyUtil.inside(innerPoints[i], {
type: 'Polygon',
coordinates: [polygonPointSet]
})).to.be.equal(true);
}
});
it('should return false if points are outside', function () {
for (var i = 0; i < outerPoints.length; i++) {
expect(DG.PolyUtil.inside(outerPoints[i], {
type: 'Polygon',
coordinates: [polygonPointSet]
})).to.be.equal(false);
}
});
});
});