angular-esri-map
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
{ | ||
"name": "angular-esri-map", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"homepage": "https://github.com/Esri/angular-esri-map", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -8,2 +8,20 @@ # Change Log | ||
## [v1.0.0-rc.2] | ||
### Changed | ||
Replaced unnecessary references to Angular helper functions in services and controllers with vanilla JavaScript. [#164](https://github.com/Esri/angular-esri-map/pull/164) | ||
esriLoader tests for existence of global `require()` function instead of global `esri` namespace to determine if the JSAPI has been loaded. [#163](https://github.com/Esri/angular-esri-map/pull/163) | ||
Added .npmignore so that dist files would be added when publishing to NPM. [#154](https://github.com/Esri/angular-esri-map/issues/154) | ||
### Tests | ||
Added config and hooks for Travis CI so tests will be run for pull requests. [#157](https://github.com/Esri/angular-esri-map/pull/157) | ||
### Documentation | ||
Added a home page and index pages for each module to the API docs [#159](https://github.com/Esri/angular-esri-map/pull/159) | ||
## [v1.0.0-rc.1] | ||
@@ -162,3 +180,4 @@ | ||
[unreleased]: https://github.com/Esri/angular-esri-map/compare/v1.0.0-rc.1...HEAD | ||
[unreleased]: https://github.com/Esri/angular-esri-map/compare/v1.0.0-rc.2...HEAD | ||
[v1.0.0-rc.2]: https://github.com/Esri/angular-esri-map/compare/v1.0.0-rc.1...v1.0.0-rc.2 | ||
[v1.0.0-rc.1]: https://github.com/Esri/angular-esri-map/compare/v1.0.0-beta.5...v1.0.0-rc.1 | ||
@@ -165,0 +184,0 @@ [v1.0.0-beta.5]: https://github.com/Esri/angular-esri-map/compare/v1.0.0-beta.4...v1.0.0-beta.5 |
@@ -112,4 +112,5 @@ /*eslint-env node*/ | ||
gulp.watch([srcJsFiles,'./site/**.*.html', siteJsFiles, './site/styles/*.css'], ['build', browserSync.reload ]); | ||
gulp.watch([srcJsFiles, './site/**.*.html', siteJsFiles, './site/styles/*.css'], ['build', browserSync.reload ]); | ||
gulp.watch([srcJsFiles, unitTestSpecFiles ], [ 'karma-once' ]); | ||
gulp.watch(['./site/docs-resources/**'], ['ngdocs', browserSync.reload ]); | ||
}); | ||
@@ -150,6 +151,2 @@ | ||
singleRun: true, | ||
// if phantom doesn't start, change this port | ||
// there's always some live reload listening on 9876 | ||
// so we're defaulting to 6789 | ||
port: 6789, | ||
browsers: ['PhantomJS'] | ||
@@ -196,3 +193,6 @@ }, done).start(); | ||
api: { | ||
glob: ['src/**/*.js'], | ||
glob: [ | ||
'src/**/*.js', // source files | ||
'site/docs-resources/**/*.ngdoc' // documentation landing page | ||
], | ||
api: true, | ||
@@ -199,0 +199,0 @@ title: 'API' |
{ | ||
"name": "angular-esri-map", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "A collection of directives to help you use Esri maps and services in your Angular applications", | ||
@@ -30,2 +30,3 @@ "main": "dist/angular-esri-map.js", | ||
"karma-coverage": "^0.5.3", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-jasmine": "^0.3.6", | ||
@@ -61,6 +62,6 @@ "karma-phantomjs-launcher": "^0.2.1", | ||
"build": "gulp build", | ||
"test": "gulp test", | ||
"release": "./scripts/release.sh", | ||
"test": "karma start test/unit/karma.conf.js --browsers Firefox --single-run", | ||
"release": "scripts/release.sh", | ||
"start": "gulp" | ||
} | ||
} |
angular-esri-map | ||
================ | ||
[![Build Status](https://travis-ci.org/Esri/angular-esri-map.svg?branch=master)](https://travis-ci.org/Esri/angular-esri-map) | ||
A collection of directives to help you use Esri maps and services in your Angular applications. | ||
@@ -5,0 +7,0 @@ |
(function(angular) { | ||
'use strict'; | ||
/* @ngdoc object | ||
* @name esri.core | ||
* @description | ||
* THE ESRI.CORE MODULE DESCRIPTION GOES HERE | ||
*/ | ||
angular.module('esri.core', []); | ||
})(angular); |
@@ -41,3 +41,3 @@ (function(angular) { | ||
// https://developers.arcgis.com/javascript/jsapi/infotemplate-amd.html#infotemplate2 | ||
if (angular.isArray(infoTemplate) && infoTemplate.length === 2) { | ||
if (infoTemplate instanceof Array && infoTemplate.length === 2) { | ||
return new InfoTemplate(infoTemplate[0], infoTemplate[1]); | ||
@@ -116,3 +116,3 @@ } else { | ||
// convert into ImageParameters() if needed | ||
if (angular.isObject(layerOptions.imageParameters)) { | ||
if (typeof layerOptions.imageParameters === 'object') { | ||
if (layerOptions.imageParameters.declaredClass !== 'esri.layers.ImageParameters') { | ||
@@ -119,0 +119,0 @@ var imageParameters = new ImageParameters(); |
@@ -9,2 +9,4 @@ /*global require: false*/ | ||
* | ||
* @requires $q | ||
* | ||
* @description | ||
@@ -31,17 +33,18 @@ * Use `esriLoader` to lazyload the Esri ArcGIS API or to require API modules. | ||
// Default options object to empty hash | ||
var opts = options || {}; | ||
// Don't reload API if it is already loaded | ||
if ( angular.isDefined(window.esri) ) { | ||
if (isLoaded()) { | ||
deferred.reject('ESRI API is already loaded.'); | ||
return deferred.promise; | ||
} | ||
// Default options object to empty hash | ||
options = angular.isDefined(options) ? options : {}; | ||
// Create Script Object to be loaded | ||
var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.src = options.url || 'http://js.arcgis.com/3.14compact'; | ||
script.src = opts.url || 'http://js.arcgis.com/3.14compact'; | ||
// Set onload callback to resolve promise | ||
script.onload = function() { deferred.resolve( window.esri ); }; | ||
script.onload = function() { deferred.resolve( window.require ); }; | ||
@@ -61,3 +64,3 @@ document.body.appendChild(script); | ||
function isLoaded() { | ||
return angular.isDefined(window.esri); | ||
return typeof window.require !== 'undefined'; | ||
} | ||
@@ -85,7 +88,7 @@ | ||
} | ||
if (angular.isString(moduleName)) { | ||
if (typeof moduleName === 'string') { | ||
require([moduleName], function (module) { | ||
// Check if callback exists, and execute if it does | ||
if ( callback && angular.isFunction(callback) ) { | ||
if (callback && typeof callback === 'function') { | ||
callback(module); | ||
@@ -96,3 +99,3 @@ } | ||
} | ||
else if (angular.isArray(moduleName)) { | ||
else if (moduleName instanceof Array) { | ||
require(moduleName, function () { | ||
@@ -103,3 +106,3 @@ | ||
// callback check, sends modules loaded as arguments | ||
if ( callback && angular.isFunction(callback) ) { | ||
if (callback && typeof callback === 'function') { | ||
callback.apply(this, args); | ||
@@ -106,0 +109,0 @@ } |
@@ -15,2 +15,7 @@ (function(angular) { | ||
// check if a variable is an array | ||
function isArray(v) { | ||
return v instanceof Array; | ||
} | ||
// construct Extent if object is not already an instance | ||
@@ -45,3 +50,3 @@ // e.g. if the controller or HTML view are only providing JSON | ||
var baseMapLayers = basemapDefinition.baseMapLayers; | ||
if (!angular.isArray(baseMapLayers) && angular.isArray(basemapDefinition.urls)) { | ||
if (!isArray(baseMapLayers) && isArray(basemapDefinition.urls)) { | ||
baseMapLayers = basemapDefinition.urls.map(function(url) { | ||
@@ -53,3 +58,3 @@ return { | ||
} | ||
if (angular.isArray(baseMapLayers)) { | ||
if (isArray(baseMapLayers)) { | ||
esriBasemaps[name] = { | ||
@@ -56,0 +61,0 @@ baseMapLayers: baseMapLayers, |
(function(angular) { | ||
'use strict'; | ||
/* @ngdoc object | ||
* @name esri.map | ||
* @requires esri.core | ||
* @description | ||
* THE ESRI.MAP MODULE DESCRIPTION GOES HERE | ||
*/ | ||
angular.module('esri.map', ['esri.core']); | ||
})(angular); |
@@ -52,3 +52,3 @@ (function(angular) { | ||
var infoTemplates = layer.infoTemplates; | ||
if (!angular.isObject(infoTemplates)) { | ||
if (!infoTemplates) { | ||
// create a new info templates hash | ||
@@ -55,0 +55,0 @@ infoTemplates = {}; |
@@ -36,3 +36,3 @@ (function(angular) { | ||
// visible takes precedence over layerOptions.visible | ||
if (angular.isDefined(this.visible)) { | ||
if (typeof this.visible !== 'undefined') { | ||
layerOptions.visible = isTrue(this.visible); | ||
@@ -39,0 +39,0 @@ } |
@@ -19,2 +19,7 @@ (function(angular) { | ||
// check if a variable is undefined | ||
function isUndefined(v) { | ||
return typeof v === 'undefined'; | ||
} | ||
// update two-way bound scope properties based on map state | ||
@@ -37,3 +42,3 @@ function updateCenterAndZoom(scope, map) { | ||
var mapPromise; | ||
/** | ||
@@ -230,3 +235,3 @@ * @ngdoc function | ||
self.inUpdateCycle = false; | ||
if (!angular.isUndefined(attrs.center) || !angular.isUndefined(attrs.zoom)) { | ||
if (!isUndefined(attrs.center) || !isUndefined(attrs.zoom)) { | ||
scope.$watchGroup(['mapCtrl.center.lng', 'mapCtrl.center.lat', 'mapCtrl.zoom'], function(newCenterZoom) { | ||
@@ -233,0 +238,0 @@ if (self.inUpdateCycle) { |
@@ -28,2 +28,55 @@ describe('esriLoader', function() { | ||
describe('bootstrap', function() { | ||
describe('when not loaded', function() { | ||
// watch for appending a script | ||
beforeEach(function() { | ||
spyOn(document.body, 'appendChild'); | ||
}); | ||
describe('when not passing url in options', function() { | ||
it('should default to 3.14compact', function() { | ||
var url = 'http://js.arcgis.com/3.14compact'; | ||
esriLoader.bootstrap(); | ||
expect(document.body.appendChild.calls.argsFor(0)[0].src).toEqual(url); | ||
}); | ||
}); | ||
describe('when passing url in options', function() { | ||
it('should have same url', function() { | ||
var url = 'http://js.arcgis.com/3.14'; | ||
esriLoader.bootstrap({ | ||
url: url | ||
}); | ||
expect(document.body.appendChild.calls.argsFor(0)[0].src).toEqual(url); | ||
}); | ||
}); | ||
}); | ||
describe('when loaded', function() { | ||
// fake that JSAPI is loaded and mock dojo/require | ||
// and watch for appending a script | ||
beforeEach(function() { | ||
window.require = function() { | ||
console.log(arguments); | ||
}; | ||
}); | ||
// clean up mocked requied | ||
afterEach(function() { | ||
delete window.require; | ||
}); | ||
it('should reject the promise', function() { | ||
esriLoader.bootstrap().catch(function(err) { | ||
expect(typeof err).toEqual('string'); | ||
}); | ||
$rootScope.$digest(); | ||
}); | ||
}); | ||
}); | ||
describe('require', function() { | ||
@@ -44,3 +97,2 @@ | ||
beforeEach(function() { | ||
window.esri = true; | ||
window.require = function(moduleNames, callback) { | ||
@@ -57,2 +109,7 @@ var fakeModules = moduleNames.map(function(moduleName) { | ||
// clean up mocked requied | ||
afterEach(function() { | ||
delete window.require; | ||
}); | ||
describe('when passed a single module name as string', function() { | ||
@@ -59,0 +116,0 @@ describe('and a callback function', function() { |
@@ -52,2 +52,3 @@ // Karma configuration | ||
'karma-phantomjs-launcher', | ||
'karma-firefox-launcher', | ||
'karma-jasmine', | ||
@@ -54,0 +55,0 @@ 'karma-coverage' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15210536
129
3591
123
0
28