[IMP] Changed tests according to new client side fields view get
bzr revid: fme@openerp.com-20121205160656-0mg1hnv35vk27adh
This commit is contained in:
@@ -10,7 +10,7 @@ openerp.testing = {};
|
||||
formats: ['coresetup', 'dates'],
|
||||
chrome: ['corelib', 'coresetup'],
|
||||
views: ['corelib', 'coresetup', 'data', 'chrome'],
|
||||
search: ['data', 'coresetup', 'formats'],
|
||||
search: ['views', 'formats'],
|
||||
list: ['views', 'data'],
|
||||
form: ['data', 'views', 'list', 'formats'],
|
||||
list_editable: ['list', 'form', 'data'],
|
||||
|
||||
@@ -183,7 +183,7 @@ openerp.testing.section('list.edition', {
|
||||
}
|
||||
return [];
|
||||
});
|
||||
mock('/web/view/load', function () {
|
||||
mock('demo:fields_view_get', function () {
|
||||
return {
|
||||
type: 'tree',
|
||||
fields: {
|
||||
@@ -191,15 +191,7 @@ openerp.testing.section('list.edition', {
|
||||
b: {type: 'char', string: "B"},
|
||||
c: {type: 'char', string: "C"}
|
||||
},
|
||||
arch: {
|
||||
tag: 'tree',
|
||||
attrs: {},
|
||||
children: [
|
||||
{tag: 'field', attrs: {name: 'a'}},
|
||||
{tag: 'field', attrs: {name: 'b'}},
|
||||
{tag: 'field', attrs: {name: 'c'}}
|
||||
]
|
||||
}
|
||||
arch: '<tree><field name="a"/><field name="b"/><field name="c"/></tree>',
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -247,7 +239,7 @@ openerp.testing.section('list.edition.events', {
|
||||
mock('demo:read', function () {
|
||||
return [{ id: 1, a: 'foo', b: 'bar', c: 'baz' }];
|
||||
});
|
||||
mock('/web/view/load', function () {
|
||||
mock('demo:fields_view_get', function () {
|
||||
return {
|
||||
type: 'tree',
|
||||
fields: {
|
||||
@@ -255,15 +247,7 @@ openerp.testing.section('list.edition.events', {
|
||||
b: {type: 'char', string: "B"},
|
||||
c: {type: 'char', string: "C"}
|
||||
},
|
||||
arch: {
|
||||
tag: 'tree',
|
||||
attrs: {},
|
||||
children: [
|
||||
{tag: 'field', attrs: {name: 'a'}},
|
||||
{tag: 'field', attrs: {name: 'b'}},
|
||||
{tag: 'field', attrs: {name: 'c'}}
|
||||
]
|
||||
}
|
||||
arch: '<tree><field name="a"/><field name="b"/><field name="c"/></tree>',
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -320,19 +304,13 @@ openerp.testing.section('list.edition.onwrite', {
|
||||
templates: true,
|
||||
}, function (test) {
|
||||
test('record-to-read', {asserts: 4}, function (instance, $fix, mock) {
|
||||
mock('/web/view/load', function () {
|
||||
mock('demo:fields_view_get', function () {
|
||||
return {
|
||||
type: 'tree',
|
||||
fields: {
|
||||
a: {type: 'char', string: "A"}
|
||||
},
|
||||
arch: {
|
||||
tag: 'tree',
|
||||
attrs: { on_write: 'on_write', colors: 'red:a == "foo"' },
|
||||
children: [
|
||||
{tag: 'field', attrs: {name: 'a'}}
|
||||
]
|
||||
}
|
||||
arch: '<tree on_write="on_write" colors="red:a == \'foo\'"><field name="a"/></tree>',
|
||||
};
|
||||
});
|
||||
mock('demo:read', function (args, kwargs) {
|
||||
|
||||
@@ -4,20 +4,13 @@ openerp.testing.section('list.buttons', {
|
||||
templates: true
|
||||
}, function (test) {
|
||||
test('record-deletion', {asserts: 2}, function (instance, $fix, mock) {
|
||||
mock('/web/view/load', function () {
|
||||
mock('demo:fields_view_get', function () {
|
||||
return {
|
||||
type: 'tree',
|
||||
fields: {
|
||||
a: {type: 'char', string: "A"}
|
||||
},
|
||||
arch: {
|
||||
tag: 'tree',
|
||||
attrs: { },
|
||||
children: [
|
||||
{tag: 'field', attrs: {name: 'a'}},
|
||||
{tag: 'button', attrs: {type: 'object', name: 'foo'}}
|
||||
]
|
||||
}
|
||||
arch: '<tree><field name="a"/><button type="object" name="foo"/></tree>',
|
||||
};
|
||||
});
|
||||
mock('demo:read', function (args, kwargs) {
|
||||
|
||||
@@ -152,25 +152,14 @@ var makeSearchView = function (instance, dummy_widget_attributes, defaults) {
|
||||
instance.dummy = {};
|
||||
instance.dummy.DummyWidget = instance.web.search.Field.extend(
|
||||
dummy_widget_attributes || {});
|
||||
if (!('/web/view/load' in instance.session.responses)) {
|
||||
instance.session.responses['/web/view/load'] = function () {
|
||||
if (!('dummy.model:fields_view_get' in instance.session.responses)) {
|
||||
instance.session.responses['dummy.model:fields_view_get'] = function () {
|
||||
return {
|
||||
type: 'search',
|
||||
fields: {
|
||||
dummy: {type: 'char', string: "Dummy"}
|
||||
},
|
||||
arch: {
|
||||
tag: 'search',
|
||||
attrs: {},
|
||||
children: [{
|
||||
tag: 'field',
|
||||
attrs: {
|
||||
name: 'dummy',
|
||||
widget: 'dummy'
|
||||
},
|
||||
children: []
|
||||
}]
|
||||
}
|
||||
arch: '<search><field name="dummy" widget="dummy"/></search>'
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -183,7 +172,7 @@ var makeSearchView = function (instance, dummy_widget_attributes, defaults) {
|
||||
};
|
||||
};
|
||||
|
||||
var dataset = {model: 'dummy.model', get_context: function () { return {}; }};
|
||||
var dataset = new instance.web.DataSet(null, 'dummy.model');
|
||||
var view = new instance.web.SearchView(null, dataset, false, defaults);
|
||||
var self = this;
|
||||
view.on('invalid_search', self, function () {
|
||||
@@ -926,31 +915,16 @@ openerp.testing.section('filters', {
|
||||
rpc: 'mock',
|
||||
templates: true,
|
||||
setup: function (instance, $s, mock) {
|
||||
mock('/web/view/load', function () {
|
||||
mock('dummy.model:fields_view_get', function () {
|
||||
// view with a single group of filters
|
||||
return {
|
||||
type: 'search',
|
||||
fields: {},
|
||||
arch: {
|
||||
tag: 'search',
|
||||
attrs: {},
|
||||
children: [{
|
||||
tag: 'filter',
|
||||
attrs: { string: "Foo1", domain: [ ['foo', '=', '1'] ] },
|
||||
children: []
|
||||
}, {
|
||||
tag: 'filter',
|
||||
attrs: {
|
||||
name: 'foo2',
|
||||
string: "Foo2",
|
||||
domain: [ ['foo', '=', '2'] ] },
|
||||
children: []
|
||||
}, {
|
||||
tag: 'filter',
|
||||
attrs: { string: "Foo3", domain: [ ['foo', '=', '3'] ] },
|
||||
children: []
|
||||
}]
|
||||
}
|
||||
arch: '<search>' +
|
||||
'<filter string="Foo1" domain="[ [\'foo\', \'=\', \'1\'] ]"/>' +
|
||||
'<filter name="foo2" string="Foo2" domain="[ [\'foo\', \'=\', \'2\'] ]"/>' +
|
||||
'<filter string="Foo3" domain="[ [\'foo\', \'=\', \'3\'] ]"/>' +
|
||||
'</search>',
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user