[ADD] support for arguments-less onchange (why the hell not)

bzr revid: xmo@openerp.com-20111121122845-98lctm470ncttz74
This commit is contained in:
Xavier Morel 2011-11-21 13:28:45 +01:00
parent 95e2fcf884
commit 9d09c570ae
2 changed files with 11 additions and 8 deletions

View File

@ -250,8 +250,11 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
return null;
}
var method = call[1], args = [];
var context_index = null;
var method = call[1], args = [], context_index = null;
if (!_.str.trim(call[2])) {
return {method: method, args: args, context_index: context_index}
}
var argument_replacement = {
'False': function () {return false;},
'True': function () {return true;},

View File

@ -22,12 +22,12 @@ $(document).ready(function () {
window.openerp.web.form(openerp);
}
});
// test('Parse args-less onchange', function () {
// var f = new openerp.web.FormView(null, {});
// var result = f.parse_on_change('on_change_foo()', {});
// equal(result.method, 'on_change_foo');
// deepEqual(result.args, []);
// });
test('Parse args-less onchange', function () {
var f = new openerp.web.FormView(null, {});
var result = f.parse_on_change('on_change_foo()', {});
equal(result.method, 'on_change_foo');
deepEqual(result.args, []);
});
test('Parse 1-arg onchange', function () {
var f = make_form({foo: 3});
var result = f.parse_on_change('on_change_foo(foo)', {});