From 5d2b4b54963e8b01dc41e01e413c16d37c841ff4 Mon Sep 17 00:00:00 2001 From: Nina Date: Thu, 5 Sep 2024 15:08:16 -0300 Subject: [PATCH 1/3] feat(feed item pill): DLT-1916 remove dt-icon from Feed Item Pill --- .../feed_pill/feed_item_pill.stories.js | 18 +++++- .../feed_pill/feed_item_pill.test.js | 21 ++++++- .../feed_pill/feed_item_pill.vue | 49 ++++++++------- .../feed_item_pill_default.story.vue | 9 ++- .../feed_item_pill_variants.story.vue | 61 ++++++++++++++++--- 5 files changed, 123 insertions(+), 35 deletions(-) diff --git a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.stories.js b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.stories.js index be97576d47..3905bf3886 100644 --- a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.stories.js +++ b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.stories.js @@ -1,11 +1,13 @@ -import { createTemplateFromVueFile } from '@/common/storybook_utils'; +import { createTemplateFromVueFile, getIconNames } from '@/common/storybook_utils'; import DtRecipeFeedItemPill from './feed_item_pill.vue'; import DtRecipeFeedItemPillDefaultTemplate from './feed_item_pill_default.story.vue'; import DtRecipeFeedItemPillVariantsTemplate from './feed_item_pill_variants.story.vue'; +const iconsList = getIconNames(); + // Default Prop Values const args = { - iconName: 'video', + leftIcon: 'video', title: 'This meeting has ended', ariaLabel: 'Click to expand', wrapperClass: 'd-w628', @@ -14,6 +16,18 @@ const args = { const argTypes = { // Slots + leftIcon: { + table: { + type: { summary: 'VNode' }, + }, + options: iconsList, + control: { + type: 'select', + labels: { + undefined: '(empty)', + }, + }, + }, subtitle: { control: 'text', table: { diff --git a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.test.js b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.test.js index f138e8e3cb..3a624c69dc 100644 --- a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.test.js +++ b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.test.js @@ -1,11 +1,12 @@ import { mount } from '@vue/test-utils'; import DtRecipeFeedItemPill from './feed_item_pill.vue'; +import { DtIconVideo } from '@dialpad/dialtone-icons/vue3'; describe('DtRecipeFeedItemPill Tests', function () { let wrapper, feedItemPill, icon; const MOCK_ARIA_LABEL = 'Click to expand'; - const MOCK_ICON_NAME = 'video'; + const MOCK_ICON_SLOT = ''; const DATA_QA = { PILL: 'dt-recipe-feed-item-pill', PILL_ICON: 'dt-recipe-feed-item-pill__icon', @@ -13,7 +14,6 @@ describe('DtRecipeFeedItemPill Tests', function () { }; const baseProps = { - iconName: MOCK_ICON_NAME, title: 'This meeting has ended', ariaLabel: MOCK_ARIA_LABEL, }; @@ -35,6 +35,9 @@ describe('DtRecipeFeedItemPill Tests', function () { slots: { ...baseSlots, ...mockSlots }, global: { provide: { ...baseProvide, ...mockProvide }, + components: { + 'dt-icon-video': DtIconVideo, + }, }, }); @@ -68,6 +71,18 @@ describe('DtRecipeFeedItemPill Tests', function () { // expect(wrapper.find(`[data-qa="${DATA_QA.CONTENT_ELEMENT}"]`).exists()).toBe(false); }); }); + + describe('When the icon slot is provided', () => { + beforeEach(async () => { + mockSlots = { leftIcon: MOCK_ICON_SLOT }; + + await updateWrapper(); + }); + + it('should render the icon', () => { + expect(icon.findComponent(DtIconVideo).exists()).toBe(true); + }); + }); }); describe('Accessibility Tests', function () { @@ -114,7 +129,7 @@ describe('DtRecipeFeedItemPill Tests', function () { it('should show a different icon', () => { expect(icon.exists()).toBe(true); - expect(icon.attributes('data-name')).toBe('Chevron Right'); + expect(icon.find('[data-qa="dt-icon"]').attributes('data-name')).toBe('Chevron Right'); }); }); diff --git a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.vue b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.vue index 17c9314675..abecf9961b 100644 --- a/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.vue +++ b/packages/dialtone-vue3/recipes/conversation_view/feed_pill/feed_item_pill.vue @@ -18,12 +18,22 @@ {{ title }}