Named exports from ol/proj

This commit is contained in:
Tim Schaub
2017-12-13 22:14:27 -07:00
committed by Andreas Hocevar
parent fab77e8d37
commit 6f72ffe498
127 changed files with 853 additions and 882 deletions

View File

@@ -1,5 +1,5 @@
import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -38,7 +38,7 @@ describe('ol.source.TileWMS', function() {
it('returns a tile with the expected URL', function() {
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -67,7 +67,7 @@ describe('ol.source.TileWMS', function() {
it('returns a larger tile when a gutter is specified', function() {
options.gutter = 16;
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
@@ -84,7 +84,7 @@ describe('ol.source.TileWMS', function() {
it('sets the SRS query value instead of CRS if version < 1.3', function() {
options.params.VERSION = '1.2';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('CRS')).to.be(null);
@@ -95,7 +95,7 @@ describe('ol.source.TileWMS', function() {
options.params.FORMAT = 'image/jpeg';
options.params.TRANSPARENT = false;
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT')).to.be('image/jpeg');
@@ -105,7 +105,7 @@ describe('ol.source.TileWMS', function() {
it('does not add a STYLES= option if one is specified', function() {
options.params.STYLES = 'foo';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('STYLES')).to.be('foo');
@@ -113,7 +113,7 @@ describe('ol.source.TileWMS', function() {
it('changes the BBOX order for EN axis orientations', function() {
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-90,0,-45');
@@ -122,7 +122,7 @@ describe('ol.source.TileWMS', function() {
it('uses EN BBOX order if version < 1.3', function() {
options.params.VERSION = '1.1.0';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 1, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-90,-45,-45,0');
@@ -131,7 +131,7 @@ describe('ol.source.TileWMS', function() {
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 2, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:180');
@@ -141,7 +141,7 @@ describe('ol.source.TileWMS', function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
options.params.FORMAT_OPTIONS = 'param1:value1';
var tile = source.getTile(3, 2, -3, 2, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('param1:value1;dpi:180');
@@ -151,7 +151,7 @@ describe('ol.source.TileWMS', function() {
function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1.325, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 1.325, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
@@ -165,7 +165,7 @@ describe('ol.source.TileWMS', function() {
options.extent = [-80, -40, -50, -10];
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 2, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-90,0,-45');
@@ -175,7 +175,7 @@ describe('ol.source.TileWMS', function() {
options.extent = [-80, -40, -40, -10];
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 3, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-45,0,0');
@@ -189,7 +189,7 @@ describe('ol.source.TileWMS', function() {
});
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 3, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('WIDTH')).to.be('640');
@@ -205,7 +205,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -239,7 +239,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -269,7 +269,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -304,7 +304,7 @@ describe('ol.source.TileWMS', function() {
var source = new _ol_source_TileWMS_(options);
var url = 'http://foo/';
source.setUrl(url);
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, _ol_proj_.get('EPSG:4326'));
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, getProjection('EPSG:4326'));
expect(tileUrl.indexOf(url)).to.be(0);
});
});