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