[devtools] qunit: stop using global variables
test -> QUnit.test
module -> QUnit.module
Related to #5533333.
--- a/devtools/test/data/js_examples/test_simple_failure.js Wed May 20 15:12:58 2015 +0200
+++ b/devtools/test/data/js_examples/test_simple_failure.js Wed May 20 17:04:43 2015 +0200
@@ -1,18 +1,18 @@
$(document).ready(function() {
- module("air");
+ QUnit.module("air");
- test("test 1", function() {
+ QUnit.test("test 1", function() {
equal(2, 4);
});
- test("test 2", function() {
+ QUnit.test("test 2", function() {
equal('', '45');
equal('1024', '32');
});
- module("able");
- test("test 3", function() {
+ QUnit.module("able");
+ QUnit.test("test 3", function() {
deepEqual(1, 1);
});
});
--- a/devtools/test/data/js_examples/test_simple_success.js Wed May 20 15:12:58 2015 +0200
+++ b/devtools/test/data/js_examples/test_simple_success.js Wed May 20 17:04:43 2015 +0200
@@ -1,17 +1,17 @@
$(document).ready(function() {
- module("air");
+ QUnit.module("air");
- test("test 1", function() {
+ QUnit.test("test 1", function() {
equal(2, 2);
});
- test("test 2", function() {
+ QUnit.test("test 2", function() {
equal('45', '45');
});
- module("able");
- test("test 3", function() {
+ QUnit.module("able");
+ QUnit.test("test 3", function() {
deepEqual(1, 1);
});
});
--- a/devtools/test/data/js_examples/test_with_dep.js Wed May 20 15:12:58 2015 +0200
+++ b/devtools/test/data/js_examples/test_with_dep.js Wed May 20 17:04:43 2015 +0200
@@ -1,8 +1,8 @@
$(document).ready(function() {
- module("air");
+ QUnit.module("air");
- test("test 1", function() {
+ QUnit.test("test 1", function() {
equal(a, 4);
});
--- a/devtools/test/data/js_examples/test_with_ordered_deps.js Wed May 20 15:12:58 2015 +0200
+++ b/devtools/test/data/js_examples/test_with_ordered_deps.js Wed May 20 17:04:43 2015 +0200
@@ -1,8 +1,8 @@
$(document).ready(function() {
- module("air");
+ QUnit.module("air");
- test("test 1", function() {
+ QUnit.test("test 1", function() {
equal(b, 6);
});
--- a/web/test/jstests/test_ajax.js Wed May 20 15:12:58 2015 +0200
+++ b/web/test/jstests/test_ajax.js Wed May 20 17:04:43 2015 +0200
@@ -1,6 +1,6 @@
$(document).ready(function() {
- module("ajax", {
+ QUnit.module("ajax", {
setup: function() {
this.scriptsLength = $('head script[src]').length-1;
this.cssLength = $('head link[rel=stylesheet]').length-1;
@@ -22,7 +22,7 @@
});
}
- test('test simple h1 inclusion (ajax_url0.html)', function() {
+ QUnit.test('test simple h1 inclusion (ajax_url0.html)', function() {
expect(3);
equal(jQuery('#qunit-fixture').children().length, 0);
stop();
@@ -38,7 +38,7 @@
);
});
- test('test simple html head inclusion (ajax_url1.html)', function() {
+ QUnit.test('test simple html head inclusion (ajax_url1.html)', function() {
expect(6);
var scriptsIncluded = jsSources();
equal(jQuery.inArray('http://foo.js', scriptsIncluded), - 1);
@@ -62,7 +62,7 @@
);
});
- test('test addCallback', function() {
+ QUnit.test('test addCallback', function() {
expect(3);
equal(jQuery('#qunit-fixture').children().length, 0);
stop();
@@ -77,7 +77,7 @@
});
});
- test('test callback after synchronous request', function() {
+ QUnit.test('test callback after synchronous request', function() {
expect(1);
var deferred = new Deferred();
var result = jQuery.ajax({
@@ -101,7 +101,7 @@
});
});
- test('test addCallback with parameters', function() {
+ QUnit.test('test addCallback with parameters', function() {
expect(3);
equal(jQuery('#qunit-fixture').children().length, 0);
stop();
@@ -117,7 +117,7 @@
'Hello', 'world');
});
- test('test callback after synchronous request with parameters', function() {
+ QUnit.test('test callback after synchronous request with parameters', function() {
expect(3);
var deferred = new Deferred();
deferred.addCallback(function(data, req, arg1, arg2) {
@@ -152,7 +152,7 @@
});
});
- test('test addErrback', function() {
+ QUnit.test('test addErrback', function() {
expect(1);
stop();
var d = jQuery('#qunit-fixture').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/nonexistent.html');
@@ -169,7 +169,7 @@
});
});
- test('test callback execution order', function() {
+ QUnit.test('test callback execution order', function() {
expect(3);
var counter = 0;
stop();
@@ -190,7 +190,7 @@
});
});
- test('test already included resources are ignored (ajax_url1.html)', function() {
+ QUnit.test('test already included resources are ignored (ajax_url1.html)', function() {
expect(10);
var scriptsIncluded = jsSources();
// NOTE:
@@ -222,13 +222,13 @@
);
});
- test('test synchronous request loadRemote', function() {
+ QUnit.test('test synchronous request loadRemote', function() {
var res = loadRemote(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajaxresult.json', {},
'GET', true);
deepEqual(res, ['foo', 'bar']);
});
- test('test event on CubicWeb', function() {
+ QUnit.test('test event on CubicWeb', function() {
expect(1);
stop();
var events = null;
@@ -247,7 +247,7 @@
);
});
- test('test event on node', function() {
+ QUnit.test('test event on node', function() {
expect(3);
stop();
var nodes = [];
--- a/web/test/jstests/test_htmlhelpers.js Wed May 20 15:12:58 2015 +0200
+++ b/web/test/jstests/test_htmlhelpers.js Wed May 20 17:04:43 2015 +0200
@@ -1,13 +1,13 @@
$(document).ready(function() {
- module("module2", {
+ QUnit.module("module2", {
setup: function() {
$('#qunit-fixture').append('<select id="theselect" multiple="multiple" size="2">' +
'</select>');
}
});
- test("test first selected", function() {
+ QUnit.test("test first selected", function() {
$('#theselect').append('<option value="foo">foo</option>' +
'<option selected="selected" value="bar">bar</option>' +
'<option value="baz">baz</option>' +
@@ -16,7 +16,7 @@
equal(selected.value, 'bar');
});
- test("test first selected 2", function() {
+ QUnit.test("test first selected 2", function() {
$('#theselect').append('<option value="foo">foo</option>' +
'<option value="bar">bar</option>' +
'<option value="baz">baz</option>' +
@@ -25,8 +25,8 @@
equal(selected, null);
});
- module("visibilty");
- test('toggleVisibility', function() {
+ QUnit.module("visibilty");
+ QUnit.test('toggleVisibility', function() {
$('#qunit-fixture').append('<div id="foo"></div>');
toggleVisibility('foo');
ok($('#foo').hasClass('hidden'), 'check hidden class is set');
--- a/web/test/jstests/test_utils.js Wed May 20 15:12:58 2015 +0200
+++ b/web/test/jstests/test_utils.js Wed May 20 17:04:43 2015 +0200
@@ -1,22 +1,22 @@
$(document).ready(function() {
- module("datetime");
+ QUnit.module("datetime");
- test("test full datetime", function() {
+ QUnit.test("test full datetime", function() {
equal(cw.utils.toISOTimestamp(new Date(1986, 3, 18, 10, 30, 0, 0)),
'1986-04-18 10:30:00');
});
- test("test only date", function() {
+ QUnit.test("test only date", function() {
equal(cw.utils.toISOTimestamp(new Date(1986, 3, 18)), '1986-04-18 00:00:00');
});
- test("test null", function() {
+ QUnit.test("test null", function() {
equal(cw.utils.toISOTimestamp(null), null);
});
- module("parsing");
- test("test basic number parsing", function() {
+ QUnit.module("parsing");
+ QUnit.test("test basic number parsing", function() {
var d = strptime('2008/08/08', '%Y/%m/%d');
deepEqual(datetuple(d), [2008, 8, 8, 0, 0]);
d = strptime('2008/8/8', '%Y/%m/%d');
@@ -31,7 +31,7 @@
deepEqual(datetuple(d), [-35000, 1, 1, 0, 0]);
});
- test("test custom format parsing", function() {
+ QUnit.test("test custom format parsing", function() {
var d = strptime('2008-08-08', '%Y-%m-%d');
deepEqual(datetuple(d), [2008, 8, 8, 0, 0]);
d = strptime('2008 - ! 08: 08', '%Y - ! %m: %d');
@@ -44,8 +44,8 @@
deepEqual(datetuple(d), [2008, 8, 8, 1, 14]);
});
- module("sliceList");
- test("test slicelist", function() {
+ QUnit.module("sliceList");
+ QUnit.test("test slicelist", function() {
var list = ['a', 'b', 'c', 'd', 'e', 'f'];
deepEqual(cw.utils.sliceList(list, 2), ['c', 'd', 'e', 'f']);
deepEqual(cw.utils.sliceList(list, 2, -2), ['c', 'd']);
@@ -54,13 +54,13 @@
deepEqual(cw.utils.sliceList(list), list);
});
- module("formContents", {
+ QUnit.module("formContents", {
setup: function() {
$('#qunit-fixture').append('<form id="test-form"></form>');
}
});
// XXX test fckeditor
- test("test formContents", function() {
+ QUnit.test("test formContents", function() {
$('#test-form').append('<input name="input-text" ' +
'type="text" value="toto" />');
$('#test-form').append('<textarea rows="10" cols="30" '+