Commit 45691494 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'kp-add-issuable-show-app-description' into 'master'

Issuable Show: Add IssuableDescription component

See merge request gitlab-org/gitlab!44735
parents c2faf98f efd32f82
<script>
import $ from 'jquery';
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import '~/behaviors/markdown/render_gfm';
export default {
directives: {
SafeHtml,
},
props: {
issuable: {
type: Object,
required: true,
},
},
mounted() {
this.renderGFM();
},
methods: {
renderGFM() {
$(this.$refs.gfmContainer).renderGFM();
},
},
};
</script>
<template>
<div class="description">
<div ref="gfmContainer" v-safe-html="issuable.descriptionHtml" class="md"></div>
</div>
</template>
import $ from 'jquery';
import { shallowMount } from '@vue/test-utils';
import IssuableDescription from '~/issuable_show/components/issuable_description.vue';
import { mockIssuable } from '../mock_data';
const createComponent = (issuable = mockIssuable) =>
shallowMount(IssuableDescription, {
propsData: { issuable },
});
describe('IssuableDescription', () => {
let renderGFMSpy;
let wrapper;
beforeEach(() => {
renderGFMSpy = jest.spyOn($.fn, 'renderGFM');
wrapper = createComponent();
});
afterEach(() => {
wrapper.destroy();
});
describe('mounted', () => {
it('calls `renderGFM`', () => {
expect(renderGFMSpy).toHaveBeenCalledTimes(1);
});
});
describe('methods', () => {
describe('renderGFM', () => {
it('calls `renderGFM` on container element', () => {
wrapper.vm.renderGFM();
expect(renderGFMSpy).toHaveBeenCalled();
});
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment