imperial unit test

This commit is contained in:
Zsolt Ero
2018-04-10 20:45:09 +02:00
parent b55f323afe
commit cedf01f647

View File

@@ -369,6 +369,16 @@ describe('ol.control.ScaleLine', function() {
}
};
const getImperialUnit = function(zoom) {
if (zoom >= 21) {
return 'in';
} else if (zoom >= 10) {
return 'ft';
} else {
return 'mi';
}
};
beforeEach(function() {
currentZoom = 33;
renderedHtmls = {};
@@ -427,6 +437,9 @@ describe('ol.control.ScaleLine', function() {
const currentHtml = ctrl.element_.innerHTML;
expect(currentHtml in renderedHtmls).to.be(false);
renderedHtmls[currentHtml] = true;
const unit = ctrl.innerElement_.textContent.match(/\d+ (.+)/)[1];
expect(unit).to.eql(getImperialUnit(currentZoom));
}
});
it('nautical: is rendered differently for different zoomlevels', function() {