refactor(scenario): fix scenario bootstrap & publish injector for inspection

This commit is contained in:
Misko Hevery 2011-11-07 21:55:41 -08:00
parent 7cb03c5ab9
commit 4b35a59c6a
3 changed files with 12 additions and 6 deletions

View file

@ -81,8 +81,9 @@ angular.scenario.dsl('clearCookies', function() {
*/ */
return function() { return function() {
this.addFutureAction('clear all cookies', function($window, $document, done) { this.addFutureAction('clear all cookies', function($window, $document, done) {
var rootScope = $window.angular.element($document[0]).data('$scope'), var element = $window.angular.element($document[0]),
$cookies = rootScope.$service('$cookies'), rootScope = element.scope(),
$cookies = element.data('$injector')('$cookies'),
cookieName; cookieName;
rootScope.$apply(function() { rootScope.$apply(function() {

View file

@ -956,7 +956,9 @@ function angularInit(config, document){
}); });
createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){ createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){
scope.$apply(function(){ scope.$apply(function(){
compile(isString(autobind) ? document.getElementById(autobind) : document)(scope); var element = jqLite(isString(autobind) ? document.getElementById(autobind) : document);
element.data('$injector', injector);
compile(element)(scope);
}); });
}]); }]);
} }

View file

@ -90,8 +90,11 @@ angular.scenario.Application.prototype.executeAction = function(action) {
if (!$window.angular) { if (!$window.angular) {
return action.call(this, $window, _jQuery($window.document)); return action.call(this, $window, _jQuery($window.document));
} }
var $browser = $window.angular.service.$browser(); var element = $window.angular.element($window.document.body);
$browser.notifyWhenNoOutstandingRequests(function() { var $injector = element.inheritedData('$injector');
action.call(self, $window, _jQuery($window.document)); $injector(function($browser){
$browser.notifyWhenNoOutstandingRequests(function() {
action.call(self, $window, _jQuery($window.document));
});
}); });
}; };