No-op bringToFront/Back when Path is not on a map (fixes #2439)
This commit is contained in:
parent
40376dc3be
commit
ea2c397523
@ -71,6 +71,7 @@
|
||||
<!-- /layer/vector/ -->
|
||||
<script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/layer/vector/CircleMarkerSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/layer/vector/PathSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/layer/vector/PolygonSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/layer/vector/PolylineSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script>
|
||||
|
15
spec/suites/layer/vector/PathSpec.js
Normal file
15
spec/suites/layer/vector/PathSpec.js
Normal file
@ -0,0 +1,15 @@
|
||||
describe('Path', function () {
|
||||
describe('#bringToBack', function () {
|
||||
it('is a no-op for layers not on a map', function () {
|
||||
var path = new L.Path();
|
||||
expect(path.bringToBack()).to.equal(path);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#bringToFront', function () {
|
||||
it('is a no-op for layers not on a map', function () {
|
||||
var path = new L.Path();
|
||||
expect(path.bringToFront()).to.equal(path);
|
||||
});
|
||||
})
|
||||
});
|
@ -61,12 +61,16 @@ L.Path = L.Layer.extend({
|
||||
},
|
||||
|
||||
bringToFront: function () {
|
||||
this._renderer._bringToFront(this);
|
||||
if (this._renderer) {
|
||||
this._renderer._bringToFront(this);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
bringToBack: function () {
|
||||
this._renderer._bringToBack(this);
|
||||
if (this._renderer) {
|
||||
this._renderer._bringToBack(this);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user