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

Commit fe69d19

Browse files
committed
Bootstrap deferal is in angular as of 1.0.6! Update to use real Angular and slight fixes to make it work with the unmodified Angular lib.
1 parent 4ac9f78 commit fe69d19

File tree

6 files changed

+629
-414
lines changed

6 files changed

+629
-414
lines changed

httpspec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ ptor.findElement(webdriver.By.id('data')).getText().then(function(text) {
8080
ptor.clearMockModules();
8181
ptor.addMockModule('moduleA', mockModuleA);
8282

83-
driver.get('http://www.google.com'); // need to navigate away from an Angular page so that it will
83+
//driver.get('http://www.google.com'); // need to navigate away from an Angular page so that it will
8484
// bootstrap again.
8585

8686
ptor.get('http://localhost:8000/app/index.html#/bindings');

protractor.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports.wrapDriver = function(webdriver) {
88
moduleNames = [],
99
moduleScripts = [];
1010

11-
var PROTRACTOR_URL_LABEL = '_WAITFORMODULES';
11+
var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
1212

1313
var waitForAngular = function() {
1414
return driver.executeAsyncScript(function() {
@@ -45,11 +45,10 @@ exports.wrapDriver = function(webdriver) {
4545
* protractor.get('foo.com');
4646
*/
4747
get: function(destination) {
48-
var parsed = url.parse(destination);
49-
parsed.hash = (parsed.hash ? parsed.hash : '#') + PROTRACTOR_URL_LABEL;
50-
var modifiedUrl = url.format(parsed);
51-
driver.get(modifiedUrl);
52-
// At this point, Angular will pause for us, until angular.resumeBootstrapWithExtraModules is called.
48+
driver.get('about:blank');
49+
driver.executeScript('window.name += "' + DEFER_LABEL + '";' +
50+
'window.location.href = "' + destination + '"');
51+
// At this point, Angular will pause for us, until angular.resumeBootstrap is called.
5352

5453
for (var i = 0; i < moduleScripts.length; ++i) {
5554
driver.executeScript(moduleScripts[i]); // Should this be async?
@@ -58,7 +57,7 @@ exports.wrapDriver = function(webdriver) {
5857
driver.executeAsyncScript(function() {
5958
var callback = arguments[arguments.length - 1];
6059
// Continue to bootstrap Angular.
61-
angular.resumeBootstrapWithExtraModules(arguments[0]);
60+
angular.resumeBootstrap(arguments[0]);
6261
callback();
6362
}, moduleNames);
6463
}

testapp/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<!-- In production use:
3939
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
4040
-->
41-
<script src="lib/angular/angular.js"></script>
41+
<script src="lib/angular_v1.0.6/angular.js"></script>
4242
<script src="js/app.js"></script>
4343
<script src="js/services.js"></script>
4444
<script src="js/controllers.js"></script>

0 commit comments

Comments
 (0)