imperial unit test
This commit is contained in:
@@ -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() {
|
beforeEach(function() {
|
||||||
currentZoom = 33;
|
currentZoom = 33;
|
||||||
renderedHtmls = {};
|
renderedHtmls = {};
|
||||||
@@ -427,6 +437,9 @@ describe('ol.control.ScaleLine', function() {
|
|||||||
const currentHtml = ctrl.element_.innerHTML;
|
const currentHtml = ctrl.element_.innerHTML;
|
||||||
expect(currentHtml in renderedHtmls).to.be(false);
|
expect(currentHtml in renderedHtmls).to.be(false);
|
||||||
renderedHtmls[currentHtml] = true;
|
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() {
|
it('nautical: is rendered differently for different zoomlevels', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user