mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-19 16:10:22 +00:00
refactor(api): cleaned up the externalization of angular API methods
This commit is contained in:
parent
9062996a0e
commit
4c10d33eb4
3 changed files with 31 additions and 54 deletions
|
|
@ -1015,6 +1015,34 @@ function assertArgFn(arg, name) {
|
|||
return arg;
|
||||
}
|
||||
|
||||
function publishExternalAPI(angular){
|
||||
extend(angular, {
|
||||
// disabled for now until we agree on public name
|
||||
//'annotate': annotate,
|
||||
'copy': copy,
|
||||
'extend': extend,
|
||||
'equals': equals,
|
||||
'forEach': forEach,
|
||||
'injector': createInjector,
|
||||
'noop':noop,
|
||||
'bind':bind,
|
||||
'toJson': toJson,
|
||||
'fromJson': fromJson,
|
||||
'identity':identity,
|
||||
'isUndefined': isUndefined,
|
||||
'isDefined': isDefined,
|
||||
'isString': isString,
|
||||
'isFunction': isFunction,
|
||||
'isObject': isObject,
|
||||
'isNumber': isNumber,
|
||||
'isArray': isArray,
|
||||
'version': version,
|
||||
'isDate': isDate,
|
||||
'lowercase': lowercase,
|
||||
'uppercase': uppercase
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc property
|
||||
|
|
|
|||
|
|
@ -11,31 +11,7 @@ angularService('$browser', function($log, $sniffer) {
|
|||
}, {$inject: ['$log', '$sniffer']});
|
||||
|
||||
|
||||
extend(angular, {
|
||||
// disabled for now until we agree on public name
|
||||
//'annotate': annotate,
|
||||
'copy': copy,
|
||||
'extend': extend,
|
||||
'equals': equals,
|
||||
'forEach': forEach,
|
||||
'injector': createInjector,
|
||||
'noop':noop,
|
||||
'bind':bind,
|
||||
'toJson': toJson,
|
||||
'fromJson': fromJson,
|
||||
'identity':identity,
|
||||
'isUndefined': isUndefined,
|
||||
'isDefined': isDefined,
|
||||
'isString': isString,
|
||||
'isFunction': isFunction,
|
||||
'isObject': isObject,
|
||||
'isNumber': isNumber,
|
||||
'isArray': isArray,
|
||||
'version': version,
|
||||
'isDate': isDate,
|
||||
'lowercase': lowercase,
|
||||
'uppercase': uppercase
|
||||
});
|
||||
publishExternalAPI(angular);
|
||||
|
||||
//try to bind to jquery now so that one can write angular.element().read()
|
||||
//but we will rebind on bootstrap again.
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ function dumpScope(scope, offset) {
|
|||
return log.join('\n' + offset);
|
||||
}
|
||||
|
||||
publishExternalAPI(angular)
|
||||
beforeEach(function() {
|
||||
publishExternalAPI(angular)
|
||||
// This is to reset parsers global cache of expressions.
|
||||
compileCache = {};
|
||||
|
||||
|
|
@ -80,7 +82,6 @@ beforeEach(function() {
|
|||
$logMock.info.logs = [];
|
||||
$logMock.error.logs = [];
|
||||
|
||||
resetAngularPublic()
|
||||
});
|
||||
|
||||
function inject(){
|
||||
|
|
@ -118,34 +119,6 @@ function inject(){
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This method republishes the public angular API. It should probably be cleaned up somehow.
|
||||
* //TODO: remove this method and merge it with the angularPublic.js class
|
||||
*/
|
||||
function resetAngularPublic() {
|
||||
extend(angular, {
|
||||
'element': jqLite,
|
||||
'copy': copy,
|
||||
'extend': extend,
|
||||
'equals': equals,
|
||||
'forEach': forEach,
|
||||
'noop': noop,
|
||||
'bind': bind,
|
||||
'toJson': toJson,
|
||||
'fromJson': fromJson,
|
||||
'identity':identity,
|
||||
'injector': createInjector,
|
||||
'isUndefined': isUndefined,
|
||||
'isDefined': isDefined,
|
||||
'isString': isString,
|
||||
'isFunction': isFunction,
|
||||
'isObject': isObject,
|
||||
'isNumber': isNumber,
|
||||
'isArray': isArray
|
||||
});
|
||||
}
|
||||
|
||||
resetAngularPublic();
|
||||
|
||||
afterEach(inject(function($rootScope) {
|
||||
// release the injector
|
||||
|
|
|
|||
Loading…
Reference in a new issue