From b7958415b3475c46f462431612a2264db39fc487 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 9 Aug 2017 22:02:58 -0400 Subject: [PATCH] Don't remove all the divs under body when testing --- test/spec/ui/confirm.js | 7 +++++-- test/spec/ui/flash.js | 3 ++- test/spec/ui/modal.js | 7 +++++-- test/spec/ui/raw_tag_editor.js | 8 +++++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/test/spec/ui/confirm.js b/test/spec/ui/confirm.js index 5e2b83770..a12db432d 100644 --- a/test/spec/ui/confirm.js +++ b/test/spec/ui/confirm.js @@ -2,11 +2,14 @@ describe('iD.uiConfirm', function () { var elem; beforeEach(function() { - elem = d3.select('body').append('div'); + elem = d3.select('body') + .append('div') + .attr('id', 'confirm-wrap'); }); afterEach(function() { - elem.remove(); + d3.select('#confirm-wrap') + .remove(); }); it('can be instantiated', function () { diff --git a/test/spec/ui/flash.js b/test/spec/ui/flash.js index 08174d66a..3fa10b0d1 100644 --- a/test/spec/ui/flash.js +++ b/test/spec/ui/flash.js @@ -9,7 +9,8 @@ describe('iD.uiFlash', function () { }); afterEach(function() { - d3.select('body > div').remove(); + d3.select('#flash-wrap') + .remove(); }); it('returns a selection', function () { diff --git a/test/spec/ui/modal.js b/test/spec/ui/modal.js index c6c13348d..d59d339a2 100644 --- a/test/spec/ui/modal.js +++ b/test/spec/ui/modal.js @@ -2,11 +2,14 @@ describe('iD.uiModal', function () { var elem; beforeEach(function() { - elem = d3.select('body').append('div'); + elem = d3.select('body') + .append('div') + .attr('id', 'modal-wrap'); }); afterEach(function() { - elem.remove(); + d3.select('#modal-wrap') + .remove(); }); it('can be instantiated', function() { diff --git a/test/spec/ui/raw_tag_editor.js b/test/spec/ui/raw_tag_editor.js index e7f46999e..ac7212ef9 100644 --- a/test/spec/ui/raw_tag_editor.js +++ b/test/spec/ui/raw_tag_editor.js @@ -1,6 +1,5 @@ describe('iD.uiRawTagEditor', function() { - var taglist, element, - entity, context; + var taglist, element, entity, context; function render(tags) { taglist = iD.uiRawTagEditor(context) @@ -10,6 +9,7 @@ describe('iD.uiRawTagEditor', function() { element = d3.select('body') .append('div') + .attr('class', 'ui-wrap') .call(taglist); } @@ -21,9 +21,11 @@ describe('iD.uiRawTagEditor', function() { }); afterEach(function () { - element.remove(); + d3.selectAll('.ui-wrap') + .remove(); }); + it('creates input elements for each key-value pair', function () { expect(element.selectAll('input[value=highway]')).not.to.be.empty; expect(element.selectAll('input[value=residential]')).not.to.be.empty;