Fix typo, add test

This commit is contained in:
Andreas Hocevar
2021-04-01 08:38:29 +02:00
parent a01893b275
commit 59d686d104
2 changed files with 13 additions and 1 deletions

View File

@@ -653,7 +653,7 @@ class VectorSource extends Source {
}
/**
* Get all snapshot of the features currently on the source in random order. The returned array
* Get a snapshot of the features currently on the source in random order. The returned array
* is a copy, the features are references to the features in the source.
* @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api

View File

@@ -143,6 +143,18 @@ describe('ol.source.Vector', function () {
expect(feature).to.be(features[0]);
});
});
describe('#getFeatures', function () {
it('does not return the internal array when useSpatialIndex is false', function () {
const noSpatialIndexSource = new VectorSource({
useSpatialIndex: false,
features: vectorSource.getFeatures(),
});
expect(noSpatialIndexSource.getFeatures()).to.not.be(
noSpatialIndexSource.getFeaturesCollection().getArray()
);
});
});
});
describe('clear and refresh', function () {