Files
directus/app/src/components/v-text-overflow.test.ts
Rijk van Zanten 4eae2de686 Move updated components to app (#15374)
* Move updated components to app

* Make sure storybook is alive
2022-09-02 14:42:00 -04:00

40 lines
888 B
TypeScript

import { test, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import VTextOverflow from './v-text-overflow.vue';
import { GlobalMountOptions } from '@vue/test-utils/dist/types';
import { Tooltip } from '@/__utils__/tooltip';
const global: GlobalMountOptions = {
stubs: ['v-icon', 'v-highlight'],
directives: {
Tooltip,
},
};
test('Mount component', () => {
expect(VTextOverflow).toBeTruthy();
const wrapper = mount(VTextOverflow, {
props: {
text: 'My text',
},
global,
});
expect(wrapper.html()).toMatchSnapshot();
});
test('highlight prop', () => {
const wrapper = mount(VTextOverflow, {
props: {
text: 'my Text',
highlight: 'text',
},
global,
});
expect(wrapper.getComponent({ name: 'v-highlight' }).attributes().query).toBe('text');
expect(wrapper.getComponent({ name: 'v-highlight' }).attributes().text).toBe('my Text');
});