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

Commit 964baba

Browse files
authored
fix(clientsidescript): avoid returning the value of test callback in waitForAngular (#4667)
The return value could be interpreted as an error by mistake in some situation Also fix a wrong if-condition in error reporting
1 parent 335680f commit 964baba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/clientsidescripts.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ functions.waitForAngular = function(rootSelector, callback) {
153153
} else if (hooks.$injector) {
154154
hooks.$injector.get('$browser')
155155
.notifyWhenNoOutstandingRequests(callback);
156-
} else if (!!rootSelector) {
156+
} else if (!rootSelector) {
157157
throw new Error(
158158
'Could not automatically find injector on page: "' +
159159
window.location.toString() + '". Consider using config.rootEl');
@@ -178,7 +178,8 @@ functions.waitForAngular = function(rootSelector, callback) {
178178
}
179179
catch(e){}
180180
if (testability) {
181-
return testability.whenStable(function() { testCallback(); });
181+
testability.whenStable(testCallback);
182+
return;
182183
}
183184
}
184185

@@ -191,7 +192,8 @@ functions.waitForAngular = function(rootSelector, callback) {
191192
// No angular2 testability, this happens when
192193
// going to a hybrid page and going back to a pure angular1 page
193194
if (count === 0) {
194-
return testCallback();
195+
testCallback();
196+
return;
195197
}
196198

197199
var decrement = function() {
@@ -696,7 +698,7 @@ functions.findByCssContainingText = function(cssSelector, searchText, using) {
696698
var elementMatches = searchText instanceof RegExp ?
697699
searchText.test(elementText) :
698700
elementText.indexOf(searchText) > -1;
699-
701+
700702
if (elementMatches) {
701703
matches.push(element);
702704
}

0 commit comments

Comments
 (0)