From ae075ec5c94555be08b584ed4e79ee2ffb6ebddb Mon Sep 17 00:00:00 2001 From: luvi Date: Thu, 6 Apr 2023 06:24:03 +0000 Subject: [PATCH] [IMP] web: TagsList supports icon props This commits makes the TagsList component able to display icons as well as images were previously supported. A test has been added to verify the presence of the icon set in each tag. closes odoo/odoo#117751 Signed-off-by: Aaron Bohy (aab) --- .../static/src/core/tags_list/tags_list.xml | 1 + .../web/static/tests/core/tags_list_tests.js | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/addons/web/static/src/core/tags_list/tags_list.xml b/addons/web/static/src/core/tags_list/tags_list.xml index 8bf06810bb6..7dc989a5a72 100644 --- a/addons/web/static/src/core/tags_list/tags_list.xml +++ b/addons/web/static/src/core/tags_list/tags_list.xml @@ -5,6 +5,7 @@ +
diff --git a/addons/web/static/tests/core/tags_list_tests.js b/addons/web/static/tests/core/tags_list_tests.js index d08dd518cdc..383768b02bd 100644 --- a/addons/web/static/tests/core/tags_list_tests.js +++ b/addons/web/static/tests/core/tags_list_tests.js @@ -98,6 +98,33 @@ QUnit.module("Web Components", (hooks) => { ); }); + QUnit.test("Tags can be displayed with an icon", async (assert) => { + class Parent extends Component { + setup() { + this.tags = [ + { + icon: "fa-trash", + id: "tag1", + text: "Bad", + }, + { + icon: "fa-check", + id: "tag2", + text: "Good", + }, + ]; + } + } + Parent.components = { TagsList }; + Parent.template = xml` + `; + + await mount(Parent, target, { env }); + assert.containsN(target, ".o_tag", 2); + assert.hasClass(target.querySelector(".o_tag:nth-of-type(1) i"), "fa fa-trash"); + assert.hasClass(target.querySelector(".o_tag:nth-of-type(2) i"), "fa fa-check"); + }); + QUnit.test("Limiting the visible tags displays a counter", async (assert) => { class Parent extends Component { setup() {