Remove problematic spies from scaleline tests
This commit is contained in:
@@ -140,18 +140,16 @@ describe('ol.control.ScaleLine', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('static method `render`', function() {
|
describe('static method `render`', function() {
|
||||||
it('calls `updateElement_` on render', function(done) {
|
it('updates the rendered text', function() {
|
||||||
var ctrl = new ol.control.ScaleLine();
|
var ctrl = new ol.control.ScaleLine();
|
||||||
var spy = sinon.spy(ctrl, 'updateElement_');
|
expect(ctrl.element.innerText).to.be('');
|
||||||
ctrl.setMap(map);
|
ctrl.setMap(map);
|
||||||
map.setView(new ol.View({
|
map.setView(new ol.View({
|
||||||
center: [0, 0],
|
center: [0, 0],
|
||||||
zoom: 0
|
zoom: 0
|
||||||
}));
|
}));
|
||||||
map.once('postrender', function() {
|
map.renderSync();
|
||||||
expect(spy.called).to.be(true);
|
expect(ctrl.element.innerText).to.be('10000 km');
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -176,9 +174,18 @@ describe('ol.control.ScaleLine', function() {
|
|||||||
describe('#setUnits', function() {
|
describe('#setUnits', function() {
|
||||||
it('triggers rerendering', function() {
|
it('triggers rerendering', function() {
|
||||||
var ctrl = new ol.control.ScaleLine();
|
var ctrl = new ol.control.ScaleLine();
|
||||||
var spy = sinon.spy(ctrl, 'updateElement_');
|
map.setView(new ol.View({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 0
|
||||||
|
}));
|
||||||
|
ctrl.setMap(map);
|
||||||
|
|
||||||
|
map.renderSync();
|
||||||
|
expect(ctrl.element.innerText).to.be('10000 km');
|
||||||
|
|
||||||
ctrl.setUnits('nautical');
|
ctrl.setUnits('nautical');
|
||||||
expect(spy.called).to.be(true);
|
map.renderSync();
|
||||||
|
expect(ctrl.element.innerText).to.be('10000 nm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user