Lint-free tests

This commit is contained in:
Tim Schaub
2016-01-03 11:38:01 -07:00
parent cca86886f1
commit 4e0cddcb41
4 changed files with 41 additions and 64 deletions
+18 -41
View File
@@ -402,60 +402,41 @@ describe('ol.View', function() {
});
it('fits correctly to the geometry', function() {
view.fit(
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{
padding: [100, 0, 0, 100],
constrainResolution: false
}
);
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{padding: [100, 0, 0, 100], constrainResolution: false});
expect(view.getResolution()).to.be(11);
expect(view.getCenter()[0]).to.be(5950);
expect(view.getCenter()[1]).to.be(47100);
view.fit(
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{
padding: [100, 0, 0, 100]
}
);
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{padding: [100, 0, 0, 100]});
expect(view.getResolution()).to.be(20);
expect(view.getCenter()[0]).to.be(5500);
expect(view.getCenter()[1]).to.be(47550);
view.fit(
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{
padding: [100, 0, 0, 100],
nearest: true
}
);
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{padding: [100, 0, 0, 100], nearest: true});
expect(view.getResolution()).to.be(10);
expect(view.getCenter()[0]).to.be(6000);
expect(view.getCenter()[1]).to.be(47050);
view.fit(
new ol.geom.Point([6000, 46000]),
[200, 200],
{
padding: [100, 0, 0, 100],
minResolution: 2
}
);
new ol.geom.Point([6000, 46000]),
[200, 200],
{padding: [100, 0, 0, 100], minResolution: 2});
expect(view.getResolution()).to.be(2);
expect(view.getCenter()[0]).to.be(5900);
expect(view.getCenter()[1]).to.be(46100);
view.fit(
new ol.geom.Point([6000, 46000]),
[200, 200],
{
padding: [100, 0, 0, 100],
maxZoom: 6
}
);
new ol.geom.Point([6000, 46000]),
[200, 200],
{padding: [100, 0, 0, 100], maxZoom: 6});
expect(view.getResolution()).to.be(2);
expect(view.getZoom()).to.be(6);
expect(view.getCenter()[0]).to.be(5900);
@@ -463,13 +444,9 @@ describe('ol.View', function() {
view.setRotation(Math.PI / 4);
view.fit(
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{
padding: [100, 0, 0, 100],
constrainResolution: false
}
);
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
[200, 200],
{padding: [100, 0, 0, 100], constrainResolution: false});
expect(view.getResolution()).to.roughlyEqual(14.849242404917458, 1e-9);
expect(view.getCenter()[0]).to.roughlyEqual(5200, 1e-9);
expect(view.getCenter()[1]).to.roughlyEqual(46300, 1e-9);