select: add sourceOptions to modify source request method and params

This commit is contained in:
vitalets
2013-09-22 12:34:22 +04:00
parent 1329e0ccf9
commit a55f38ab60
3 changed files with 52 additions and 5 deletions

@ -791,5 +791,37 @@ $(function () {
ok(p.find('select').length, 'select exists')
equal(p.find('select').val(), 3, 'selected value correct');
});
asyncTest("sourceOptions", function () {
expect(3);
var e = $('<a href="#" data-type="select" data-value="2" data-source="sourceOptions">customer</a>').appendTo(fx).editable({
sourceOptions: {
type: 'post',
data: {
a: 1
}
}
});
$.mockjax({
url: 'sourceOptions',
type: 'post',
response: function(settings) {
equal(settings.data.a, 1, 'params sent!');
this.responseText = groups;
}
});
e.click();
var p = tip(e);
setTimeout(function() {
equal(p.find('select').find('option').length, size, 'options loaded');
equal(p.find('select').val(), e.data('editable').value, 'selected value correct') ;
e.remove();
start();
}, timeout);
});
});