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

Commit 5bcb749

Browse files
committed
fix(scenario): make browser().location() working if ng-app on other than <html>
1 parent 499a76a commit 5bcb749

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/ngScenario/Application.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ angular.scenario.Application.prototype.executeAction = function(action) {
9292
}
9393
angularInit($window.document, function(element) {
9494
var $injector = $window.angular.element(element).injector();
95+
var $element = _jQuery(element);
96+
97+
$element.injector = function() {
98+
return $injector;
99+
};
100+
95101
$injector.invoke(function($browser){
96102
$browser.notifyWhenNoOutstandingRequests(function() {
97-
action.call(self, $window, _jQuery($window.document));
103+
action.call(self, $window, $element);
98104
});
99105
});
100106
});

src/ngScenario/dsl.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,25 @@ angular.scenario.dsl('browser', function() {
103103

104104
api.url = function() {
105105
return this.addFutureAction('$location.url()', function($window, $document, done) {
106-
done(null, $window.angular.element($window.document).injector().get('$location').url());
106+
done(null, $document.injector().get('$location').url());
107107
});
108108
};
109109

110110
api.path = function() {
111111
return this.addFutureAction('$location.path()', function($window, $document, done) {
112-
done(null, $window.angular.element($window.document).injector().get('$location').path());
112+
done(null, $document.injector().get('$location').path());
113113
});
114114
};
115115

116116
api.search = function() {
117117
return this.addFutureAction('$location.search()', function($window, $document, done) {
118-
done(null, $window.angular.element($window.document).injector().get('$location').search());
118+
done(null, $document.injector().get('$location').search());
119119
});
120120
};
121121

122122
api.hash = function() {
123123
return this.addFutureAction('$location.hash()', function($window, $document, done) {
124-
done(null, $window.angular.element($window.document).injector().get('$location').hash());
124+
done(null, $document.injector().get('$location').hash());
125125
});
126126
};
127127

0 commit comments

Comments
 (0)