fix(scenario): make browser().location() working if ng-app on other than <html>

This commit is contained in:
Vojta Jina 2012-04-14 10:39:24 -07:00
parent 499a76a08c
commit 5bcb749abb
2 changed files with 11 additions and 5 deletions

View file

@ -92,9 +92,15 @@ angular.scenario.Application.prototype.executeAction = function(action) {
}
angularInit($window.document, function(element) {
var $injector = $window.angular.element(element).injector();
var $element = _jQuery(element);
$element.injector = function() {
return $injector;
};
$injector.invoke(function($browser){
$browser.notifyWhenNoOutstandingRequests(function() {
action.call(self, $window, _jQuery($window.document));
action.call(self, $window, $element);
});
});
});

View file

@ -103,25 +103,25 @@ angular.scenario.dsl('browser', function() {
api.url = function() {
return this.addFutureAction('$location.url()', function($window, $document, done) {
done(null, $window.angular.element($window.document).injector().get('$location').url());
done(null, $document.injector().get('$location').url());
});
};
api.path = function() {
return this.addFutureAction('$location.path()', function($window, $document, done) {
done(null, $window.angular.element($window.document).injector().get('$location').path());
done(null, $document.injector().get('$location').path());
});
};
api.search = function() {
return this.addFutureAction('$location.search()', function($window, $document, done) {
done(null, $window.angular.element($window.document).injector().get('$location').search());
done(null, $document.injector().get('$location').search());
});
};
api.hash = function() {
return this.addFutureAction('$location.hash()', function($window, $document, done) {
done(null, $window.angular.element($window.document).injector().get('$location').hash());
done(null, $document.injector().get('$location').hash());
});
};