Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ninamarina committed Sep 4, 2024
1 parent 61b6ca8 commit 9bd8cc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/dialtone-vue2/components/avatar/avatar.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLocalVue, mount } from '@vue/test-utils';
import { DtIconUser } from '@dialpad/dialtone-icons/vue2';
import DtAvatar from './avatar.vue';
import { AVATAR_KIND_MODIFIERS, AVATAR_SIZE_MODIFIERS } from './avatar_constants';

Expand All @@ -9,7 +10,7 @@ const MOCK_INITIALS = 'JN';
const MOCK_SIZE = 'lg';
const MOCK_GROUP = 25;
const MOCK_CUSTOM_CLASS = 'my-custom-class';
const MOCK_ICON_SLOT = '<template #icon=>Icon</template>';
const MOCK_ICON_SLOT = '<dt-icon-user />';
let MOCK_ELEMENT = null;

const baseProps = {
Expand All @@ -35,6 +36,7 @@ describe('DtAvatar Tests', () => {
listeners: { ...baseListeners, ...mockListeners },
localVue: testContext.localVue,
slots: { ...mockSlots },
components: { DtIconUser },
});

image = wrapper.find('[data-qa="dt-avatar-image"]');
Expand Down Expand Up @@ -101,6 +103,10 @@ describe('DtAvatar Tests', () => {
it('should have correct class', () => {
expect(wrapper.find('[data-qa="dt-avatar-icon"]').classes(AVATAR_KIND_MODIFIERS.icon)).toBe(true);
});

it('should render the custom icon', () => {
expect(wrapper.find('[data-qa="dt-avatar-icon"]').findComponent(DtIconUser).exists()).toBe(true);
});
});

describe('With no imageSrc or iconName is provided', () => {
Expand Down

0 comments on commit 9bd8cc3

Please sign in to comment.