Merge pull request #7828 from bjornharrtell/refactor-constraints

Refactor constraints static methods to module functions
This commit is contained in:
Tim Schaub
2018-02-14 23:01:22 -07:00
committed by GitHub
9 changed files with 46 additions and 54 deletions

View File

@@ -1,14 +1,14 @@
import ResolutionConstraint from '../../../src/ol/ResolutionConstraint.js';
import {createSnapToResolutions, createSnapToPower} from '../../../src/ol/resolutionconstraint.js';
describe('ol.ResolutionConstraint', function() {
describe('ol.resolutionconstraint', function() {
describe('SnapToResolution', function() {
let resolutionConstraint;
beforeEach(function() {
resolutionConstraint = ResolutionConstraint.createSnapToResolutions(
resolutionConstraint = createSnapToResolutions(
[1000, 500, 250, 100]);
});
@@ -46,7 +46,7 @@ describe('ol.ResolutionConstraint', function() {
beforeEach(function() {
resolutionConstraint =
ResolutionConstraint.createSnapToResolutions(
createSnapToResolutions(
[1000, 500, 250, 100]);
});
@@ -96,7 +96,7 @@ describe('ol.ResolutionConstraint', function() {
beforeEach(function() {
resolutionConstraint =
ResolutionConstraint.createSnapToPower(2, 1024, 10);
createSnapToPower(2, 1024, 10);
});
describe('delta 0', function() {
@@ -154,7 +154,7 @@ describe('ol.ResolutionConstraint', function() {
beforeEach(function() {
resolutionConstraint =
ResolutionConstraint.createSnapToPower(2, 1024, 10);
createSnapToPower(2, 1024, 10);
});
describe('delta 0, direction 0', function() {

View File

@@ -1,12 +1,12 @@
import RotationConstraint from '../../../src/ol/RotationConstraint.js';
import {createSnapToZero} from '../../../src/ol/rotationconstraint.js';
describe('ol.RotationConstraint', function() {
describe('ol.rotationconstraint', function() {
describe('SnapToZero', function() {
it('returns expected rotation value', function() {
const rotationConstraint = RotationConstraint.createSnapToZero(0.3);
const rotationConstraint = createSnapToZero(0.3);
expect(rotationConstraint(0.1, 0)).to.eql(0);
expect(rotationConstraint(0.2, 0)).to.eql(0);