From 5795f37fe41cfca524b668e9c8d24fac1745e9f0 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 29 Mar 2016 10:39:05 +0200 Subject: [PATCH] Make sure a failing test will not leave the node in place --- spec/suites/layer/PopupSpec.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/suites/layer/PopupSpec.js b/spec/suites/layer/PopupSpec.js index 3c62d910..f29bafb3 100644 --- a/spec/suites/layer/PopupSpec.js +++ b/spec/suites/layer/PopupSpec.js @@ -242,6 +242,12 @@ describe("L.Map#openPopup", function () { 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 () { var popup = new L.Popup() .setLatLng(new L.LatLng(55.8, 37.6)); @@ -298,7 +304,6 @@ describe("L.Map#openPopup", function () { setTimeout(function () { expect(spy.called).to.be(true); expect(map.hasLayer(p)).to.be(true); - document.body.removeChild(c); done(); }, 100); });