Merge pull request #10093 from mike-000/patch-3

Set label text for Graticule option styles
This commit is contained in:
Andreas Hocevar authored and GitHub committed 2019-10-22 15:23:01 +02:00
commit fef4d4e9b7
2 files changed
+43 -40

No files matched your search

+9
View File
@@ -32,6 +32,7 @@ describe('ol.layer.Graticule', function() {
});
it('creates a graticule with labels', function() {
const feature = new Feature();
graticule = new Graticule({
showLabels: true
});
@@ -51,6 +52,10 @@ describe('ol.layer.Graticule', function() {
expect(graticule.parallelsLabels_.length).to.be(3);
expect(graticule.parallelsLabels_[0].text).to.be('0° 00′ 00″');
expect(graticule.parallelsLabels_[0].geom.getCoordinates()[1]).to.roughlyEqual(0, 1e-9);
feature.set('graticule_label', graticule.meridiansLabels_[0].text);
expect(graticule.lonLabelStyle_(feature).getText().getText()).to.be('0° 00′ 00″');
feature.set('graticule_label', graticule.parallelsLabels_[0].text);
expect(graticule.latLabelStyle_(feature).getText().getText()).to.be('0° 00′ 00″');
});
it('has a default stroke style', function() {
@@ -105,6 +110,10 @@ describe('ol.layer.Graticule', function() {
expect(graticule.parallelsLabels_[0].text).to.be('lat: 0');
expect(graticule.lonLabelStyle_(feature).getText()).to.eql(lonLabelStyle);
expect(graticule.latLabelStyle_(feature).getText()).to.eql(latLabelStyle);
feature.set('graticule_label', graticule.meridiansLabels_[0].text);
expect(graticule.lonLabelStyle_(feature).getText().getText()).to.be('lon: 0');
feature.set('graticule_label', graticule.parallelsLabels_[0].text);
expect(graticule.latLabelStyle_(feature).getText().getText()).to.be('lat: 0');
expect(graticule.lonLabelPosition_).to.be(0.9);
expect(graticule.latLabelPosition_).to.be(0.1);
});