cancelnochange option
This commit is contained in:
@ -389,6 +389,64 @@
|
||||
}, timeout);
|
||||
|
||||
});
|
||||
|
||||
asyncTest("cancelnochange: true", function () {
|
||||
var v = 'abc',
|
||||
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-no.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
|
||||
cancelnochange: true
|
||||
}),
|
||||
req = 0;
|
||||
|
||||
$.mockjax({
|
||||
url: 'post-no.php',
|
||||
response: function() {
|
||||
req++;
|
||||
}
|
||||
});
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
ok(p.is(':visible'), 'popover visible');
|
||||
p.find('input[type="text"]').val(v);
|
||||
p.find('form').submit();
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed');
|
||||
equal(req, 0, 'request was not performed');
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
asyncTest("cancelnochange: false", function () {
|
||||
var v = 'abc',
|
||||
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-yes.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
|
||||
cancelnochange: false
|
||||
}),
|
||||
req = 0;
|
||||
|
||||
$.mockjax({
|
||||
url: 'post-yes.php',
|
||||
response: function() {
|
||||
req++;
|
||||
}
|
||||
});
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
ok(p.is(':visible'), 'popover visible');
|
||||
p.find('input[type="text"]').val(v);
|
||||
p.find('form').submit();
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed');
|
||||
equal(req, 1, 'request was performed');
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//unfortunatly, testing this feature does not always work in browsers. Tested manually.
|
||||
|
@ -149,30 +149,6 @@ $(function () {
|
||||
});
|
||||
*/
|
||||
|
||||
asyncTest("should not perform request if value not changed", function () {
|
||||
var e = $('<a href="#" data-pk="1" data-url="post-no.php" data-name="text1">abc</a>').appendTo(fx).editable(),
|
||||
req = 0;
|
||||
|
||||
$.mockjax({
|
||||
url: 'post-no.php',
|
||||
response: function() {
|
||||
req++;
|
||||
}
|
||||
});
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
ok(p.is(':visible'), 'popover visible');
|
||||
p.find('button[type=submit]').click();
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed');
|
||||
equal(req, 0, 'request was not performed');
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
asyncTest("should show error if success callback returns string", function () {
|
||||
var newText = 'cd<e>;"',
|
||||
e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">abc</a>').appendTo(fx).editable({
|
||||
|
Reference in New Issue
Block a user