Add tests for the tile_matrix_set replacement

pull/15761/head
manmorjim 4 years ago
parent 8e510af9b8
commit d5e205f35c

@ -104,6 +104,56 @@ describe('editor/components/modals/add-basemap/wms/wms-layer-model', function ()
expect(this.model.get('state')).toEqual('saveDone');
});
});
describe('when is a WMTS with the tile_matrix_set variable and two matrix sets one of them is the default 3857', function () {
beforeEach(function () {
this.model.set({
type: 'wmts',
url_template: 'http://foo.com/bar/%(tile_matrix_set)s/%%(z)s/%%(x)s/%%(y)s.png',
matrix_sets: ['4326', '3857']
});
spyOn(this.model, '_byCustomURL').and.callThrough();
this.model.createProxiedLayerOrCustomBaselayerModel();
});
it('should create the tile layer with a proper XYZ URL', function () {
expect(this.model._byCustomURL).toHaveBeenCalled();
expect(this.model._byCustomURL.calls.argsFor(0)[0]).toEqual('http://foo.com/bar/3857/{z}/{x}/{y}.png');
});
it('should return a tile layer directly instead', function () {
expect(this.model.get('customBaselayerModel') instanceof CustomBaselayerModel).toBeTruthy();
});
it('should set saveDone', function () {
expect(this.model.get('state')).toEqual('saveDone');
});
});
describe('when is a WMTS with the tile_matrix_set variable and two matrix sets', function () {
beforeEach(function () {
this.model.set({
type: 'wmts',
url_template: 'http://foo.com/bar/%(tile_matrix_set)s/%%(z)s/%%(x)s/%%(y)s.png',
matrix_sets: ['25830', '4326']
});
spyOn(this.model, '_byCustomURL').and.callThrough();
this.model.createProxiedLayerOrCustomBaselayerModel();
});
it('should create the tile layer with a proper XYZ URL', function () {
expect(this.model._byCustomURL).toHaveBeenCalled();
expect(this.model._byCustomURL.calls.argsFor(0)[0]).toEqual('http://foo.com/bar/25830/{z}/{x}/{y}.png');
});
it('should return a tile layer directly instead', function () {
expect(this.model.get('customBaselayerModel') instanceof CustomBaselayerModel).toBeTruthy();
});
it('should set saveDone', function () {
expect(this.model.get('state')).toEqual('saveDone');
});
});
});
describe('._newProxiedBaselayerModel', function () {

Loading…
Cancel
Save