Regrouping tests
This commit is contained in:
@@ -3,7 +3,22 @@ goog.provide('ol.test.source.Vector');
|
|||||||
|
|
||||||
describe('ol.source.Vector', function() {
|
describe('ol.source.Vector', function() {
|
||||||
|
|
||||||
var vectorSource, features;
|
var vectorSource;
|
||||||
|
|
||||||
|
describe('#addFeatures()', function() {
|
||||||
|
|
||||||
|
it('works', function() {
|
||||||
|
vectorSource = new ol.source.Vector({
|
||||||
|
projection: ol.Projection.getFromCode('EPSG:4326')
|
||||||
|
});
|
||||||
|
vectorSource.addFeatures([new ol.Feature()]);
|
||||||
|
expect(vectorSource.getFeatures().length).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('#getFeatures()', function() {
|
||||||
|
|
||||||
|
var features;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
features = [
|
features = [
|
||||||
@@ -22,14 +37,6 @@ describe('ol.source.Vector', function() {
|
|||||||
vectorSource.addFeatures(features);
|
vectorSource.addFeatures(features);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has working addFeatures and getFeatures methods', function() {
|
|
||||||
var featuresInSource = vectorSource.getFeatures();
|
|
||||||
expect(featuresInSource.length).toEqual(features.length);
|
|
||||||
expect(featuresInSource).toContain(features[0]);
|
|
||||||
vectorSource.addFeatures([new ol.Feature()]);
|
|
||||||
expect(vectorSource.getFeatures().length).toEqual(features.length + 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
var geomFilter = new ol.filter.Geometry(ol.geom.GeometryType.LINESTRING);
|
var geomFilter = new ol.filter.Geometry(ol.geom.GeometryType.LINESTRING);
|
||||||
var extentFilter = new ol.filter.Extent(new ol.Extent(16, 48, 16.3, 48.3));
|
var extentFilter = new ol.filter.Extent(new ol.Extent(16, 48, 16.3, 48.3));
|
||||||
|
|
||||||
@@ -64,7 +71,8 @@ describe('ol.source.Vector', function() {
|
|||||||
expect(subset2.length).toEqual(0);
|
expect(subset2.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can handle any query using the filter\'s evaluate function', function() {
|
it('can handle any query using the filter\'s evaluate function',
|
||||||
|
function() {
|
||||||
var filter = new ol.filter.Logical([geomFilter, extentFilter],
|
var filter = new ol.filter.Logical([geomFilter, extentFilter],
|
||||||
ol.filter.LogicalOperator.OR);
|
ol.filter.LogicalOperator.OR);
|
||||||
spyOn(filter, 'evaluate').andCallThrough();
|
spyOn(filter, 'evaluate').andCallThrough();
|
||||||
@@ -73,6 +81,8 @@ describe('ol.source.Vector', function() {
|
|||||||
expect(subset.length).toEqual(8);
|
expect(subset.length).toEqual(8);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
goog.require('ol.Projection');
|
goog.require('ol.Projection');
|
||||||
|
|||||||
Reference in New Issue
Block a user