1 openerp.testing.section('list.buttons', {
2 dependencies: ['web.list', 'web.form'],
6 test('record-deletion', {asserts: 2}, function (instance, $fix, mock) {
7 mock('demo:fields_view_get', function () {
11 a: {type: 'char', string: "A"}
13 arch: '<tree><field name="a"/><button type="object" name="foo"/></tree>',
16 mock('demo:read', function (args, kwargs) {
17 if (_.isEqual(args[0], [1, 2, 3])) {
19 {id: 1, a: 'foo'}, {id: 2, a: 'bar'}, {id: 3, a: 'baz'}
22 throw new Error(JSON.stringify(_.toArray(arguments)));
24 mock('demo:search_read', function (args, kwargs) {
26 if (_.isEqual(args[0], [['id', 'in', [2]]])) {
29 throw new Error(JSON.stringify(_.toArray(arguments)));
31 mock('/web/dataset/call_button', function () { return false; });
32 var ds = new instance.web.DataSetStatic(null, 'demo', null, [1, 2, 3]);
33 var l = new instance.web.ListView({
34 do_action: openerp.testing.noop
35 }, ds, false, {editable: 'top'});
36 return l.appendTo($fix)
37 .then(l.proxy('reload_content'))
40 l.records.bind('remove', function () {
43 $fix.find('table tbody tr:eq(1) button').click();
47 strictEqual(l.records.length, 2,
48 "should have 2 records left");
49 strictEqual($fix.find('table tbody tr[data-id]').length, 2,
50 "should have 2 rows left");