Adding crossOrigin to optionsFromCapabilities
This pull request should resolve: https://github.com/openlayers/openlayers/issues/6521 Now with var and single quotes
This commit is contained in:
@@ -292,6 +292,7 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
|
||||
* - style - {string} The name of the style
|
||||
* - format - {string} Image format for the layer. Default is the first
|
||||
* format returned in the GetCapabilities response.
|
||||
* - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.
|
||||
* @return {?olx.source.WMTSOptions} WMTS source options object or `null` if the layer was not found.
|
||||
* @api
|
||||
*/
|
||||
@@ -447,6 +448,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
tileGrid: tileGrid,
|
||||
style: style,
|
||||
dimensions: dimensions,
|
||||
wrapX: wrapX
|
||||
wrapX: wrapX,
|
||||
crossOrigin: config['crossOrigin']
|
||||
};
|
||||
};
|
||||
|
||||
@@ -31,6 +31,16 @@ describe('ol.source.WMTS', function() {
|
||||
expect(options).to.be(null);
|
||||
});
|
||||
|
||||
it('passes the crossOrigin option', function() {
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(capabilities, {
|
||||
layer: 'BlueMarbleNextGeneration',
|
||||
matrixSet: 'google3857',
|
||||
crossOrigin: ''
|
||||
});
|
||||
|
||||
expect(options.crossOrigin).to.be.eql('');
|
||||
});
|
||||
|
||||
it('can create KVP options from spec/ol/format/wmts/ogcsample.xml',
|
||||
function() {
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(
|
||||
@@ -59,6 +69,8 @@ describe('ol.source.WMTS', function() {
|
||||
|
||||
expect(options.dimensions).to.eql({Time: '20110805'});
|
||||
|
||||
expect(options.crossOrigin).to.be(undefined);
|
||||
|
||||
});
|
||||
|
||||
it('can create REST options from spec/ol/format/wmts/ogcsample.xml',
|
||||
|
||||
Reference in New Issue
Block a user