2012-09-04 06:22:24 +08:00
|
|
|
describe('LatLngBounds', function() {
|
|
|
|
var a, c;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
2012-10-07 02:01:17 +08:00
|
|
|
a = new L.LatLngBounds(
|
|
|
|
new L.LatLng(14, 12),
|
|
|
|
new L.LatLng(30, 40));
|
|
|
|
c = new L.LatLngBounds();
|
2012-09-04 06:22:24 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('#isValid', function() {
|
|
|
|
it('should return true if properly set up', function() {
|
|
|
|
expect(a.isValid()).toBeTruthy();
|
|
|
|
});
|
|
|
|
it('should return false if is invalid', function() {
|
|
|
|
expect(c.isValid()).toBeFalsy();
|
|
|
|
});
|
|
|
|
it('should be valid if extended', function() {
|
|
|
|
c.extend([0, 0]);
|
|
|
|
expect(c.isValid()).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|
2013-01-27 19:12:02 +08:00
|
|
|
|
2013-01-28 08:04:09 +08:00
|
|
|
describe('#getWest', function () {
|
|
|
|
it('should return a proper bbox west value', function() {
|
|
|
|
expect(a.getWest()).toEqual(12);
|
2013-01-27 19:12:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-01-28 08:04:09 +08:00
|
|
|
describe('#getSouth', function () {
|
|
|
|
it('should return a proper bbox south value', function() {
|
|
|
|
expect(a.getSouth()).toEqual(14);
|
2013-01-27 19:12:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-01-28 08:04:09 +08:00
|
|
|
describe('#getEast', function () {
|
|
|
|
it('should return a proper bbox east value', function() {
|
|
|
|
expect(a.getEast()).toEqual(40);
|
2013-01-27 19:12:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-01-28 08:04:09 +08:00
|
|
|
describe('#getNorth', function () {
|
|
|
|
it('should return a proper bbox north value', function() {
|
|
|
|
expect(a.getNorth()).toEqual(30);
|
2013-01-27 19:12:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#toBBoxString', function () {
|
|
|
|
it('should return a proper left,bottom,right,top bbox', function() {
|
|
|
|
expect(a.toBBoxString()).toEqual("12,14,40,30");
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2013-01-28 08:09:26 +08:00
|
|
|
|
|
|
|
describe('#getNorthWest', function () {
|
|
|
|
it('should return a proper north-west LatLng', function() {
|
|
|
|
expect(a.getNorthWest()).toEqual(new L.LatLng(a.getNorth(), a.getWest()));
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#getSouthEast', function () {
|
|
|
|
it('should return a proper south-east LatLng', function() {
|
|
|
|
expect(a.getSouthEast()).toEqual(new L.LatLng(a.getSouth(), a.getEast()));
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2012-09-04 06:22:24 +08:00
|
|
|
});
|