UNPKG

mohsen-angular-leaflet-directive

Version:

angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps

135 lines (116 loc) 4.08 kB
// Generated by CoffeeScript 1.10.0 (function() { describe('leafletGeoJsonHelpers', function() { beforeEach(function() { module('leaflet-directive'); return inject(function(_$compile_, _$rootScope_, _leafletGeoJsonHelpers_) { this.$compile = _$compile_; this.$rootScope = _$rootScope_; return this.subject = _leafletGeoJsonHelpers_; }); }); return describe('should validate coordinates correctly', function() { it('basic', function() { expect(this.subject.validateCoords()).toEqual(false); expect(this.subject.validateCoords([1, 2])).toEqual(true); return expect(this.subject.validateCoords([])).toEqual(false); }); describe('Point', function() { return it('type:Point', function() { expect(this.subject.validateCoords({ type: 'Point', coordinates: [1, 2], })).toEqual(true); return expect(this.subject.validateCoords({ type: 'Point', coordinates: [], })).toEqual(false); }); }); describe('{lat: _ lng: _}', function() { it('type:foo, no lat lng', function() { return expect(this.subject.validateCoords({ type: 'foo', coordinates: [], })).toEqual(false); }); it('type:foo, w lat lng', function() { return expect(this.subject.validateCoords({ type: 'foo', lat: 45, lng: 150, })).toEqual(true); }); it('type:foo, w lat', function() { return expect(this.subject.validateCoords({ type: 'foo', lat: 45, })).toEqual(false); }); return it('type:foo, w lng', function() { return expect(this.subject.validateCoords({ type: 'foo', lng: 150, })).toEqual(false); }); }); describe('isArray', function() { it('type:foo, no lat lng', function() { return expect(this.subject.validateCoords([])).toEqual(false); }); it('type:foo, w lat lng', function() { return expect(this.subject.validateCoords([150, 45])).toEqual(true); }); it('type:foo, w lat', function() { return expect(this.subject.validateCoords([null, 45])).toEqual(false); }); return it('type:foo, w lng', function() { return expect(this.subject.validateCoords([150, null])).toEqual(false); }); }); return describe('Numeric Checks', function() { it('type:Point', function() { expect(this.subject.validateCoords({ type: 'Point', coordinates: ['1', 2], })).toEqual(false); return expect(this.subject.validateCoords({ type: 'Point', coordinates: [], })).toEqual(false); }); it('type:foo, w lat lng', function() { return expect(this.subject.validateCoords({ type: 'foo', lat: 45, lng: '150', })).toEqual(false); }); it('type:foo, w lat', function() { return expect(this.subject.validateCoords({ type: 'foo', lat: '45', lng: 150, })).toEqual(false); }); it('type:foo, w lng', function() { return expect(this.subject.validateCoords({ type: 'foo', lng: '150', })).toEqual(false); }); return describe('isArray', function() { it('type:foo, w lat lng', function() { return expect(this.subject.validateCoords(['150', 45])).toEqual(false); }); it('type:foo, w lat', function() { return expect(this.subject.validateCoords([150, '45'])).toEqual(false); }); return it('type:foo, w lng', function() { return expect(this.subject.validateCoords(['150', null])).toEqual(false); }); }); }); }); }); }).call(this);