8000 Cleanup phantomjs support in test.js. · lodash/lodash@720e19a · GitHub
[go: up one dir, main page]

Skip to content

Commit 720e19a

Browse files
committed
Cleanup phantomjs support in test.js.
1 parent 3560fed commit 720e19a

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

test/test.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
'use strict';
33

44
/** Object shortcuts */
5-
var phantom = root.phantom,
5+
var amd = root.define && define.amd,
6+
phantom = root.phantom,
67
process = root.process,
78
system = root.system;
89

@@ -27,7 +28,7 @@
2728
result = (result.length > min && !/test(?:\.js)?$/.test(last)) ? last : '../lodash.js';
2829

2930
try {
30-
if (typeof define == 'undefined') {
31+
if (!amd) {
3132
return require('fs').realpathSync(result);
3233
}
3334
} catch(e) { }
@@ -51,7 +52,7 @@
5152
if (phantom && isModularize) {
5253
var page = require('webpage').create();
5354
page.open(filePath, function(status) {
54-
if (status !== 'success') {
55+
if (status != 'success') {
5556
console.log('PhantomJS failed to load page: ' + filePath);
5657
phantom.exit(1);
5758
}
@@ -68,17 +69,11 @@
6869
page.onInitialized = function() {
6970
page.evaluate(function() {
7071
document.addEventListener('DOMContentLoaded', function() {
71-
var xhr = new XMLHttpRequest;
72-
xhr.open('GET', '../vendor/qunit-clib/qunit-clib.js');
73-
xhr.onload = function() {
74-
var script = document.createElement('script');
75-
script.text = xhr.responseText;
76-
document.head.appendChild(script);
77-
QUnit.done(callPhantom);
78-
};
79-
80-
xhr.send(null);
81-
}, false);
72+
var script = document.createElement('script');
73+
script.src = '../vendor/qunit-clib/qunit-clib.js';
74+
document.head.appendChild(script);
75+
QUnit.done(callPhantom);
76+
});
8277
});
8378
};
8479

@@ -89,14 +84,13 @@
8984

9085
/** Method and object shortcuts */
9186
var document = !phantom && root.document,
92-
amd = root.define && define.amd,
9387
body = document && document.body,
9488
create = Object.create,
9589
freeze = Object.freeze,
9690
push = Array.prototype.push,
9791
slice = Array.prototype.slice,
9892
toString = Object.prototype.toString,
99-
Worker = !phantom && root.Worker;
93+
Worker = document && root.Worker;
10094

10195
/** Detects if running in a PhantomJS web page */
10296
var isPhantomPage = typeof callPhantom == 'function';

0 commit comments

Comments
 (0)
0