From 1361d0720e05410308b2863fc98a3a3cee5f4d84 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 25 Jan 2021 12:24:12 +0100 Subject: [PATCH] [FIX] web: customization of text in button for kanban example never used Before this commit, the customization of text in button to apply kanban example is never used because the variable which contains the text is missspelled and thus is always undefined. That's why, we always have the default text in this button. This commit changes the `options.applyExampleText` to `options.applyExamplesText` to get the text customization in project module for instance and adds a test in order to check that the text is well rendered. Co-authored-by: Laurent Stukkens (LTU) task-2440564 Closes #65095 --- .../kanban/kanban_column_quick_create.js | 2 +- addons/web/static/tests/views/kanban_tests.js | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js index c4bed5faa05..928f80ab60f 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js @@ -32,7 +32,7 @@ var ColumnQuickCreate = Widget.extend({ */ init: function (parent, options) { this._super.apply(this, arguments); - this.applyExamplesText = options.applyExampleText || _t("Use This For My Kanban"); + this.applyExamplesText = options.applyExamplesText || _t("Use This For My Kanban"); this.examples = options.examples; this.folded = true; this.isMobile = false; diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index 0450876be78..f3de29c8b42 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -3801,6 +3801,47 @@ QUnit.module('Views', { kanban.destroy(); }); + QUnit.test("quick create column's apply button's display text", async function (assert) { + assert.expect(1); + + const applyExamplesText = 'Use This For My Test'; + kanbanExamplesRegistry.add('test', { + applyExamplesText: applyExamplesText, + examples:[{ + name: "A first example", + columns: ["Column 1", "Column 2", "Column 3"], + description: "Some description", + }, { + name: "A second example", + columns: ["Col 1", "Col 2"], + }], + }); + + var kanban = await createView({ + View: KanbanView, + model: 'partner', + data: this.data, + arch: '' + + '' + + '' + + '
' + + '
' + + '
', + groupBy: ['product_id'], + }); + + // open the quick create + await testUtils.dom.click(kanban.$('.o_column_quick_create .o_quick_create_folded')); + + // click to see the examples + await testUtils.dom.click(kanban.$('.o_column_quick_create .o_kanban_examples')); + + const $primaryActionButton = $('.modal footer.modal-footer button.btn-primary > span'); + assert.strictEqual($primaryActionButton.text(), applyExamplesText, 'the primary button should display the value of applyExamplesText'); + + kanban.destroy(); + }); + QUnit.test('quick create column and examples background with ghostColumns titles', async function (assert) { assert.expect(4);