Wordpress/tests/qunit/editor/tinymce/util/JSONRequest.js
Andrew Ozz 0898014ebd Update the TinyMCE tests.
In 4.0.20 all tests were reworked. The 'testrunner' was removed and the PhantomJS Runner QUnit plugin was added making it possible to run the tests from cli. However it is still necessary to run the tests in all supported browsers to test the fixes for all browser quirks and normalization. Also all tests are loaded in one html file.

See #27014

git-svn-id: https://develop.svn.wordpress.org/trunk@27679 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 05:59:45 +00:00

56 lines
1.1 KiB
JavaScript

if (location.protocol != "file:") {
module("tinymce.util.JSONRequest");
asyncTest("Successful request - send method", function() {
expect(1);
new tinymce.util.JSONRequest({}).send({
type : 'GET',
url : 'tinymce/util/json_rpc_ok.js',
success: function(data) {
equal(data, 'Hello JSON-RPC');
start();
}
});
});
asyncTest("Successful request - sendRPC static method", function() {
expect(1);
tinymce.util.JSONRequest.sendRPC({
type : 'GET',
url : 'tinymce/util/json_rpc_ok.js',
success: function(data) {
equal(data, 'Hello JSON-RPC');
start();
}
});
});
asyncTest("Error request - send method", function() {
expect(1);
new tinymce.util.JSONRequest({}).send({
type : 'GET',
url : 'tinymce/util/json_rpc_error.js',
error: function(error) {
equal(error.code, 42);
start();
}
});
});
asyncTest("Error request - sendRPC static method", function() {
expect(1);
tinymce.util.JSONRequest.sendRPC({
type : 'GET',
url : 'tinymce/util/json_rpc_error.js',
error: function(error) {
equal(error.code, 42);
start();
}
});
});
}