Don't remove all the divs under body when testing

This commit is contained in:
Bryan Housel
2017-08-09 22:02:58 -04:00
parent 94662a34e3
commit b7958415b3
4 changed files with 17 additions and 8 deletions
+5 -2
View File
@@ -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 () {
+2 -1
View File
@@ -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 () {
+5 -2
View File
@@ -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() {
+5 -3
View File
@@ -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;