Skip to content

Commit

Permalink
Add test for View.fit with extent set on View
Browse files Browse the repository at this point in the history
  • Loading branch information
M393 committed Sep 15, 2020
1 parent 2de80e0 commit 72f4f41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/spec/ol/view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import View, {
} from '../../../src/ol/View.js';
import ViewHint from '../../../src/ol/ViewHint.js';
import {clearUserProjection, useGeographic} from '../../../src/ol/proj.js';
import {createEmpty} from '../../../src/ol/extent.js';
import {containsExtent, createEmpty} from '../../../src/ol/extent.js';

describe('ol.View', function () {
describe('constructor (defaults)', function () {
Expand Down Expand Up @@ -1776,6 +1776,12 @@ describe('ol.View', function () {
expect(view.getCenter()[0]).to.be(1500);
expect(view.getCenter()[1]).to.be(1500);
});
it('fits correctly to the extent when a view extent is configured', function () {
view.options_.extent = [1500, 0, 2500, 10000];
view.applyOptions_(view.options_);
view.fit([1000, 1000, 2000, 2000]);
expect(view.calculateExtent()).eql([1500, 1000, 2500, 2000]);
});
it('throws on invalid geometry/extent value', function () {
expect(function () {
view.fit(true, [200, 200]);
Expand Down

0 comments on commit 72f4f41

Please sign in to comment.