diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 1292ccb947..3109c68280 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -1763,7 +1763,7 @@ describe('ol.format.KML', function() { expect(style.getStroke().getWidth()).to.be(1); }); - it('can read a feature\'s IconStyle', function() { + it('can read a feature\'s IconStyle using default crossOrigin', function() { const text = '' + ' ' + @@ -1802,7 +1802,7 @@ describe('ol.format.KML', function() { expect(style.getZIndex()).to.be(undefined); }); - it('can read a feature\'s IconStyle with crossOrigin option', function() { + it('can read a feature\'s IconStyle (and set the crossOrigin option)', function() { format = new KML({crossOrigin: null}); const text = '' + @@ -2591,53 +2591,7 @@ describe('ol.format.KML', function() { expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); - it('can read a normal IconStyle', function() { - const text = - '' + - ' ' + - ' ' + - ' ' + - ' ' + - ' normal' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ''; - const fs = format.readFeatures(text); - expect(fs).to.have.length(1); - const f = fs[0]; - expect(f).to.be.an(Feature); - const styleFunction = f.getStyleFunction(); - expect(styleFunction).not.to.be(undefined); - const styleArray = styleFunction(f, 0); - expect(styleArray).to.be.an(Array); - expect(styleArray).to.have.length(1); - const style = styleArray[0]; - expect(style).to.be.an(Style); - expect(style.getFill()).to.be(getDefaultFillStyle()); - expect(style.getStroke()).to.be(getDefaultStrokeStyle()); - const imageStyle = style.getImage(); - expect(imageStyle).to.be.an(Icon); - expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://bar.png').href); - expect(imageStyle.getAnchor()).to.be(null); - expect(imageStyle.getOrigin()).to.be(null); - expect(imageStyle.getRotation()).to.eql(0); - expect(imageStyle.getSize()).to.be(null); - expect(imageStyle.getScale()).to.be(1); - expect(imageStyle.getImage().crossOrigin).to.eql('anonymous'); - expect(style.getText()).to.be(getDefaultTextStyle()); - expect(style.getZIndex()).to.be(undefined); - }); - - it('can read a normal IconStyle with crossOrigin option', function() { + it('can read a normal IconStyle (and set the crossOrigin option)', function() { format = new KML({crossOrigin: null}); const text = '' + @@ -2859,55 +2813,7 @@ describe('ol.format.KML', function() { expect(s.getFill().getColor()).to.eql([120, 86, 52, 18 / 255]); }); - it('can use IconStyles in StyleMaps before they are defined', function() { - const text = - '' + - ' ' + - ' ' + - ' ' + - ' normal' + - ' #foo' + - ' ' + - ' ' + - ' ' + - ' ' + - ' #fooMap' + - ' ' + - ' ' + - ''; - const fs = format.readFeatures(text); - expect(fs).to.have.length(1); - const f = fs[0]; - expect(f).to.be.an(Feature); - const styleFunction = f.getStyleFunction(); - expect(styleFunction).not.to.be(undefined); - const styleArray = styleFunction(f, 0); - expect(styleArray).to.be.an(Array); - expect(styleArray).to.have.length(1); - const style = styleArray[0]; - expect(style).to.be.an(Style); - expect(style.getFill()).to.be(getDefaultFillStyle()); - expect(style.getStroke()).to.be(getDefaultStrokeStyle()); - const imageStyle = style.getImage(); - expect(imageStyle).to.be.an(Icon); - expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://bar.png').href); - expect(imageStyle.getAnchor()).to.be(null); - expect(imageStyle.getOrigin()).to.be(null); - expect(imageStyle.getRotation()).to.eql(0); - expect(imageStyle.getSize()).to.be(null); - expect(imageStyle.getScale()).to.be(1); - expect(imageStyle.getImage().crossOrigin).to.eql('anonymous'); - expect(style.getText()).to.be(getDefaultTextStyle()); - expect(style.getZIndex()).to.be(undefined); - }); - - it('can use IconStyles with crossOrigin option in StyleMaps before they are defined', function() { + it('can use IconStyles in StyleMaps before they are defined (and set the crossOrigin option)', function() { format = new KML({crossOrigin: null}); const text = '' + @@ -2990,49 +2896,7 @@ describe('ol.format.KML', function() { expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); - it('can apply a shared IconStyle to a feature', function() { - const text = - '' + - ' ' + - ' ' + - ' ' + - ' #foo' + - ' ' + - ' ' + - ''; - const fs = format.readFeatures(text); - expect(fs).to.have.length(1); - const f = fs[0]; - expect(f).to.be.an(Feature); - const styleFunction = f.getStyleFunction(); - expect(styleFunction).not.to.be(undefined); - const styleArray = styleFunction(f, 0); - expect(styleArray).to.be.an(Array); - expect(styleArray).to.have.length(1); - const style = styleArray[0]; - expect(style).to.be.an(Style); - expect(style.getFill()).to.be(getDefaultFillStyle()); - expect(style.getStroke()).to.be(getDefaultStrokeStyle()); - const imageStyle = style.getImage(); - expect(imageStyle).to.be.an(Icon); - expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://bar.png').href); - expect(imageStyle.getAnchor()).to.be(null); - expect(imageStyle.getOrigin()).to.be(null); - expect(imageStyle.getRotation()).to.eql(0); - expect(imageStyle.getSize()).to.be(null); - expect(imageStyle.getScale()).to.be(1); - expect(imageStyle.getImage().crossOrigin).to.eql('anonymous'); - expect(style.getText()).to.be(getDefaultTextStyle()); - expect(style.getZIndex()).to.be(undefined); - }); - - it('can apply a shared IconStyle with crossOrigin option to a feature', function() { + it('can apply a shared IconStyle to a feature (and set the crossOrigin option)', function() { format = new KML({crossOrigin: null}); const text = '' + @@ -3107,51 +2971,7 @@ describe('ol.format.KML', function() { expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); - it('can read a shared IconStyle from a Folder', function() { - const text = - '' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' #foo' + - ' ' + - ' ' + - ''; - const fs = format.readFeatures(text); - expect(fs).to.have.length(1); - const f = fs[0]; - expect(f).to.be.an(Feature); - const styleFunction = f.getStyleFunction(); - expect(styleFunction).not.to.be(undefined); - const styleArray = styleFunction(f, 0); - expect(styleArray).to.be.an(Array); - expect(styleArray).to.have.length(1); - const style = styleArray[0]; - expect(style).to.be.an(Style); - expect(style.getFill()).to.be(getDefaultFillStyle()); - expect(style.getStroke()).to.be(getDefaultStrokeStyle()); - const imageStyle = style.getImage(); - expect(imageStyle).to.be.an(Icon); - expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://bar.png').href); - expect(imageStyle.getAnchor()).to.be(null); - expect(imageStyle.getOrigin()).to.be(null); - expect(imageStyle.getRotation()).to.eql(0); - expect(imageStyle.getSize()).to.be(null); - expect(imageStyle.getScale()).to.be(1); - expect(imageStyle.getImage().crossOrigin).to.eql('anonymous'); - expect(style.getText()).to.be(getDefaultTextStyle()); - expect(style.getZIndex()).to.be(undefined); - }); - - it('can read a shared IconStyle with crossOrigin option from a Folder', function() { + it('can read a shared IconStyle from a Folder (and set the crossOrigin option)', function() { format = new KML({crossOrigin: null}); const text = '' +