Index: remoting/webapp/crd/js/xhr_unittest.js |
diff --git a/remoting/webapp/crd/js/xhr_unittest.js b/remoting/webapp/crd/js/xhr_unittest.js |
index ea32042abe9f6c60cbfc3322af9ee19b201febe2..993bd7a9940193c4cef7c9002d7f74bc2253dd47 100644 |
--- a/remoting/webapp/crd/js/xhr_unittest.js |
+++ b/remoting/webapp/crd/js/xhr_unittest.js |
@@ -11,14 +11,14 @@ |
'use strict'; |
-module('xhr', { |
- setup: function() { |
+QUnit.module('xhr', { |
+ beforeEach: function() { |
}, |
- teardown: function() { |
+ afterEach: function() { |
} |
Jamie
2015/03/17 17:57:16
Remove?
kelvinp
2015/03/17 18:13:58
Done.
|
}); |
-test('urlencodeParamHash', function() { |
+QUnit.test('urlencodeParamHash', function() { |
QUnit.equal( |
remoting.xhr.urlencodeParamHash({}), |
''); |
@@ -33,8 +33,9 @@ test('urlencodeParamHash', function() { |
'k1=v1&k2=v2'); |
}); |
-asyncTest('basic GET', function() { |
+QUnit.test('basic GET', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var request = remoting.xhr.start({ |
method: 'GET', |
url: 'http://foo.com', |
@@ -42,7 +43,7 @@ asyncTest('basic GET', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
} |
}); |
QUnit.equal(request.method, 'GET'); |
@@ -53,7 +54,8 @@ asyncTest('basic GET', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('GET with param string', function() { |
+QUnit.test('GET with param string', function(assert) { |
+ var done = assert.async(); |
sinon.useFakeXMLHttpRequest(); |
var request = remoting.xhr.start({ |
method: 'GET', |
@@ -62,7 +64,7 @@ asyncTest('GET with param string', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
urlParams: 'the_param_string' |
}); |
@@ -74,7 +76,8 @@ asyncTest('GET with param string', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('GET with param object', function() { |
+QUnit.test('GET with param object', function(assert) { |
+ var done = assert.async(); |
sinon.useFakeXMLHttpRequest(); |
var request = remoting.xhr.start({ |
method: 'GET', |
@@ -83,7 +86,7 @@ asyncTest('GET with param object', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
urlParams: {'a': 'b', 'c': 'd'} |
}); |
@@ -95,8 +98,9 @@ asyncTest('GET with param object', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('GET with headers', function() { |
+QUnit.test('GET with headers', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var request = remoting.xhr.start({ |
method: 'GET', |
url: 'http://foo.com', |
@@ -104,7 +108,7 @@ asyncTest('GET with headers', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
headers: {'Header1': 'headerValue1', 'Header2': 'headerValue2'} |
}); |
@@ -123,8 +127,9 @@ asyncTest('GET with headers', function() { |
}); |
-asyncTest('GET with credentials', function() { |
+QUnit.test('GET with credentials', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var request = remoting.xhr.start({ |
method: 'GET', |
url: 'http://foo.com', |
@@ -132,7 +137,7 @@ asyncTest('GET with credentials', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
withCredentials: true |
}); |
@@ -144,8 +149,9 @@ asyncTest('GET with credentials', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('POST with text content', function() { |
+QUnit.test('POST with text content', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var request = remoting.xhr.start({ |
method: 'POST', |
url: 'http://foo.com', |
@@ -153,7 +159,7 @@ asyncTest('POST with text content', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
textContent: 'the_content_string' |
}); |
@@ -165,8 +171,9 @@ asyncTest('POST with text content', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('POST with form content', function() { |
+QUnit.test('POST with form content', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var request = remoting.xhr.start({ |
method: 'POST', |
url: 'http://foo.com', |
@@ -174,7 +181,7 @@ asyncTest('POST with form content', function() { |
QUnit.ok(xhr === request); |
QUnit.equal(xhr.status, 200); |
QUnit.equal(xhr.responseText, 'body'); |
- QUnit.start(); |
+ done(); |
}, |
formContent: {'a': 'b', 'c': 'd'} |
}); |
@@ -188,17 +195,18 @@ asyncTest('POST with form content', function() { |
request.respond(200, {}, 'body'); |
}); |
-asyncTest('defaultResponse 200', function() { |
+QUnit.test('defaultResponse 200', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
+ var done = assert.async(); |
var onDone = function() { |
QUnit.ok(true); |
- QUnit.start(); |
+ done(); |
}; |
var onError = function(error) { |
QUnit.ok(false); |
- QUnit.start(); |
+ done(); |
}; |
var request = remoting.xhr.start({ |
@@ -210,17 +218,17 @@ asyncTest('defaultResponse 200', function() { |
}); |
-asyncTest('defaultResponse 404', function() { |
+QUnit.test('defaultResponse 404', function(assert) { |
sinon.useFakeXMLHttpRequest(); |
- |
+ var done = assert.async(); |
var onDone = function() { |
QUnit.ok(false); |
- QUnit.start(); |
+ done(); |
}; |
var onError = function(error) { |
QUnit.ok(true); |
- QUnit.start(); |
+ done(); |
}; |
var request = remoting.xhr.start({ |