Move the nullFunction to ol/functions

And rename it to `UNDEFINED`.
This commit is contained in:
Frederic Junod
2018-03-01 10:52:23 +01:00
parent a30d9a41b8
commit b50a47114e
21 changed files with 72 additions and 63 deletions

View File

@@ -1,4 +1,4 @@
import {nullFunction} from '../../../../src/ol/index.js';
import {UNDEFINED} from '../../../../src/ol/functions.js';
import {getListeners} from '../../../../src/ol/events.js';
import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js';
@@ -77,7 +77,7 @@ describe('ol.renderer.vector', function() {
const imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image');
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
const drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(nullFunction);
const drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false);
@@ -90,7 +90,7 @@ describe('ol.renderer.vector', function() {
const imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image');
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
const drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(nullFunction);
const drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false);
@@ -104,7 +104,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString');
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(nullFunction);
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -119,7 +119,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString');
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(nullFunction);
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -135,7 +135,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon');
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(nullFunction);
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -151,7 +151,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon');
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(nullFunction);
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(UNDEFINED);
renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);

View File

@@ -1,4 +1,4 @@
import {nullFunction} from '../../../../src/ol/index.js';
import {UNDEFINED} from '../../../../src/ol/functions.js';
import {listen} from '../../../../src/ol/events.js';
import {iconImageCache} from '../../../../src/ol/style.js';
import IconImage from '../../../../src/ol/style/IconImage.js';
@@ -42,13 +42,13 @@ describe('ol.style.IconImageCache', function() {
src = '0';
iconImage = new IconImage(null, src);
listen(iconImage, 'change', nullFunction, false);
listen(iconImage, 'change', UNDEFINED, false);
iconImageCache.set(src, null, null, iconImage);
expect(iconImageCache.cacheSize_).to.eql(4);
src = '4';
iconImage = new IconImage(null, src);
listen(iconImage, 'change', nullFunction, false);
listen(iconImage, 'change', UNDEFINED, false);
iconImageCache.set(src, null, null, iconImage);
expect(iconImageCache.cacheSize_).to.eql(5);