diff --git a/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.stories.js b/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.stories.js index ea60914ef0..1f3b5e9fea 100644 --- a/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.stories.js +++ b/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.stories.js @@ -1,11 +1,13 @@ -import { createRenderConfig } from '@/common/storybook_utils'; +import { createRenderConfig, 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-vue2/recipes/conversation_view/feed_pill/feed_item_pill.test.js b/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.test.js index 0dffa507d8..189e7a402d 100644 --- a/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.test.js +++ b/packages/dialtone-vue2/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/vue2'; 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, }; @@ -33,6 +33,7 @@ describe('DtRecipeFeedItemPill Tests', function () { propsData: { ...baseProps, ...mockProps }, attrs: { ...baseAttrs, ...mockAttrs }, slots: { ...baseSlots, ...mockSlots }, + components: { DtIconVideo }, global: { provide: { ...baseProvide, ...mockProvide }, }, @@ -64,10 +65,23 @@ describe('DtRecipeFeedItemPill Tests', function () { it('should render a feed item pill', async () => { expect(feedItemPill.exists()).toBeTruthy(); expect(icon.exists()).toBe(true); - expect(icon.classes()).toContain(`d-icon--${MOCK_ICON_NAME}`); 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', () => { + console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + console.log(icon.html()); + expect(icon.findComponent(DtIconVideo).exists()).toBe(true); + }); + }); }); describe('Accessibility Tests', function () { @@ -114,7 +128,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-vue2/recipes/conversation_view/feed_pill/feed_item_pill.vue b/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.vue index 17c9314675..81c47203a9 100644 --- a/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.vue +++ b/packages/dialtone-vue2/recipes/conversation_view/feed_pill/feed_item_pill.vue @@ -18,12 +18,22 @@ {{ title }}