[FIX] web: BasicRenderer: button's name attr in DOM

Rev. 374af56 changed the way 'button' nodes are rendered in basic
views (form, list, kanban). As a consequence, their 'name'
attribute wasn't transmitted to the produced html elements anymore.
However, this attribute is very convenient to debug views, and to
write selectors in tests. For instance, it broke the test added by
rev. 8d17a2a once forwardported in master.

This commit reverts 1ce5bea.
This commit is contained in:
Aaron Bohy
2018-04-25 15:08:53 +02:00
parent 1ce5bea306
commit f85a54257d
3 changed files with 5 additions and 3 deletions
@@ -529,7 +529,7 @@ var BasicRenderer = AbstractRenderer.extend({
*/
_renderButtonFromNode: function (node, options) {
var btnOptions = {
attrs: _.omit(node.attrs, 'icon', 'string', 'type', 'name', 'attrs', 'modifiers', 'options'),
attrs: _.omit(node.attrs, 'icon', 'string', 'type', 'attrs', 'modifiers', 'options'),
icon: node.attrs.icon,
};
if (options && options.extraClass) {
+3 -1
View File
@@ -987,7 +987,7 @@ QUnit.module('Views', {
});
QUnit.test('buttons in form view', function (assert) {
assert.expect(7);
assert.expect(8);
var rpcCount = 0;
@@ -1018,6 +1018,8 @@ QUnit.module('Views', {
assert.strictEqual(form.$('.o_form_statusbar button').length, 2,
"should have 2 buttons in the statusbar");
assert.strictEqual(form.$('button[name="post"]').length, 1,
"'name' attribute of buttons is transmitted to the rendered html element");
assert.strictEqual(form.$('.o_form_statusbar button:visible').length, 1,
"should have only 1 visible button in the statusbar");
@@ -125,7 +125,7 @@ QUnit.module('base_settings_tests', {
});
actionManager.doAction(1);
actionManager.$('button:first').click();
actionManager.$('button[name="4"]').click();
$('.o_control_panel .breadcrumb li a').click();
assert.verifySteps([
'load_views', // initial setting action