add prerender method in inputs to fix bug on second open

This commit is contained in:
vitalets
2013-01-10 23:15:32 +04:00
parent 1a3f3fc725
commit 473a9d9126
6 changed files with 125 additions and 70 deletions

View File

@@ -40,26 +40,41 @@ $(function () {
}
});
equal(frmt(e.data('editable').value, 'dd.mm.yyyy'), d, 'value correct');
//testing func, run twice!
var func = function() {
var df = $.Deferred();
equal(frmt(e.data('editable').value, 'dd.mm.yyyy'), d, 'value correct');
e.click();
var p = tip(e);
ok(p.find('.ui-datepicker').is(':visible'), 'datepicker exists');
equal(p.find('.ui-datepicker').length, 1, 'datepicker single');
e.click();
var p = tip(e);
ok(p.find('.ui-datepicker').is(':visible'), 'datepicker exists');
equal(p.find('a.ui-state-active').text(), 15, 'day shown correct');
equal(p.find('.ui-datepicker-calendar > thead > tr > th').eq(0).find('span').text(), 'Mo', 'weekStart correct');
equal(p.find('a.ui-state-active').text(), 15, 'day shown correct');
equal(p.find('.ui-datepicker-calendar > thead > tr > th').eq(0).find('span').text(), 'Mo', 'weekStart correct');
//set new day
p.find('a.ui-state-active').parent().next().click();
p.find('form').submit();
setTimeout(function() {
ok(!p.is(':visible'), 'popover closed');
equal(frmt(e.data('editable').value, 'dd.mm.yyyy'), nextD, 'new date saved to value');
equal(e.text(), nextDview, 'new text shown');
e.remove();
start();
}, timeout);
//set new day
p.find('a.ui-state-active').parent().next().click();
p.find('form').submit();
setTimeout(function() {
ok(!p.is(':visible'), 'popover closed');
equal(frmt(e.data('editable').value, 'dd.mm.yyyy'), nextD, 'new date saved to value');
equal(e.text(), nextDview, 'new text shown');
df.resolve();
}, timeout);
return df.promise();
};
$.when(func()).then(function() {
e.editable('setValue', d, true);
$.when(func()).then(function() {
e.remove();
start();
});
});
});