From 6ef90db28f3c5164c4c9c9657b039a74a9b6daf5 Mon Sep 17 00:00:00 2001 From: Nina Date: Fri, 23 Aug 2024 14:44:46 -0300 Subject: [PATCH] feat(avatar): DLT-1916 remove dt-icon (#466) --- .../components/avatar/avatar.test.js | 12 ++-- .../components/avatar/avatar.vue | 70 +++++++++---------- .../avatar/avatar_variants.story.vue | 30 +++++--- .../feed_item_row/feed_item_row.vue | 18 +++-- .../contact_info/contact_info.stories.js | 13 ++-- .../item_layout/contact_info/contact_info.vue | 35 ++++++++-- .../contact_info_variants.story.vue | 15 ++-- .../recipes/leftbar/callbox/callbox.vue | 13 +++- .../leftbar/contact_row/contact_row.vue | 19 +++-- .../contact_row_variants.story.vue | 13 ++++ 10 files changed, 152 insertions(+), 86 deletions(-) diff --git a/packages/dialtone-vue3/components/avatar/avatar.test.js b/packages/dialtone-vue3/components/avatar/avatar.test.js index 920654f906..c904919a33 100644 --- a/packages/dialtone-vue3/components/avatar/avatar.test.js +++ b/packages/dialtone-vue3/components/avatar/avatar.test.js @@ -9,6 +9,7 @@ const MOCK_INITIALS = 'JN'; const MOCK_SIZE = 'lg'; const MOCK_GROUP = 25; const MOCK_CUSTOM_CLASS = 'my-custom-class'; +const MOCK_ICON_SLOT = ''; let MOCK_ELEMENT = null; const baseProps = { @@ -19,6 +20,7 @@ const baseAttrs = {}; let mockProps = {}; let mockAttrs = {}; +let mockSlots = {}; describe('DtAvatar Tests', () => { let wrapper; @@ -30,6 +32,7 @@ describe('DtAvatar Tests', () => { wrapper = mount(DtAvatar, { props: { ...baseProps, ...mockProps }, attrs: { ...baseAttrs, ...mockAttrs }, + slots: { ...mockSlots }, }); image = wrapper.find('[data-qa="dt-avatar-image"]'); @@ -43,6 +46,7 @@ describe('DtAvatar Tests', () => { afterEach(() => { mockProps = {}; + mockSlots = {}; }); describe('Presentation Tests', () => { @@ -76,19 +80,19 @@ describe('DtAvatar Tests', () => { }); }); - describe('When the iconName is provided', () => { + describe('When the icon slot is provided', () => { beforeEach(() => { - mockProps = { iconName: 'accessibility' }; + mockSlots = { icon: MOCK_ICON_SLOT }; updateWrapper(); }); it('icon should exist', () => { - expect(wrapper.find('svg').exists()).toBeTruthy(); + expect(wrapper.find('[data-qa="dt-avatar-icon"]').exists()).toBeTruthy(); }); it('should have correct class', () => { - expect(wrapper.find('svg').classes(AVATAR_KIND_MODIFIERS.icon)).toBe(true); + expect(wrapper.find('[data-qa="dt-avatar-icon"]').classes(AVATAR_KIND_MODIFIERS.icon)).toBe(true); }); }); diff --git a/packages/dialtone-vue3/components/avatar/avatar.vue b/packages/dialtone-vue3/components/avatar/avatar.vue index 2913e9d65d..c30561c973 100644 --- a/packages/dialtone-vue3/components/avatar/avatar.vue +++ b/packages/dialtone-vue3/components/avatar/avatar.vue @@ -22,14 +22,19 @@ :src="imageSrc" :alt="imageAlt" > - + :aria-label="clickable ? iconAriaLabel : ''" + :data-qa="iconDataQa" + :role="clickable ? 'button' : ''" + > + + +
- +

diff --git a/packages/dialtone-vue3/recipes/leftbar/contact_row/contact_row_variants.story.vue b/packages/dialtone-vue3/recipes/leftbar/contact_row/contact_row_variants.story.vue index eec463bb83..34d4e0f4c7 100644 --- a/packages/dialtone-vue3/recipes/leftbar/contact_row/contact_row_variants.story.vue +++ b/packages/dialtone-vue3/recipes/leftbar/contact_row/contact_row_variants.story.vue @@ -86,6 +86,19 @@ call-button-tooltip="Call" />

+
+

+ With icon +

+ +

With emojis in the name