fix tests order

This commit is contained in:
vitalets 2012-12-10 15:13:19 +04:00
parent 819bcfcd30
commit 00450916e2
7 changed files with 44 additions and 26 deletions

@ -145,7 +145,8 @@ define(function () {
return {
baseUrl: baseUrl,
paths: {
"bootstrap": "../test/libs/bootstrap221",
// "bootstrap": "../test/libs/bootstrap221",
"bootstrap": "../test/libs/bootstrap222",
"jqueryui": "../test/libs/jquery-ui-1.9.1.custom",
"poshytip": "../test/libs/poshytip",
"test": "../test"

@ -4,30 +4,41 @@ var jqver = decodeURIComponent((new RegExp('[?|&]' + 'jquery' + '=' + '([^&;]+?)
require(["loader", jqurl], function(loader) {
requirejs.config(loader.getConfig("../src"));
var config = loader.getConfig("../src"),
params = loader.getParams();
//add test specific dependencies
config.shim['test/mocks'] = ['element/editable-element', 'test/libs/mockjax/jquery.mockjax'];
//as we need to keep order of tests, create shim dependencies automatically
addTests(config);
requirejs.config(config);
require(['element/editable-element',
'test/libs/mockjax/jquery.mockjax'
],
require(['test/unit/api'],
function() {
//disable effects
$.fx.off = true;
$.support.transition = false;
var params = loader.getParams();
require([
QUnit.load();
QUnit.start();
});
function addTests(config) {
var tests = [
'test/mocks',
'test/unit/common',
'test/unit/text',
'test/unit/textarea',
'test/unit/select',
'test/unit/checklist',
'test/unit/api',
(params.f === 'bootstrap') ? 'test/unit/date' : 'test/unit/dateui'
], function() {
QUnit.load();
QUnit.start();
});
});
(params.f === 'bootstrap') ? 'test/unit/date' : 'test/unit/dateui',
'test/unit/api'
];
for(var i=0; i<tests.length-1; i++) {
config.shim[tests[i+1]] = [tests[i]];
}
}
});

@ -57,7 +57,7 @@ $(function () {
});
// useful functions
// usefull functions
function tip(e) {
return e.data('editableContainer').tip();

@ -223,12 +223,12 @@ $(function () {
var ev1 = 'ev1',
ev2 = 'ev2',
e1v = 'e1v',
e = $('<a href="#" class="new" data-type="text" data-url="post.php" data-name="text">'+ev1+'</a>').appendTo(fx).editable({
e = $('<a href="#" class="new-val" data-type="text" data-url="post.php" data-name="text">'+ev1+'</a>').appendTo(fx).editable({
validate: function(value) {
if(value == ev1) return 'invalid';
}
}),
e1 = $('<a href="#" class="new" data-type="text" data-name="text1">'+e1v+'</a>').appendTo(fx).editable();
e1 = $('<a href="#" class="new-val" data-type="text" data-name="text1">'+e1v+'</a>').appendTo(fx).editable();
$.mockjax({
url: 'new-error.php',
@ -251,7 +251,7 @@ $(function () {
}
});
$(fx).find('.new').editable('submit', {
$(fx).find('.new-val').editable('submit', {
url: 'new.php',
error: function(errors) {
equal(errors.text, 'invalid', 'client validation error ok');
@ -264,7 +264,7 @@ $(function () {
p.find('input[type=text]').val(ev2);
p.find('button[type=submit]').click();
$(fx).find('.new').editable('submit', {
$(fx).find('.new-val').editable('submit', {
url: 'new-error.php',
data: {a: 123},
success: function(data, config) {
@ -301,14 +301,14 @@ $(function () {
asyncTest("'submit' method: server error", function () {
var ev1 = 'ev1',
e1v = 'e1v',
e = $('<a href="#" class="new" data-type="text" data-url="post.php" data-name="text">'+ev1+'</a>').appendTo(fx).editable(),
e1 = $('<a href="#" class="new" data-type="text" data-name="text1">'+e1v+'</a>').appendTo(fx).editable();
e = $('<a href="#" class="new-err" data-type="text" data-url="post.php" data-name="text">'+ev1+'</a>').appendTo(fx).editable(),
e1 = $('<a href="#" class="new-err" data-type="text" data-name="text1">'+e1v+'</a>').appendTo(fx).editable();
$(fx).find('.new').editable('submit', {
$(fx).find('.new-err').editable('submit', {
url: 'error.php',
error: function(data) {
equal(this[0], $(fx).find('.new')[0], 'success context ok');
equal(this[1], $(fx).find('.new')[1], 'success context2 ok');
equal(this[0], $(fx).find('.new-err')[0], 'success context ok');
equal(this[1], $(fx).find('.new-err')[1], 'success context2 ok');
equal(data.status, 500, 'status 500 ok');
equal(data.responseText, 'customtext', 'server error ok');
@ -347,6 +347,9 @@ $(function () {
e.remove();
e1.remove();
start();
},
error: function(errors) {
ok(false, 'error should not be called');
}
});

@ -3,7 +3,8 @@ $(function () {
module("checklist", {
setup: function(){
sfx = $('#qunit-fixture'),
fx = $('#async-fixture');
fx = $('#async-fixture');
$.support.transition = false;
}
});

@ -6,6 +6,7 @@ $(function () {
setup: function(){
fx = $('#async-fixture');
dpg = $.fn.datepicker.DPGlobal;
$.support.transition = false;
}
});

@ -5,6 +5,7 @@ $(function () {
module("dateui", {
setup: function(){
fx = $('#async-fixture');
$.support.transition = false;
}
});