Merge pull request #7918 from fredj/mv_nullFunction

Move the nullFunction to ol/functions
This commit is contained in:
Frédéric Junod
2018-03-01 14:57:13 +01:00
committed by GitHub
21 changed files with 72 additions and 63 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
/** /**
* @module ol/Disposable * @module ol/Disposable
*/ */
import {nullFunction} from './index.js'; import {UNDEFINED} from './functions.js';
/** /**
* Objects that need to clean up after themselves. * Objects that need to clean up after themselves.
@@ -30,5 +30,5 @@ Disposable.prototype.dispose = function() {
* Extension point for disposable objects. * Extension point for disposable objects.
* @protected * @protected
*/ */
Disposable.prototype.disposeInternal = nullFunction; Disposable.prototype.disposeInternal = UNDEFINED;
export default Disposable; export default Disposable;
+3 -2
View File
@@ -2,7 +2,8 @@
* @module ol/View * @module ol/View
*/ */
import {DEFAULT_TILE_SIZE} from './tilegrid/common.js'; import {DEFAULT_TILE_SIZE} from './tilegrid/common.js';
import {inherits, getUid, nullFunction} from './index.js'; import {inherits, getUid} from './index.js';
import {UNDEFINED} from './functions.js';
import {createExtent, none as centerNone} from './centerconstraint.js'; import {createExtent, none as centerNone} from './centerconstraint.js';
import BaseObject from './Object.js'; import BaseObject from './Object.js';
import {createSnapToResolutions, createSnapToPower} from './resolutionconstraint.js'; import {createSnapToResolutions, createSnapToPower} from './resolutionconstraint.js';
@@ -948,7 +949,7 @@ View.prototype.fit = function(geometryOrExtent, opt_options) {
const centerX = centerRotX * cosAngle - centerRotY * sinAngle; const centerX = centerRotX * cosAngle - centerRotY * sinAngle;
const centerY = centerRotY * cosAngle + centerRotX * sinAngle; const centerY = centerRotY * cosAngle + centerRotX * sinAngle;
const center = [centerX, centerY]; const center = [centerX, centerY];
const callback = options.callback ? options.callback : nullFunction; const callback = options.callback ? options.callback : UNDEFINED;
if (options.duration !== undefined) { if (options.duration !== undefined) {
this.animate({ this.animate({
+4 -3
View File
@@ -1,7 +1,8 @@
/** /**
* @module ol/control/Control * @module ol/control/Control
*/ */
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import {UNDEFINED} from '../functions.js';
import MapEventType from '../MapEventType.js'; import MapEventType from '../MapEventType.js';
import BaseObject from '../Object.js'; import BaseObject from '../Object.js';
import {removeNode} from '../dom.js'; import {removeNode} from '../dom.js';
@@ -67,7 +68,7 @@ const Control = function(options) {
/** /**
* @type {function(ol.MapEvent)} * @type {function(ol.MapEvent)}
*/ */
this.render = options.render ? options.render : nullFunction; this.render = options.render ? options.render : UNDEFINED;
if (options.target) { if (options.target) {
this.setTarget(options.target); this.setTarget(options.target);
@@ -118,7 +119,7 @@ Control.prototype.setMap = function(map) {
const target = this.target_ ? const target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent(); this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element); target.appendChild(this.element);
if (this.render !== nullFunction) { if (this.render !== UNDEFINED) {
this.listenerKeys.push(listen(map, this.listenerKeys.push(listen(map,
MapEventType.POSTRENDER, this.render, this)); MapEventType.POSTRENDER, this.render, this));
} }
+4 -3
View File
@@ -1,9 +1,10 @@
/** /**
* @module ol/events/EventTarget * @module ol/events/EventTarget
*/ */
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import Disposable from '../Disposable.js'; import Disposable from '../Disposable.js';
import {unlistenAll} from '../events.js'; import {unlistenAll} from '../events.js';
import {UNDEFINED} from '../functions.js';
import Event from '../events/Event.js'; import Event from '../events/Event.js';
/** /**
@@ -96,7 +97,7 @@ EventTarget.prototype.dispatchEvent = function(event) {
let pendingRemovals = this.pendingRemovals_[type]; let pendingRemovals = this.pendingRemovals_[type];
delete this.pendingRemovals_[type]; delete this.pendingRemovals_[type];
while (pendingRemovals--) { while (pendingRemovals--) {
this.removeEventListener(type, nullFunction); this.removeEventListener(type, UNDEFINED);
} }
delete this.dispatching_[type]; delete this.dispatching_[type];
} }
@@ -147,7 +148,7 @@ EventTarget.prototype.removeEventListener = function(type, listener) {
const index = listeners.indexOf(listener); const index = listeners.indexOf(listener);
if (type in this.pendingRemovals_) { if (type in this.pendingRemovals_) {
// make listener a no-op, and remove later in #dispatchEvent() // make listener a no-op, and remove later in #dispatchEvent()
listeners[index] = nullFunction; listeners[index] = UNDEFINED;
++this.pendingRemovals_[type]; ++this.pendingRemovals_[type];
} else { } else {
listeners.splice(index, 1); listeners.splice(index, 1);
+6 -6
View File
@@ -1,7 +1,7 @@
/** /**
* @module ol/featureloader * @module ol/featureloader
*/ */
import {nullFunction} from './index.js'; import {UNDEFINED} from './functions.js';
import FormatType from './format/FormatType.js'; import FormatType from './format/FormatType.js';
import {parse} from './xml.js'; import {parse} from './xml.js';
@@ -88,11 +88,11 @@ export function loadFeaturesXhr(url, format, success, failure) {
export function xhr(url, format) { export function xhr(url, format) {
return loadFeaturesXhr(url, format, return loadFeaturesXhr(url, format,
/** /**
* @param {Array.<ol.Feature>} features The loaded features. * @param {Array.<ol.Feature>} features The loaded features.
* @param {ol.proj.Projection} dataProjection Data projection. * @param {ol.proj.Projection} dataProjection Data projection.
* @this {ol.source.Vector} * @this {ol.source.Vector}
*/ */
function(features, dataProjection) { function(features, dataProjection) {
this.addFeatures(features); this.addFeatures(features);
}, /* FIXME handle error */ nullFunction); }, /* FIXME handle error */ UNDEFINED);
} }
+7
View File
@@ -17,3 +17,10 @@ export function TRUE() {
export function FALSE() { export function FALSE() {
return false; return false;
} }
/**
* A reusable function, used e.g. as a default for callbacks.
*
* @return {undefined} Nothing.
*/
export function UNDEFINED() {}
-8
View File
@@ -93,14 +93,6 @@ export function inherits(childCtor, parentCtor) {
} }
/**
* A reusable function, used e.g. as a default for callbacks.
*
* @return {undefined} Nothing.
*/
export function nullFunction() {}
/** /**
* Counter for getUid. * Counter for getUid.
* @type {number} * @type {number}
+3 -2
View File
@@ -3,8 +3,9 @@
*/ */
// FIXME draw drag box // FIXME draw drag box
import Event from '../events/Event.js'; import Event from '../events/Event.js';
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import {always, mouseOnly, mouseActionButton} from '../events/condition.js'; import {always, mouseOnly, mouseActionButton} from '../events/condition.js';
import {UNDEFINED} from '../functions.js';
import PointerInteraction from '../interaction/Pointer.js'; import PointerInteraction from '../interaction/Pointer.js';
import RenderBox from '../render/Box.js'; import RenderBox from '../render/Box.js';
@@ -182,7 +183,7 @@ DragBox.prototype.getGeometry = function() {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @protected * @protected
*/ */
DragBox.prototype.onBoxEnd = nullFunction; DragBox.prototype.onBoxEnd = UNDEFINED;
/** /**
+4 -4
View File
@@ -1,8 +1,8 @@
/** /**
* @module ol/interaction/Pointer * @module ol/interaction/Pointer
*/ */
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import {FALSE} from '../functions.js'; import {FALSE, UNDEFINED} from '../functions.js';
import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import Interaction from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
@@ -13,7 +13,7 @@ import {getValues} from '../obj.js';
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {ol.interaction.Pointer} * @this {ol.interaction.Pointer}
*/ */
const handleDragEvent = nullFunction; const handleDragEvent = UNDEFINED;
/** /**
@@ -36,7 +36,7 @@ const handleDownEvent = FALSE;
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {ol.interaction.Pointer} * @this {ol.interaction.Pointer}
*/ */
const handleMoveEvent = nullFunction; const handleMoveEvent = UNDEFINED;
/** /**
+2 -2
View File
@@ -1,7 +1,7 @@
/** /**
* @module ol/render/Feature * @module ol/render/Feature
*/ */
import {nullFunction} from '../index.js'; import {UNDEFINED} from '../functions.js';
import {extend} from '../array.js'; import {extend} from '../array.js';
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js'; import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
@@ -244,7 +244,7 @@ RenderFeature.prototype.getStride = function() {
/** /**
* @return {undefined} * @return {undefined}
*/ */
RenderFeature.prototype.getStyleFunction = nullFunction; RenderFeature.prototype.getStyleFunction = UNDEFINED;
/** /**
+3 -2
View File
@@ -1,7 +1,8 @@
/** /**
* @module ol/render/canvas/Replay * @module ol/render/canvas/Replay
*/ */
import {getUid, inherits, nullFunction} from '../../index.js'; import {getUid, inherits} from '../../index.js';
import {UNDEFINED} from '../../functions.js';
import {equals, reverseSubArray} from '../../array.js'; import {equals, reverseSubArray} from '../../array.js';
import {asColorLike} from '../../colorlike.js'; import {asColorLike} from '../../colorlike.js';
import {buffer, clone, coordinateRelationship, createEmpty, createOrUpdate, import {buffer, clone, coordinateRelationship, createEmpty, createOrUpdate,
@@ -1068,7 +1069,7 @@ CanvasReplay.prototype.endGeometry = function(geometry, feature) {
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
CanvasReplay.prototype.finish = nullFunction; CanvasReplay.prototype.finish = UNDEFINED;
/** /**
+3 -3
View File
@@ -1,13 +1,13 @@
/** /**
* @module ol/renderer/Layer * @module ol/renderer/Layer
*/ */
import {getUid, inherits, nullFunction} from '../index.js'; import {getUid, inherits} from '../index.js';
import ImageState from '../ImageState.js'; import ImageState from '../ImageState.js';
import Observable from '../Observable.js'; import Observable from '../Observable.js';
import TileState from '../TileState.js'; import TileState from '../TileState.js';
import {listen} from '../events.js'; import {listen} from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js'; import {FALSE, UNDEFINED} from '../functions.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
/** /**
@@ -42,7 +42,7 @@ inherits(LayerRenderer, Observable);
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template S,T * @template S,T
*/ */
LayerRenderer.prototype.forEachFeatureAtCoordinate = nullFunction; LayerRenderer.prototype.forEachFeatureAtCoordinate = UNDEFINED;
/** /**
+3 -3
View File
@@ -1,12 +1,12 @@
/** /**
* @module ol/renderer/Map * @module ol/renderer/Map
*/ */
import {getUid, inherits, nullFunction} from '../index.js'; import {getUid, inherits} from '../index.js';
import Disposable from '../Disposable.js'; import Disposable from '../Disposable.js';
import {listen, unlistenByKey} from '../events.js'; import {listen, unlistenByKey} from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {getWidth} from '../extent.js'; import {getWidth} from '../extent.js';
import {TRUE} from '../functions.js'; import {TRUE, UNDEFINED} from '../functions.js';
import {visibleAtResolution} from '../layer/Layer.js'; import {visibleAtResolution} from '../layer/Layer.js';
import {getLayerRendererPlugins} from '../plugins.js'; import {getLayerRendererPlugins} from '../plugins.js';
import {iconImageCache} from '../style.js'; import {iconImageCache} from '../style.js';
@@ -289,7 +289,7 @@ MapRenderer.prototype.removeLayerRendererByKey_ = function(layerKey) {
* Render. * Render.
* @param {?olx.FrameState} frameState Frame state. * @param {?olx.FrameState} frameState Frame state.
*/ */
MapRenderer.prototype.renderFrame = nullFunction; MapRenderer.prototype.renderFrame = UNDEFINED;
/** /**
+3 -2
View File
@@ -1,10 +1,11 @@
/** /**
* @module ol/renderer/canvas/IntermediateCanvas * @module ol/renderer/canvas/IntermediateCanvas
*/ */
import {inherits, nullFunction} from '../../index.js'; import {inherits} from '../../index.js';
import {scale as scaleCoordinate} from '../../coordinate.js'; import {scale as scaleCoordinate} from '../../coordinate.js';
import {createCanvasContext2D} from '../../dom.js'; import {createCanvasContext2D} from '../../dom.js';
import {containsExtent, intersects} from '../../extent.js'; import {containsExtent, intersects} from '../../extent.js';
import {UNDEFINED} from '../../functions.js';
import CanvasLayerRenderer from '../canvas/Layer.js'; import CanvasLayerRenderer from '../canvas/Layer.js';
import {create as createTransform, apply as applyTransform} from '../../transform.js'; import {create as createTransform, apply as applyTransform} from '../../transform.js';
@@ -123,7 +124,7 @@ IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordin
return undefined; return undefined;
} }
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== nullFunction) { if (this.getLayer().getSource().forEachFeatureAtCoordinate !== UNDEFINED) {
// for ImageCanvas sources use the original hit-detection logic, // for ImageCanvas sources use the original hit-detection logic,
// so that for example also transparent polygons are detected // so that for example also transparent polygons are detected
return CanvasLayerRenderer.prototype.forEachLayerAtCoordinate.apply(this, arguments); return CanvasLayerRenderer.prototype.forEachLayerAtCoordinate.apply(this, arguments);
+3 -2
View File
@@ -2,7 +2,8 @@
* @module ol/renderer/webgl/ImageLayer * @module ol/renderer/webgl/ImageLayer
*/ */
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js'; import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import {inherits, nullFunction} from '../../index.js'; import {inherits} from '../../index.js';
import {UNDEFINED} from '../../functions.js';
import LayerType from '../../LayerType.js'; import LayerType from '../../LayerType.js';
import ViewHint from '../../ViewHint.js'; import ViewHint from '../../ViewHint.js';
import {createCanvasContext2D} from '../../dom.js'; import {createCanvasContext2D} from '../../dom.js';
@@ -254,7 +255,7 @@ WebGLImageLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameSta
return undefined; return undefined;
} }
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== nullFunction) { if (this.getLayer().getSource().forEachFeatureAtCoordinate !== UNDEFINED) {
// for ImageCanvas sources use the original hit-detection logic, // for ImageCanvas sources use the original hit-detection logic,
// so that for example also transparent polygons are detected // so that for example also transparent polygons are detected
const coordinate = applyTransform( const coordinate = applyTransform(
+3 -2
View File
@@ -1,7 +1,8 @@
/** /**
* @module ol/source/Source * @module ol/source/Source
*/ */
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import {UNDEFINED} from '../functions.js';
import BaseObject from '../Object.js'; import BaseObject from '../Object.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
@@ -89,7 +90,7 @@ Source.prototype.adaptAttributions_ = function(attributionLike) {
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
Source.prototype.forEachFeatureAtCoordinate = nullFunction; Source.prototype.forEachFeatureAtCoordinate = UNDEFINED;
/** /**
+3 -2
View File
@@ -1,7 +1,8 @@
/** /**
* @module ol/source/Tile * @module ol/source/Tile
*/ */
import {inherits, nullFunction} from '../index.js'; import {inherits} from '../index.js';
import {UNDEFINED} from '../functions.js';
import TileCache from '../TileCache.js'; import TileCache from '../TileCache.js';
import TileState from '../TileState.js'; import TileState from '../TileState.js';
import Event from '../events/Event.js'; import Event from '../events/Event.js';
@@ -303,7 +304,7 @@ TileSource.prototype.refresh = function() {
* @param {number} y Tile coordinate y. * @param {number} y Tile coordinate y.
* @param {ol.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
*/ */
TileSource.prototype.useTile = nullFunction; TileSource.prototype.useTile = UNDEFINED;
/** /**
+3 -3
View File
@@ -2,7 +2,7 @@
* @module ol/source/Vector * @module ol/source/Vector
*/ */
import {getUid, inherits, nullFunction} from '../index.js'; import {getUid, inherits} from '../index.js';
import Collection from '../Collection.js'; import Collection from '../Collection.js';
import CollectionEventType from '../CollectionEventType.js'; import CollectionEventType from '../CollectionEventType.js';
import ObjectEventType from '../ObjectEventType.js'; import ObjectEventType from '../ObjectEventType.js';
@@ -13,7 +13,7 @@ import Event from '../events/Event.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {containsExtent, equals} from '../extent.js'; import {containsExtent, equals} from '../extent.js';
import {xhr} from '../featureloader.js'; import {xhr} from '../featureloader.js';
import {TRUE} from '../functions.js'; import {TRUE, UNDEFINED} from '../functions.js';
import {all as allStrategy} from '../loadingstrategy.js'; import {all as allStrategy} from '../loadingstrategy.js';
import {isEmpty, getValues} from '../obj.js'; import {isEmpty, getValues} from '../obj.js';
import Source from '../source/Source.js'; import Source from '../source/Source.js';
@@ -75,7 +75,7 @@ const VectorSource = function(opt_options) {
* @private * @private
* @type {ol.FeatureLoader} * @type {ol.FeatureLoader}
*/ */
this.loader_ = nullFunction; this.loader_ = UNDEFINED;
/** /**
* @private * @private
+3 -2
View File
@@ -1,7 +1,8 @@
/** /**
* @module ol/style/AtlasManager * @module ol/style/AtlasManager
*/ */
import {WEBGL_MAX_TEXTURE_SIZE, nullFunction} from '../index.js'; import {WEBGL_MAX_TEXTURE_SIZE} from '../index.js';
import {UNDEFINED} from '../functions.js';
import Atlas from '../style/Atlas.js'; import Atlas from '../style/Atlas.js';
@@ -180,7 +181,7 @@ AtlasManager.prototype.add = function(id, width, height,
// the hit-detection atlas, to make sure that the offset is the same for // the hit-detection atlas, to make sure that the offset is the same for
// the original image and the hit-detection image. // the original image and the hit-detection image.
const renderHitCallback = opt_renderHitCallback !== undefined ? const renderHitCallback = opt_renderHitCallback !== undefined ?
opt_renderHitCallback : nullFunction; opt_renderHitCallback : UNDEFINED;
const hitInfo = /** @type {ol.AtlasInfo} */ (this.add_(true, const hitInfo = /** @type {ol.AtlasInfo} */ (this.add_(true,
id, width, height, renderHitCallback, opt_this)); id, width, height, renderHitCallback, opt_this));
+7 -7
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 {getListeners} from '../../../../src/ol/events.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
@@ -77,7 +77,7 @@ describe('ol.renderer.vector', function() {
const imageReplay = replayGroup.getReplay( const imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image'); style.getZIndex(), 'Image');
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle'); 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, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false); expect(setImageStyleSpy.called).to.be(false);
@@ -90,7 +90,7 @@ describe('ol.renderer.vector', function() {
const imageReplay = replayGroup.getReplay( const imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image'); style.getZIndex(), 'Image');
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle'); 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, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false); expect(setImageStyleSpy.called).to.be(false);
@@ -104,7 +104,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString'); style.getZIndex(), 'LineString');
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay, const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle'); 'setFillStrokeStyle');
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(nullFunction); const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(UNDEFINED);
renderFeature(replayGroup, feature, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true); expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -119,7 +119,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString'); style.getZIndex(), 'LineString');
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay, const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle'); 'setFillStrokeStyle');
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(nullFunction); const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(UNDEFINED);
renderFeature(replayGroup, feature, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true); expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -135,7 +135,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon'); style.getZIndex(), 'Polygon');
const setFillStrokeStyleSpy = sinon.spy(polygonReplay, const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle'); 'setFillStrokeStyle');
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(nullFunction); const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(UNDEFINED);
renderFeature(replayGroup, feature, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true); expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -151,7 +151,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon'); style.getZIndex(), 'Polygon');
const setFillStrokeStyleSpy = sinon.spy(polygonReplay, const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle'); 'setFillStrokeStyle');
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(nullFunction); const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(UNDEFINED);
renderFeature(replayGroup, feature, renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis); style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true); expect(setFillStrokeStyleSpy.called).to.be(true);
+3 -3
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 {listen} from '../../../../src/ol/events.js';
import {iconImageCache} from '../../../../src/ol/style.js'; import {iconImageCache} from '../../../../src/ol/style.js';
import IconImage from '../../../../src/ol/style/IconImage.js'; import IconImage from '../../../../src/ol/style/IconImage.js';
@@ -42,13 +42,13 @@ describe('ol.style.IconImageCache', function() {
src = '0'; src = '0';
iconImage = new IconImage(null, src); iconImage = new IconImage(null, src);
listen(iconImage, 'change', nullFunction, false); listen(iconImage, 'change', UNDEFINED, false);
iconImageCache.set(src, null, null, iconImage); iconImageCache.set(src, null, null, iconImage);
expect(iconImageCache.cacheSize_).to.eql(4); expect(iconImageCache.cacheSize_).to.eql(4);
src = '4'; src = '4';
iconImage = new IconImage(null, src); iconImage = new IconImage(null, src);
listen(iconImage, 'change', nullFunction, false); listen(iconImage, 'change', UNDEFINED, false);
iconImageCache.set(src, null, null, iconImage); iconImageCache.set(src, null, null, iconImage);
expect(iconImageCache.cacheSize_).to.eql(5); expect(iconImageCache.cacheSize_).to.eql(5);