Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions
+28 -30
View File
@@ -1,9 +1,7 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.events.EventTarget');
goog.require('ol.interaction.Interaction');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_events_EventTarget_ from '../../../../src/ol/events/EventTarget.js';
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
describe('ol.interaction.Interaction', function() {
@@ -11,12 +9,12 @@ describe('ol.interaction.Interaction', function() {
var interaction;
beforeEach(function() {
interaction = new ol.interaction.Interaction({});
interaction = new _ol_interaction_Interaction_({});
});
it('creates a new interaction', function() {
expect(interaction).to.be.a(ol.interaction.Interaction);
expect(interaction).to.be.a(ol.events.EventTarget);
expect(interaction).to.be.a(_ol_interaction_Interaction_);
expect(interaction).to.be.a(_ol_events_EventTarget_);
});
it('creates an active interaction', function() {
@@ -28,14 +26,14 @@ describe('ol.interaction.Interaction', function() {
describe('#getMap()', function() {
it('retrieves the associated map', function() {
var map = new ol.Map({});
var interaction = new ol.interaction.Interaction({});
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('returns null if no map', function() {
var interaction = new ol.interaction.Interaction({});
var interaction = new _ol_interaction_Interaction_({});
expect(interaction.getMap()).to.be(null);
});
@@ -44,14 +42,14 @@ describe('ol.interaction.Interaction', function() {
describe('#setMap()', function() {
it('allows a map to be set', function() {
var map = new ol.Map({});
var interaction = new ol.interaction.Interaction({});
var map = new _ol_Map_({});
var interaction = new _ol_interaction_Interaction_({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('accepts null', function() {
var interaction = new ol.interaction.Interaction({});
var interaction = new _ol_interaction_Interaction_({});
interaction.setMap(null);
expect(interaction.getMap()).to.be(null);
});
@@ -61,62 +59,62 @@ describe('ol.interaction.Interaction', function() {
describe('zoomByDelta()', function() {
it('changes view resolution', function() {
var view = new ol.View({
var view = new _ol_View_({
resolution: 1,
resolutions: [4, 2, 1, 0.5, 0.25]
});
ol.interaction.Interaction.zoomByDelta(view, 1);
_ol_interaction_Interaction_.zoomByDelta(view, 1);
expect(view.getResolution()).to.be(0.5);
ol.interaction.Interaction.zoomByDelta(view, -1);
_ol_interaction_Interaction_.zoomByDelta(view, -1);
expect(view.getResolution()).to.be(1);
ol.interaction.Interaction.zoomByDelta(view, 2);
_ol_interaction_Interaction_.zoomByDelta(view, 2);
expect(view.getResolution()).to.be(0.25);
ol.interaction.Interaction.zoomByDelta(view, -2);
_ol_interaction_Interaction_.zoomByDelta(view, -2);
expect(view.getResolution()).to.be(1);
});
it('changes view resolution and center relative to the anchor', function() {
var view = new ol.View({
var view = new _ol_View_({
center: [0, 0],
resolution: 1,
resolutions: [4, 2, 1, 0.5, 0.25]
});
ol.interaction.Interaction.zoomByDelta(view, 1, [10, 10]);
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]);
expect(view.getCenter()).to.eql([5, 5]);
ol.interaction.Interaction.zoomByDelta(view, -1, [0, 0]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
expect(view.getCenter()).to.eql([10, 10]);
ol.interaction.Interaction.zoomByDelta(view, 2, [0, 0]);
_ol_interaction_Interaction_.zoomByDelta(view, 2, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
ol.interaction.Interaction.zoomByDelta(view, -2, [0, 0]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([10, 10]);
});
it('changes view resolution and center relative to the anchor, while respecting the extent', function() {
var view = new ol.View({
var view = new _ol_View_({
center: [0, 0],
extent: [-2.5, -2.5, 2.5, 2.5],
resolution: 1,
resolutions: [4, 2, 1, 0.5, 0.25]
});
ol.interaction.Interaction.zoomByDelta(view, 1, [10, 10]);
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
ol.interaction.Interaction.zoomByDelta(view, -1, [0, 0]);
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
ol.interaction.Interaction.zoomByDelta(view, 2, [10, 10]);
_ol_interaction_Interaction_.zoomByDelta(view, 2, [10, 10]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
ol.interaction.Interaction.zoomByDelta(view, -2, [0, 0]);
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
expect(view.getCenter()).to.eql([2.5, 2.5]);
});
});