diff --git a/docs/components/angular-bootstrap/bootstrap-prettify.js b/docs/components/angular-bootstrap/bootstrap-prettify.js
index 9d8a7d23482e..169d232b6075 100644
--- a/docs/components/angular-bootstrap/bootstrap-prettify.js
+++ b/docs/components/angular-bootstrap/bootstrap-prettify.js
@@ -102,7 +102,12 @@ directive.prettyprint = ['reindentCode', function(reindentCode) {
//ensure that angular won't compile {{ curly }} values
html = html.replace(/\{\{/g, '{{')
.replace(/\}\}/g, '}}');
- element.html(window.prettyPrintOne(reindentCode(html), undefined, true));
+ if (window.RUNNING_IN_NG_TEST_RUNNER) {
+ element.html(html);
+ }
+ else {
+ element.html(window.prettyPrintOne(reindentCode(html), undefined, true));
+ }
}
};
}];
diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html
index e4afc731ccd3..0788e4153626 100644
--- a/docs/src/templates/index.html
+++ b/docs/src/templates/index.html
@@ -20,6 +20,11 @@
// we can't add css/js the usual way, because some browsers (FF) eagerly prefetch resources
// before the base attribute is added, causing 404 and terribly slow loading of the docs app.
(function() {
+ if (window.name.indexOf('NG_DEFER_BOOTSTRAP!') == 0) {
+ //TODO(i): super ugly hack to temporarily speed up our e2e tests until we move to protractor + extracted examples
+ window.RUNNING_IN_NG_TEST_RUNNER = true;
+ }
+
var indexFile = (location.pathname.match(/\/(index[^\.]*\.html)/) || ['', ''])[1],
rUrl = /(#!\/|api|guide|misc|tutorial|cookbook|error|index[^\.]*\.html).*$/,
baseUrl = location.href.replace(rUrl, indexFile),
@@ -49,8 +54,10 @@
addTag('script', {src: path('angular-animate.js') }, sync);
addTag('script', {src: 'components/angular-bootstrap.js' }, sync);
addTag('script', {src: 'components/angular-bootstrap-prettify.js' }, sync);
- addTag('script', {src: 'components/google-code-prettify.js' }, sync);
- addTag('script', {src: 'components/' + (debug ? 'lunr.js' : 'lunr.min.js') }, sync);
+ if (!window.RUNNING_IN_NG_TEST_RUNNER) {
+ addTag('script', {src: 'components/google-code-prettify.js' }, sync);
+ addTag('script', {src: 'components/' + (debug ? 'lunr.js' : 'lunr.min.js') }, sync);
+ }
addTag('script', {src: 'components/marked.js' }, sync);
addTag('script', {src: 'docs-data.js'}, sync);
addTag('script', {src: 'js/docs.js'}, sync);
@@ -112,11 +119,13 @@
_gaq.push(['_setAccount', 'UA-8594346-3']);
_gaq.push(['_setDomainName', '.angularjs.org']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
+ if (!window.RUNNING_IN_NG_TEST_RUNNER) {
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+ }
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js
index 16042b3a380e..1deea88e634b 100644
--- a/docs/src/templates/js/docs.js
+++ b/docs/src/templates/js/docs.js
@@ -109,6 +109,8 @@ docsApp.controller.DocsNavigationCtrl = ['$scope', '$location', 'docsSearch', fu
docsApp.serviceFactory.lunrSearch = function() {
return function(properties) {
+ if (window.RUNNING_IN_NG_TEST_RUNNER) return null;
+
var engine = lunr(properties);
return {
store : function(values) {
@@ -122,7 +124,10 @@ docsApp.serviceFactory.lunrSearch = function() {
};
docsApp.serviceFactory.docsSearch = ['$rootScope','lunrSearch', 'NG_PAGES',
- function($rootScope, lunrSearch, NG_PAGES) {
+ function($rootScope, lunrSearch, NG_PAGES) {
+ if (window.RUNNING_IN_NG_TEST_RUNNER) {
+ return null;
+ }
var index = lunrSearch(function() {
this.ref('id');
diff --git a/src/auto/injector.js b/src/auto/injector.js
index f165030fb335..96ea0bf45c25 100644
--- a/src/auto/injector.js
+++ b/src/auto/injector.js
@@ -52,13 +52,15 @@ function annotate(fn) {
if (typeof fn == 'function') {
if (!($inject = fn.$inject)) {
$inject = [];
- fnText = fn.toString().replace(STRIP_COMMENTS, '');
- argDecl = fnText.match(FN_ARGS);
- forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
- arg.replace(FN_ARG, function(all, underscore, name){
- $inject.push(name);
+ if (fn.length) {
+ fnText = fn.toString().replace(STRIP_COMMENTS, '');
+ argDecl = fnText.match(FN_ARGS);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
+ arg.replace(FN_ARG, function(all, underscore, name){
+ $inject.push(name);
+ });
});
- });
+ }
fn.$inject = $inject;
}
} else if (isArray(fn)) {