BoundsSpec.js (Leaflet-1.8.0) | : | BoundsSpec.js (Leaflet-1.9.0) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
describe('#extend', function () { | describe('#extend', function () { | |||
it('extends the bounds to contain the given point', function () { | it('extends the bounds to contain the given point', function () { | |||
a.extend([50, 20]); | a.extend([50, 20]); | |||
expect(a.min).to.eql(L.point(14, 12)); | expect(a.min).to.eql(L.point(14, 12)); | |||
expect(a.max).to.eql(L.point(50, 40)); | expect(a.max).to.eql(L.point(50, 40)); | |||
b.extend([25, 50]); | b.extend([25, 50]); | |||
expect(b.min).to.eql(L.point(14, 12)); | expect(b.min).to.eql(L.point(14, 12)); | |||
expect(b.max).to.eql(L.point(30, 50)); | expect(b.max).to.eql(L.point(30, 50)); | |||
}); | }); | |||
it('extends the bounds by given bounds', function () { | ||||
a.extend([20, 50]); | ||||
expect(a.max).to.eql(L.point(30, 50)); | ||||
}); | ||||
it('extends the bounds by given bounds', function () { | ||||
a.extend([[20, 50], [8, 40]]); | ||||
expect(a.getBottomLeft()).to.eql(L.point(8, 50)); | ||||
}); | ||||
it('extends the bounds by undefined', function () { | ||||
expect(a.extend()).to.eql(a); | ||||
}); | ||||
it('extends the bounds by raw object', function () { | ||||
a.extend({x: 20, y: 50}); | ||||
expect(a.max).to.eql(L.point(30, 50)); | ||||
}); | ||||
it('extend the bounds by an empty bounds object', function () { | ||||
expect(a.extend(L.bounds())).to.eql(a); | ||||
}); | ||||
}); | }); | |||
describe('#getCenter', function () { | describe('#getCenter', function () { | |||
it('returns the center point', function () { | it('returns the center point', function () { | |||
expect(a.getCenter()).to.eql(L.point(22, 26)); | expect(a.getCenter()).to.eql(L.point(22, 26)); | |||
}); | }); | |||
}); | }); | |||
describe('#pad', function () { | ||||
it('pads the bounds by a given ratio', function () { | ||||
var bounds = a.pad(0.5); | ||||
expect(bounds).to.eql(L.bounds([[6, -2], [38, 54]])); | ||||
}); | ||||
}); | ||||
describe('#contains', function () { | describe('#contains', function () { | |||
it('contains other bounds or point', function () { | it('contains other bounds or point', function () { | |||
a.extend([50, 10]); | a.extend([50, 10]); | |||
expect(a.contains(b)).to.be.ok(); | expect(a.contains(b)).to.be.ok(); | |||
expect(b.contains(a)).to.not.be.ok(); | expect(b.contains(a)).to.not.be.ok(); | |||
expect(a.contains([24, 25])).to.be.ok(); | expect(a.contains([24, 25])).to.be.ok(); | |||
expect(a.contains([54, 65])).to.not.be.ok(); | expect(a.contains([54, 65])).to.not.be.ok(); | |||
}); | }); | |||
}); | }); | |||
skipping to change at line 138 | skipping to change at line 168 | |||
expect(a.getBottomRight()).to.eql(L.point(30, 40)); // le ft, bottom | expect(a.getBottomRight()).to.eql(L.point(30, 40)); // le ft, bottom | |||
}); | }); | |||
}); | }); | |||
describe('L.bounds factory', function () { | describe('L.bounds factory', function () { | |||
it('creates bounds from array of number arrays', function () { | it('creates bounds from array of number arrays', function () { | |||
var bounds = L.bounds([[14, 12], [30, 40]]); | var bounds = L.bounds([[14, 12], [30, 40]]); | |||
expect(bounds).to.eql(a); | expect(bounds).to.eql(a); | |||
}); | }); | |||
}); | }); | |||
describe('#equals', function () { | ||||
it('returns true if bounds equal', function () { | ||||
expect(a.equals([[14, 12], [30, 40]])).to.eql(true); | ||||
expect(a.equals([[14, 13], [30, 40]])).to.eql(false); | ||||
expect(a.equals(null)).to.eql(false); | ||||
}); | ||||
}); | ||||
}); | }); | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 38 lines changed or added |