From 4878334810b5542fc8dd8d577df4e5c5b2817f74 Mon Sep 17 00:00:00 2001 From: Pierre Romera Date: Fri, 4 Oct 2024 11:02:37 +0000 Subject: [PATCH] refactor: implement widget field facets entry --- src/components/Widget/WidgetFieldFacets.vue | 99 ++++--------------- .../Widget/WidgetFieldFacets.spec.js | 4 +- 2 files changed, 19 insertions(+), 84 deletions(-) diff --git a/src/components/Widget/WidgetFieldFacets.vue b/src/components/Widget/WidgetFieldFacets.vue index 954e62d8d6..17eab991f0 100644 --- a/src/components/Widget/WidgetFieldFacets.vue +++ b/src/components/Widget/WidgetFieldFacets.vue @@ -10,30 +10,21 @@ -
- + -
-
- {{ item.label }} -
- - {{ $n(item.count) }} - -
- -
+ class="widget__list__item mb-2" + :label="label" + :count="count" + :total="total" + :to="to" + /> -
+
{{ $t('widget.noData') }}
@@ -44,11 +35,13 @@ diff --git a/tests/unit/specs/components/Widget/WidgetFieldFacets.spec.js b/tests/unit/specs/components/Widget/WidgetFieldFacets.spec.js index 8a398fc916..f377c44afe 100644 --- a/tests/unit/specs/components/Widget/WidgetFieldFacets.spec.js +++ b/tests/unit/specs/components/Widget/WidgetFieldFacets.spec.js @@ -61,7 +61,7 @@ describe('WidgetFieldFacets.vue', () => { it('loads a page of data', () => { expect(wrapper.vm.total).toBe(30) - expect(wrapper.vm.items[0]).toEqual({ label: 'foo', count: 10, href: expect.stringContaining('contentType=foo') }) - expect(wrapper.vm.items[1]).toEqual({ label: 'bar', count: 20, href: expect.stringContaining('contentType=bar') }) + expect(wrapper.vm.items[0]).toEqual({ label: 'foo', count: 10, to: expect.objectContaining({ name: 'search' }) }) + expect(wrapper.vm.items[1]).toEqual({ label: 'bar', count: 20, to: expect.objectContaining({ name: 'search' }) }) }) })