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

Commit 4caff8f

Browse files
committed
WIP: make mock $browser symmetrical with real $browser
1 parent 5ee60c9 commit 4caff8f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ng/location.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,8 @@ function $LocationProvider(){
752752
* window events (or polling if events aren't supported), but those methods are
753753
* async. For this reason, $browser.url() will perform a comparison with each call
754754
* to the method as a getter.
755-
* NOTE: Method does not exist on mock $browser
756755
*/
757-
if ($browser.urlChangedOutsideAngular && $browser.urlChangedOutsideAngular()) {
756+
if ($browser.urlChangedOutsideAngular()) {
758757
$location.$$parse(browserUrl);
759758
$browser.urlChangedOutsideAngular(false);
760759
}

src/ngMock/angular-mocks.js

+11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ angular.mock.$Browser = function() {
3535
self.$$url = "http://server/";
3636
self.$$lastUrl = self.$$url; // used by url polling fn
3737
self.pollFns = [];
38+
self.$$hasChangedOutside = false;
3839

3940
// TODO(vojta): remove this temporary api
4041
self.$$completeOutstandingRequest = angular.noop;
@@ -68,6 +69,16 @@ angular.mock.$Browser = function() {
6869
return self.deferredNextId++;
6970
};
7071

72+
self.urlChangedOutsideAngular = function (hasChanged) {
73+
if (isDefined(hasChanged)) {
74+
self.$$hasChangedOutside = hasChanged;
75+
return self;
76+
}
77+
else {
78+
return self.$$hasChangedOutside;
79+
}
80+
};
81+
7182

7283
/**
7384
* @name $browser#defer.now

0 commit comments

Comments
 (0)