Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(scenario): make browser().location() working if ng-app on other t…
Browse files Browse the repository at this point in the history
…han <html>
  • Loading branch information
vojtajina committed May 5, 2012
1 parent 499a76a commit 5bcb749
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/ngScenario/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/ngScenario/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
};

Expand Down

0 comments on commit 5bcb749

Please sign in to comment.