summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes/components/diff_with_note_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/notes/components/diff_with_note_spec.js')
-rw-r--r--spec/javascripts/notes/components/diff_with_note_spec.js89
1 files changed, 0 insertions, 89 deletions
diff --git a/spec/javascripts/notes/components/diff_with_note_spec.js b/spec/javascripts/notes/components/diff_with_note_spec.js
deleted file mode 100644
index 573aac2c3e0..00000000000
--- a/spec/javascripts/notes/components/diff_with_note_spec.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import Vue from 'vue';
-import { mountComponentWithStore } from 'spec/helpers';
-import DiffWithNote from '~/notes/components/diff_with_note.vue';
-import { createStore } from '~/mr_notes/stores';
-
-const discussionFixture = 'merge_requests/diff_discussion.json';
-const imageDiscussionFixture = 'merge_requests/image_diff_discussion.json';
-
-describe('diff_with_note', () => {
- let store;
- let vm;
- const diffDiscussionMock = getJSONFixture(discussionFixture)[0];
- const diffDiscussion = diffDiscussionMock;
- const Component = Vue.extend(DiffWithNote);
- const props = {
- discussion: diffDiscussion,
- };
- const selectors = {
- get container() {
- return vm.$el;
- },
- get diffTable() {
- return this.container.querySelector('.diff-content table');
- },
- get diffRows() {
- return this.container.querySelectorAll('.diff-content .line_holder');
- },
- get noteRow() {
- return this.container.querySelector('.diff-content .notes_holder');
- },
- };
-
- beforeEach(() => {
- store = createStore();
- store.replaceState({
- ...store.state,
- notes: {
- noteableData: {
- current_user: {},
- },
- },
- });
- });
-
- describe('text diff', () => {
- beforeEach(() => {
- vm = mountComponentWithStore(Component, { props, store });
- });
-
- it('removes trailing "+" char', () => {
- const richText = vm.$el.querySelectorAll('.line_holder')[4].querySelector('.line_content')
- .textContent[0];
-
- expect(richText).not.toEqual('+');
- });
-
- it('removes trailing "-" char', () => {
- const richText = vm.$el.querySelector('#LC13').parentNode.textContent[0];
-
- expect(richText).not.toEqual('-');
- });
-
- it('shows text diff', () => {
- expect(selectors.container).toHaveClass('text-file');
- expect(selectors.diffTable).toExist();
- });
-
- it('shows diff lines', () => {
- expect(selectors.diffRows.length).toBe(12);
- });
-
- it('shows notes row', () => {
- expect(selectors.noteRow).toExist();
- });
- });
-
- describe('image diff', () => {
- beforeEach(() => {
- const imageDiffDiscussionMock = getJSONFixture(imageDiscussionFixture)[0];
- props.discussion = imageDiffDiscussionMock;
- });
-
- it('shows image diff', () => {
- vm = mountComponentWithStore(Component, { props, store });
-
- expect(selectors.diffTable).not.toExist();
- });
- });
-});