Make sure a failing test will not leave the node in place

This commit is contained in:
Yohan Boniface
2016-03-29 10:39:05 +02:00
parent 6bc6e599a0
commit 5795f37fe4

View File

@ -242,6 +242,12 @@ describe("L.Map#openPopup", function () {
map.setView(new L.LatLng(55.8, 37.6), 6); map.setView(new L.LatLng(55.8, 37.6), 6);
}); });
afterEach(function () {
if (document.body.contains(c)) {
document.body.removeChild(c);
}
});
it("adds the popup layer to the map", function () { it("adds the popup layer to the map", function () {
var popup = new L.Popup() var popup = new L.Popup()
.setLatLng(new L.LatLng(55.8, 37.6)); .setLatLng(new L.LatLng(55.8, 37.6));
@ -298,7 +304,6 @@ describe("L.Map#openPopup", function () {
setTimeout(function () { setTimeout(function () {
expect(spy.called).to.be(true); expect(spy.called).to.be(true);
expect(map.hasLayer(p)).to.be(true); expect(map.hasLayer(p)).to.be(true);
document.body.removeChild(c);
done(); done();
}, 100); }, 100);
}); });