Get rid of ol.FeatureOverlay
This also introduces a wrapX option to the Draw, Modify and Select interaction.
This commit is contained in:
@@ -619,17 +619,19 @@ describe('ol.interaction.Draw', function() {
|
||||
|
||||
describe('#setActive(false)', function() {
|
||||
it('unsets the map from the feature overlay', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
interaction.setActive(false);
|
||||
expect(interaction.overlay_.map_).to.be(null);
|
||||
expect(spy.getCall(0).args[0]).to.be(null);
|
||||
});
|
||||
it('aborts the drawing', function() {
|
||||
interaction.setActive(false);
|
||||
expect(interaction.sketchFeature_).to.be(null);
|
||||
});
|
||||
it('fires change:active', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
var listenerSpy = sinon.spy(function() {
|
||||
// test that the interaction's change:active listener is called first
|
||||
expect(interaction.overlay_.map_).to.be(null);
|
||||
expect(spy.getCall(0).args[0]).to.be(null);
|
||||
});
|
||||
interaction.on('change:active', listenerSpy);
|
||||
interaction.setActive(false);
|
||||
@@ -642,13 +644,15 @@ describe('ol.interaction.Draw', function() {
|
||||
interaction.setActive(false);
|
||||
});
|
||||
it('sets the map into the feature overlay', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
interaction.setActive(true);
|
||||
expect(interaction.overlay_.map_).to.be(map);
|
||||
expect(spy.getCall(0).args[0]).to.be(map);
|
||||
});
|
||||
it('fires change:active', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
var listenerSpy = sinon.spy(function() {
|
||||
// test that the interaction's change:active listener is called first
|
||||
expect(interaction.overlay_.map_).not.to.be(null);
|
||||
expect(spy.getCall(0).args[0]).to.be(map);
|
||||
});
|
||||
interaction.on('change:active', listenerSpy);
|
||||
interaction.setActive(true);
|
||||
@@ -682,8 +686,9 @@ describe('ol.interaction.Draw', function() {
|
||||
});
|
||||
describe('#setMap(null) when interaction is active', function() {
|
||||
it('unsets the map from the feature overlay', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
interaction.setMap(null);
|
||||
expect(interaction.overlay_.map_).to.be(null);
|
||||
expect(spy.getCall(0).args[0]).to.be(null);
|
||||
});
|
||||
it('aborts the drawing', function() {
|
||||
interaction.setMap(null);
|
||||
@@ -695,15 +700,17 @@ describe('ol.interaction.Draw', function() {
|
||||
describe('#setMap(map)', function() {
|
||||
describe('#setMap(map) when interaction is active', function() {
|
||||
it('sets the map into the feature overlay', function() {
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
interaction.setMap(map);
|
||||
expect(interaction.overlay_.map_).to.be(map);
|
||||
expect(spy.getCall(0).args[0]).to.be(map);
|
||||
});
|
||||
});
|
||||
describe('#setMap(map) when interaction is not active', function() {
|
||||
it('does not set the map into the feature overlay', function() {
|
||||
interaction.setActive(false);
|
||||
var spy = sinon.spy(interaction.overlay_, 'setMap');
|
||||
interaction.setMap(map);
|
||||
expect(interaction.overlay_.map_).to.be(null);
|
||||
expect(spy.getCall(0).args[0]).to.be(null);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user