fix tests

This commit is contained in:
vitalets 2013-01-11 11:10:32 +04:00
parent c2cda5dfb1
commit 775deede07
2 changed files with 23 additions and 19 deletions
src/containers
test/unit

@ -49,6 +49,8 @@
destroy: function() {
this.tip().remove();
this.$element.off('destroyed');
this.$element.removeData('editableContainer');
}
});

@ -656,33 +656,35 @@ $(function () {
setTimeout(function() {
e.click();
var p = tip(e);
equal(p.find('select').find('option').length, size, 'options loaded');
equal(p.find('select').val(), e.data('editable').value, 'selected value correct') ;
p.find('.editable-cancel').click();
ok(!p.is(':visible'), 'popover was closed');
$.mockjax({
url: 'groups1.php',
responseText: {a: 1, 2: 2}
});
//set new source
e.editable('option', 'source', 'groups1.php');
e.click();
e.click();
var p = tip(e);
equal(p.find('select').find('option').length, size, 'options loaded');
equal(p.find('select').val(), e.data('editable').value, 'selected value correct') ;
p.find('.editable-cancel').click();
ok(!p.is(':visible'), 'popover was closed');
$.mockjax({
url: 'groups1.php',
responseText: [{value: 'a', text: 1}, {value: 'b', text: 2}]
});
//set new source
e.editable('option', 'source', 'groups1.php');
e.click();
setTimeout(function() {
setTimeout(function() {
p = tip(e);
ok(p.find('select').length, 'select exists');
equal(p.find('select').find('option').length, 2, 'new options loaded');
equal(p.find('select').val(), e.data('editable').value, 'selected value correct') ;
equal(p.find('select').val(), 'a', 'selected value correct') ;
p.find('.editable-cancel').click();
ok(!p.is(':visible'), 'popover was closed');
e.remove();
start();
}, timeout);
}, timeout);
});