Avoid failure when other tests don't clean up

This commit is contained in:
Tim Schaub
2017-07-03 14:25:10 -06:00
parent a5113715ef
commit 39cf0ee154

View File

@@ -8,9 +8,9 @@ goog.require('ol.source.Tile');
describe('ol.control.Attribution', function() { describe('ol.control.Attribution', function() {
var map, target; var map;
beforeEach(function() { beforeEach(function() {
target = document.createElement('div'); var target = document.createElement('div');
target.style.width = target.style.height = '100px'; target.style.width = target.style.height = '100px';
document.body.appendChild(target); document.body.appendChild(target);
map = new ol.Map({ map = new ol.Map({
@@ -63,13 +63,13 @@ describe('ol.control.Attribution', function() {
}); });
afterEach(function() { afterEach(function() {
map.setTarget(null); disposeMap(map);
document.body.removeChild(target); map = null;
}); });
it('does not add duplicate attributions', function() { it('does not add duplicate attributions', function() {
map.renderSync(); map.renderSync();
var attribution = document.querySelectorAll('.ol-attribution li'); var attribution = map.getTarget().querySelectorAll('.ol-attribution li');
expect(attribution.length).to.be(3); // first <li> is the logo expect(attribution.length).to.be(3); // first <li> is the logo
}); });