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() {
this.addFutureAction('clear all cookies', function($window, $document, done) {
var rootScope = $window.angular.element($document[0]).data('$scope'),
$cookies = rootScope.$service('$cookies'),
var element = $window.angular.element($document[0]),
rootScope = element.scope(),
$cookies = element.data('$injector')('$cookies'),
cookieName;
rootScope.$apply(function() {

View file

@ -956,7 +956,9 @@ function angularInit(config, document){
});
createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){
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) {
return action.call(this, $window, _jQuery($window.document));
}
var $browser = $window.angular.service.$browser();
$browser.notifyWhenNoOutstandingRequests(function() {
action.call(self, $window, _jQuery($window.document));
var element = $window.angular.element($window.document.body);
var $injector = element.inheritedData('$injector');
$injector(function($browser){
$browser.notifyWhenNoOutstandingRequests(function() {
action.call(self, $window, _jQuery($window.document));
});
});
};