set autotext = always if display is function

This commit is contained in:
vitalets
2013-06-13 10:36:41 +04:00
parent 655aeebdc2
commit 79c06725ba
4 changed files with 25 additions and 8 deletions

@ -615,7 +615,7 @@ $(function () {
asyncTest("'display' callback", function () {
var req = 0,
e = $('<a href="#" data-type="select" data-value="2" data-url="post.php"></a>').appendTo(fx).editable({
e = $('<a href="#" data-type="select" data-value="2" data-url="post.php">123</a>').appendTo(fx).editable({
pk: 1,
source: groups,
ajaxOptions: {

@ -374,17 +374,27 @@ $(function () {
asyncTest("'display' callback", function () {
var newText = 'cd<e>;"',
e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">abc</a>').appendTo(fx).editable({
counter = 0,
initialVal = 'abc',
e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">123</a>').appendTo(fx).editable({
ajaxOptions: {
dataType: 'json'
},
display: function(value, response) {
ok(this === e[0], 'scope is ok');
ok(response.success, 'response param ok');
$(this).text('qq'+value);
}
});
if(counter === 0) {
ok(response === undefined, 'initial autotext ok as display is func');
$(this).text(initialVal);
} else {
ok(this === e[0], 'updating, scope is ok');
ok(response.success, 'response param ok');
$(this).text('qq'+value);
}
counter++;
}
});
equal(e.text(), initialVal, 'initial autotext ok');
e.click()
var p = tip(e);