Skip to content

Commit

Permalink
Fix tests after migrating from VIcon to KIcon
Browse files Browse the repository at this point in the history
and related bug fixes.
  • Loading branch information
MisRob committed Aug 11, 2024
1 parent 62e957b commit 9757163
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,7 @@ describe('thumbnail', () => {
describe('remove workflow', () => {
it('clicking remove button should emit an input event with a null value', () => {
wrapper.setProps({ value: testThumbnail });
wrapper
.find('[data-test="remove"]')
.findComponent({ name: 'KIconButton' })
.vm.$emit('click');
wrapper.find('[data-test="remove"]').vm.$emit('click');
expect(wrapper.emitted('input')[0][0]).toBe(null);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
:style="{ width: fillWidth ? '100%' : 'unset' }"
capture-as-image
>
<KIcon :icon="icon" :color="fontColor" />
<KIcon :icon="icon" :color="fontColor" data-test="icon" />
<span v-if="includeText" class="ml-2">{{ text }}</span>
</VChip>
<span v-else capture-as-image>
<KIcon :icon="icon" :color="fontColor" />
<KIcon :icon="icon" :color="fontColor" data-test="icon" />
<span v-if="includeText" class="ml-2">{{ text }}</span>
</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<template>

<div :style="{ display: 'inline' }">
<KIcon
<KIconButton
icon="help"
:color="$themeTokens.primary"
size="small"
data-test="info-icon"
@click="displayDialog = !displayDialog"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ function makeWrapper(kind) {

describe('ContentNodeIcon', () => {
const testIcons = [
{ value: 'topic', icon: 'folder' },
{ value: 'video', icon: 'ondemand_video' },
{ value: 'audio', icon: 'music_note' },
{ value: 'exercise', icon: 'assignment' },
{ value: 'document', icon: 'class' },
{ value: 'html5', icon: 'widgets' },
{ value: 'zim', icon: 'widgets' },
{ value: 'topic', icon: 'topic' },
{ value: 'video', icon: 'video' },
{ value: 'audio', icon: 'audio' },
{ value: 'exercise', icon: 'exercise' },
{ value: 'document', icon: 'document' },
{ value: 'html5', icon: 'html5' },
{ value: 'zim', icon: 'html5' },
];
it.each(testIcons)('should display the correct icon $value', kind => {
it.each(testIcons)('should pass the correct icon value to KIcon', kind => {
const wrapper = makeWrapper(kind.value);
expect(wrapper.find('.v-icon').text()).toContain(kind.icon);
expect(wrapper.find('[data-test="icon"]').props().icon).toBe(kind.icon);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ document.body.setAttribute('data-app', true); // Vuetify prints a warning withou

describe('ContentNodeLearningActivityIcon', () => {
let wrapper;
// expect(wrapper.find('.v-icon').text()).toContain(kind.icon);
describe('labeled icons', () => {
wrapper = mount(ContentNodeLearningActivityIcon, {
propsData: {
Expand Down

0 comments on commit 9757163

Please sign in to comment.