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
+20 -22
View File
@@ -1,12 +1,10 @@
goog.require('ol.Map');
goog.require('ol.Tile');
goog.require('ol.View');
goog.require('ol.control.Attribution');
goog.require('ol.layer.Tile');
goog.require('ol.source.Tile');
goog.require('ol.tilegrid');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_Tile_ from '../../../../src/ol/Tile.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_control_Attribution_ from '../../../../src/ol/control/Attribution.js';
import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.control.Attribution', function() {
@@ -15,36 +13,36 @@ describe('ol.control.Attribution', function() {
var target = document.createElement('div');
target.style.width = target.style.height = '100px';
document.body.appendChild(target);
map = new ol.Map({
map = new _ol_Map_({
target: target,
controls: [new ol.control.Attribution({
controls: [new _ol_control_Attribution_({
collapsed: false,
collapsible: false
})],
layers: [
new ol.layer.Tile({
source: new ol.source.Tile({
new _ol_layer_Tile_({
source: new _ol_source_Tile_({
projection: 'EPSG:3857',
tileGrid: ol.tilegrid.createXYZ(),
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'foo'
})
}),
new ol.layer.Tile({
source: new ol.source.Tile({
new _ol_layer_Tile_({
source: new _ol_source_Tile_({
projection: 'EPSG:3857',
tileGrid: ol.tilegrid.createXYZ(),
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'bar'
})
}),
new ol.layer.Tile({
source: new ol.source.Tile({
new _ol_layer_Tile_({
source: new _ol_source_Tile_({
projection: 'EPSG:3857',
tileGrid: ol.tilegrid.createXYZ(),
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'foo'
})
})
],
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
zoom: 0
})
@@ -52,7 +50,7 @@ describe('ol.control.Attribution', function() {
map.getLayers().forEach(function(layer) {
var source = layer.getSource();
source.getTile = function() {
var tile = new ol.Tile([0, 0, -1], 2 /* LOADED */);
var tile = new _ol_Tile_([0, 0, -1], 2 /* LOADED */);
tile.getImage = function() {
var image = new Image();
image.width = 256;
+7 -9
View File
@@ -1,17 +1,15 @@
goog.require('ol.Map');
goog.require('ol.control.Control');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_control_Control_ from '../../../../src/ol/control/Control.js';
describe('ol.control.Control', function() {
var map, control;
beforeEach(function() {
map = new ol.Map({
map = new _ol_Map_({
target: document.createElement('div')
});
var element = document.createElement('DIV');
control = new ol.control.Control({element: element});
control = new _ol_control_Control_({element: element});
control.setMap(map);
});
@@ -35,7 +33,7 @@ describe('ol.control.Control\'s target', function() {
var target = document.createElement('div');
target.id = 'mycontrol';
document.body.appendChild(target);
var ctrl = new ol.control.Control({target: 'mycontrol'});
var ctrl = new _ol_control_Control_({target: 'mycontrol'});
expect(ctrl.target_.id).to.equal('mycontrol');
ctrl.dispose();
target.parentNode.removeChild(target);
@@ -44,13 +42,13 @@ describe('ol.control.Control\'s target', function() {
var target = document.createElement('div');
target.id = 'mycontrol';
document.body.appendChild(target);
var ctrl = new ol.control.Control({target: target});
var ctrl = new _ol_control_Control_({target: target});
expect(ctrl.target_.id).to.equal('mycontrol');
ctrl.dispose();
target.parentNode.removeChild(target);
});
it('ignores non-existing target id', function() {
var ctrl = new ol.control.Control({target: 'doesnotexist'});
var ctrl = new _ol_control_Control_({target: 'doesnotexist'});
expect(ctrl.target_).to.equal(null);
ctrl.dispose();
});
+3 -5
View File
@@ -1,14 +1,12 @@
goog.require('ol.control.FullScreen');
import _ol_control_FullScreen_ from '../../../../src/ol/control/FullScreen.js';
describe('ol.control.FullScreen', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new ol.control.FullScreen();
expect(instance).to.be.an(ol.control.FullScreen);
var instance = new _ol_control_FullScreen_();
expect(instance).to.be.an(_ol_control_FullScreen_);
});
});
+4 -6
View File
@@ -1,20 +1,18 @@
goog.require('ol.control.MousePosition');
import _ol_control_MousePosition_ from '../../../../src/ol/control/MousePosition.js';
describe('ol.control.MousePosition', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new ol.control.MousePosition();
expect(instance).to.be.an(ol.control.MousePosition);
var instance = new _ol_control_MousePosition_();
expect(instance).to.be.an(_ol_control_MousePosition_);
expect(instance.element.className).to.be('ol-mouse-position');
});
it('creates the element with the provided class name', function() {
var className = 'foobar';
var instance = new ol.control.MousePosition({
var instance = new _ol_control_MousePosition_({
className: className
});
expect(instance.element.className).to.be(className);
+15 -17
View File
@@ -1,9 +1,7 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control.Control');
goog.require('ol.control.OverviewMap');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_control_Control_ from '../../../../src/ol/control/Control.js';
import _ol_control_OverviewMap_ from '../../../../src/ol/control/OverviewMap.js';
describe('ol.control.OverviewMap', function() {
var map, target;
@@ -11,7 +9,7 @@ describe('ol.control.OverviewMap', function() {
beforeEach(function() {
target = document.createElement('div');
document.body.appendChild(target);
map = new ol.Map({
map = new _ol_Map_({
target: target
});
});
@@ -25,23 +23,23 @@ describe('ol.control.OverviewMap', function() {
describe('constructor', function() {
it('creates an overview map with the default options', function() {
var control = new ol.control.OverviewMap();
expect(control).to.be.a(ol.control.OverviewMap);
expect(control).to.be.a(ol.control.Control);
var control = new _ol_control_OverviewMap_();
expect(control).to.be.a(_ol_control_OverviewMap_);
expect(control).to.be.a(_ol_control_Control_);
});
});
describe('setMap()', function() {
it('keeps ovmap view rotation in sync with map view rotation', function() {
var view = new ol.View({
var view = new _ol_View_({
center: [0, 0],
zoom: 0,
rotation: 0
});
map.setView(view);
var control = new ol.control.OverviewMap();
var control = new _ol_control_OverviewMap_();
map.addControl(control);
var ovView = control.ovmap_.getView();
expect(ovView.getRotation()).to.be(0);
@@ -51,12 +49,12 @@ describe('ol.control.OverviewMap', function() {
});
it('maintains rotation in sync if view added later', function() {
var control = new ol.control.OverviewMap();
var control = new _ol_control_OverviewMap_();
map.addControl(control);
var ovView = control.ovmap_.getView();
expect(ovView.getRotation()).to.be(0);
var view = new ol.View({
var view = new _ol_View_({
center: [0, 0],
zoom: 0,
rotation: 0
@@ -67,10 +65,10 @@ describe('ol.control.OverviewMap', function() {
});
it('stops listening to old maps', function() {
var control = new ol.control.OverviewMap();
var control = new _ol_control_OverviewMap_();
var ovView = control.ovmap_.getView();
var view = new ol.View({
var view = new _ol_View_({
center: [0, 0],
zoom: 0,
rotation: 0
@@ -88,7 +86,7 @@ describe('ol.control.OverviewMap', function() {
});
it('set target to null', function() {
var control = new ol.control.OverviewMap();
var control = new _ol_control_OverviewMap_();
map.addControl(control);
+3 -5
View File
@@ -1,14 +1,12 @@
goog.require('ol.control.Rotate');
import _ol_control_Rotate_ from '../../../../src/ol/control/Rotate.js';
describe('ol.control.Rotate', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new ol.control.Rotate();
expect(instance).to.be.an(ol.control.Rotate);
var instance = new _ol_control_Rotate_();
expect(instance).to.be.an(_ol_control_Rotate_);
});
});
+47 -47
View File
@@ -1,15 +1,15 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control.ScaleLine');
goog.require('ol.proj');
goog.require('ol.proj.Projection');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_control_ScaleLine_ from '../../../../src/ol/control/ScaleLine.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
describe('ol.control.ScaleLine', function() {
var map;
beforeEach(function() {
var target = document.createElement('div');
document.body.appendChild(target);
map = new ol.Map({
map = new _ol_Map_({
target: target
});
});
@@ -20,8 +20,8 @@ describe('ol.control.ScaleLine', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var ctrl = new ol.control.ScaleLine();
expect(ctrl).to.be.an(ol.control.ScaleLine);
var ctrl = new _ol_control_ScaleLine_();
expect(ctrl).to.be.an(_ol_control_ScaleLine_);
});
});
@@ -29,14 +29,14 @@ describe('ol.control.ScaleLine', function() {
describe('className', function() {
it('defaults to "ol-scale-line"', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
ctrl.setMap(map);
var element = document.querySelector('.ol-scale-line', map.getTarget());
expect(element).to.not.be(null);
expect(element).to.be.a(HTMLDivElement);
});
it('can be configured', function() {
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
className: 'humpty-dumpty'
});
ctrl.setMap(map);
@@ -53,11 +53,11 @@ describe('ol.control.ScaleLine', function() {
describe('minWidth', function() {
it('defaults to 64', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
expect(ctrl.minWidth_).to.be(64);
});
it('can be configured', function() {
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
minWidth: 4711
});
expect(ctrl.minWidth_).to.be(4711);
@@ -66,14 +66,14 @@ describe('ol.control.ScaleLine', function() {
describe('render', function() {
it('defaults to `ol.control.ScaleLine.render`', function() {
var ctrl = new ol.control.ScaleLine();
expect(ctrl.render).to.be(ol.control.ScaleLine.render);
var ctrl = new _ol_control_ScaleLine_();
expect(ctrl.render).to.be(_ol_control_ScaleLine_.render);
});
it('can be configured', function() {
var myRender = function() {
};
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
render: myRender
});
expect(ctrl.render).to.be(myRender);
@@ -85,13 +85,13 @@ describe('ol.control.ScaleLine', function() {
describe('synchronisation with map view', function() {
it('calls `render` as soon as the map is rendered', function(done) {
var renderSpy = sinon.spy();
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
render: renderSpy
});
expect(renderSpy.called).to.be(false);
ctrl.setMap(map);
expect(renderSpy.called).to.be(false);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -104,11 +104,11 @@ describe('ol.control.ScaleLine', function() {
});
it('calls `render` as often as the map is rendered', function() {
var renderSpy = sinon.spy();
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
render: renderSpy
});
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -121,11 +121,11 @@ describe('ol.control.ScaleLine', function() {
});
it('calls `render` as when the view changes', function(done) {
var renderSpy = sinon.spy();
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
render: renderSpy
});
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -140,10 +140,10 @@ describe('ol.control.ScaleLine', function() {
describe('static method `render`', function() {
it('updates the rendered text', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
expect(ctrl.element.innerText).to.be('');
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -154,17 +154,17 @@ describe('ol.control.ScaleLine', function() {
describe('#getUnits', function() {
it('returns "metric" by default', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
expect(ctrl.getUnits()).to.be('metric');
});
it('returns what is configured via `units` property', function() {
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
units: 'nautical'
});
expect(ctrl.getUnits()).to.be('nautical');
});
it('returns what is configured `setUnits` method', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
ctrl.setUnits('nautical');
expect(ctrl.getUnits()).to.be('nautical');
});
@@ -172,8 +172,8 @@ describe('ol.control.ScaleLine', function() {
describe('#setUnits', function() {
it('triggers rerendering', function() {
var ctrl = new ol.control.ScaleLine();
map.setView(new ol.View({
var ctrl = new _ol_control_ScaleLine_();
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -196,9 +196,9 @@ describe('ol.control.ScaleLine', function() {
var imperialHtml;
var usHtml;
beforeEach(function(done) {
ctrl = new ol.control.ScaleLine();
ctrl = new _ol_control_ScaleLine_();
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0
}));
@@ -246,16 +246,16 @@ describe('ol.control.ScaleLine', function() {
describe('projections affect the scaleline', function() {
it('is rendered differently for different projections', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
ctrl.setMap(map);
map.setView(new ol.View({
center: ol.proj.fromLonLat([7, 52]),
map.setView(new _ol_View_({
center: _ol_proj_.fromLonLat([7, 52]),
zoom: 2,
projection: 'EPSG:3857'
}));
map.renderSync();
var innerHtml3857 = ctrl.element_.innerHTML;
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [7, 52],
zoom: 2,
projection: 'EPSG:4326'
@@ -266,13 +266,13 @@ describe('ol.control.ScaleLine', function() {
});
it('Projection\'s metersPerUnit affect scale for non-degree units', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0,
resolutions: [1],
projection: new ol.proj.Projection({
projection: new _ol_proj_Projection_({
code: 'METERS',
units: 'm',
getPointResolution: function(r) {
@@ -282,11 +282,11 @@ describe('ol.control.ScaleLine', function() {
}));
map.renderSync();
expect(ctrl.element_.innerText).to.be('100 m');
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: 0,
resolutions: [1],
projection: new ol.proj.Projection({
projection: new _ol_proj_Projection_({
code: 'PIXELS',
units: 'pixels',
metersPerUnit: 1 / 1000,
@@ -303,10 +303,10 @@ describe('ol.control.ScaleLine', function() {
describe('latitude may affect scale line in EPSG:4326', function() {
it('is rendered differently at different latitudes for metric', function() {
var ctrl = new ol.control.ScaleLine();
var ctrl = new _ol_control_ScaleLine_();
ctrl.setMap(map);
map.setView(new ol.View({
center: ol.proj.fromLonLat([7, 0]),
map.setView(new _ol_View_({
center: _ol_proj_.fromLonLat([7, 0]),
zoom: 2,
projection: 'EPSG:4326'
}));
@@ -319,12 +319,12 @@ describe('ol.control.ScaleLine', function() {
});
it('is rendered the same at different latitudes for degrees', function() {
var ctrl = new ol.control.ScaleLine({
var ctrl = new _ol_control_ScaleLine_({
units: 'degrees'
});
ctrl.setMap(map);
map.setView(new ol.View({
center: ol.proj.fromLonLat([7, 0]),
map.setView(new _ol_View_({
center: _ol_proj_.fromLonLat([7, 0]),
zoom: 2,
projection: 'EPSG:4326'
}));
@@ -359,11 +359,11 @@ describe('ol.control.ScaleLine', function() {
beforeEach(function() {
currentZoom = 33;
renderedHtmls = {};
ctrl = new ol.control.ScaleLine({
ctrl = new _ol_control_ScaleLine_({
minWidth: 10
});
ctrl.setMap(map);
map.setView(new ol.View({
map.setView(new _ol_View_({
center: [0, 0],
zoom: currentZoom,
maxZoom: currentZoom
+3 -5
View File
@@ -1,14 +1,12 @@
goog.require('ol.control.Zoom');
import _ol_control_Zoom_ from '../../../../src/ol/control/Zoom.js';
describe('ol.control.Zoom', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new ol.control.Zoom();
expect(instance).to.be.an(ol.control.Zoom);
var instance = new _ol_control_Zoom_();
expect(instance).to.be.an(_ol_control_Zoom_);
});
});
+14 -16
View File
@@ -1,9 +1,7 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control.ZoomSlider');
goog.require('ol.pointer.PointerEvent');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_control_ZoomSlider_ from '../../../../src/ol/control/ZoomSlider.js';
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
describe('ol.control.ZoomSlider', function() {
var map, target, zoomslider;
@@ -11,8 +9,8 @@ describe('ol.control.ZoomSlider', function() {
beforeEach(function() {
target = document.createElement('div');
document.body.appendChild(target);
zoomslider = new ol.control.ZoomSlider();
map = new ol.Map({
zoomslider = new _ol_control_ZoomSlider_();
map = new _ol_Map_({
target: target,
controls: [zoomslider]
});
@@ -61,7 +59,7 @@ describe('ol.control.ZoomSlider', function() {
describe('#direction_', function() {
it('is horizontal for wide containers', function() {
var control = new ol.control.ZoomSlider({});
var control = new _ol_control_ZoomSlider_({});
control.element.style.width = '1000px';
control.element.style.height = '10px';
control.setMap(map);
@@ -74,7 +72,7 @@ describe('ol.control.ZoomSlider', function() {
});
it('is vertical for tall containers', function() {
var control = new ol.control.ZoomSlider({});
var control = new _ol_control_ZoomSlider_({});
control.element.style.width = '10px';
control.element.style.height = '1000px';
@@ -91,9 +89,9 @@ describe('ol.control.ZoomSlider', function() {
var map;
beforeEach(function() {
map = new ol.Map({
map = new _ol_Map_({
target: createMapDiv(500, 100),
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
resolutions: [16, 8, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625]
})
@@ -104,7 +102,7 @@ describe('ol.control.ZoomSlider', function() {
});
it('[horizontal] handles a drag sequence', function() {
var control = new ol.control.ZoomSlider();
var control = new _ol_control_ZoomSlider_();
map.addControl(control);
map.getView().setZoom(0);
control.element.style.width = '500px';
@@ -113,7 +111,7 @@ describe('ol.control.ZoomSlider', function() {
control.element.firstChild.style.height = '10px';
map.renderSync();
var dragger = control.dragger_;
var event = new ol.pointer.PointerEvent('pointerdown', {
var event = new _ol_pointer_PointerEvent_('pointerdown', {
target: control.element.firstElementChild
});
event.clientX = control.widthLimit_;
@@ -136,7 +134,7 @@ describe('ol.control.ZoomSlider', function() {
expect(control.dragging_).to.be(false);
});
it('[vertical] handles a drag sequence', function() {
var control = new ol.control.ZoomSlider();
var control = new _ol_control_ZoomSlider_();
control.element.style.width = '10px';
control.element.style.height = '100px';
control.element.firstChild.style.width = '10px';
@@ -145,7 +143,7 @@ describe('ol.control.ZoomSlider', function() {
map.getView().setZoom(8);
map.renderSync();
var dragger = control.dragger_;
var event = new ol.pointer.PointerEvent('pointerdown', {
var event = new _ol_pointer_PointerEvent_('pointerdown', {
target: control.element.firstElementChild
});
event.clientX = 0;
+3 -5
View File
@@ -1,14 +1,12 @@
goog.require('ol.control.ZoomToExtent');
import _ol_control_ZoomToExtent_ from '../../../../src/ol/control/ZoomToExtent.js';
describe('ol.control.ZoomToExtent', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new ol.control.ZoomToExtent();
expect(instance).to.be.an(ol.control.ZoomToExtent);
var instance = new _ol_control_ZoomToExtent_();
expect(instance).to.be.an(_ol_control_ZoomToExtent_);
});
});