Create shared timeline entry component
This commit is contained in:
parent
6775dafa38
commit
99862050de
2 changed files with 51 additions and 0 deletions
|
@ -0,0 +1,11 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'TimelineEntry',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li class="timeline-entry">
|
||||
<div class="timeline-entry-inner"><slot></slot></div>
|
||||
</li>
|
||||
</template>
|
|
@ -0,0 +1,40 @@
|
|||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import TimelineEntry from '~/vue_shared/components/notes/timeline_entry.vue';
|
||||
|
||||
describe(TimelineEntry.name, () => {
|
||||
let wrapper;
|
||||
|
||||
const factory = (options = {}) => {
|
||||
const localVue = createLocalVue();
|
||||
|
||||
wrapper = shallowMount(TimelineEntry, {
|
||||
localVue,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('renders correctly', () => {
|
||||
factory();
|
||||
|
||||
expect(wrapper.is('.timeline-entry')).toBe(true);
|
||||
|
||||
expect(wrapper.contains('.timeline-entry-inner')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts default slot', () => {
|
||||
const dummyContent = '<p>some content</p>';
|
||||
factory({
|
||||
slots: {
|
||||
default: dummyContent,
|
||||
},
|
||||
});
|
||||
|
||||
const content = wrapper.find('.timeline-entry-inner :first-child');
|
||||
|
||||
expect(content.html()).toBe(dummyContent);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue