Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 18:07:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 18:07:34 +0300
commit8b61452138ecc511b52cd49be4ee6b8a80390c50 (patch)
tree122b817432c2a0f0e23767bd95791a89b20540c0 /spec/javascripts/issue_show
parentf864f8a7aafa45b0e4c04e4312f89da4b1227c0f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/issue_show')
-rw-r--r--spec/javascripts/issue_show/components/edit_actions_spec.js134
-rw-r--r--spec/javascripts/issue_show/components/fields/description_spec.js70
-rw-r--r--spec/javascripts/issue_show/components/fields/title_spec.js48
-rw-r--r--spec/javascripts/issue_show/index_spec.js19
4 files changed, 0 insertions, 271 deletions
diff --git a/spec/javascripts/issue_show/components/edit_actions_spec.js b/spec/javascripts/issue_show/components/edit_actions_spec.js
deleted file mode 100644
index 2ab74ae4e10..00000000000
--- a/spec/javascripts/issue_show/components/edit_actions_spec.js
+++ /dev/null
@@ -1,134 +0,0 @@
-import Vue from 'vue';
-import editActions from '~/issue_show/components/edit_actions.vue';
-import eventHub from '~/issue_show/event_hub';
-import Store from '~/issue_show/stores';
-
-describe('Edit Actions components', () => {
- let vm;
-
- beforeEach(done => {
- const Component = Vue.extend(editActions);
- const store = new Store({
- titleHtml: '',
- descriptionHtml: '',
- issuableRef: '',
- });
- store.formState.title = 'test';
-
- spyOn(eventHub, '$emit');
-
- vm = new Component({
- propsData: {
- canDestroy: true,
- formState: store.formState,
- issuableType: 'issue',
- },
- }).$mount();
-
- Vue.nextTick(done);
- });
-
- it('renders all buttons as enabled', () => {
- expect(vm.$el.querySelectorAll('.disabled').length).toBe(0);
-
- expect(vm.$el.querySelectorAll('[disabled]').length).toBe(0);
- });
-
- it('does not render delete button if canUpdate is false', done => {
- vm.canDestroy = false;
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-danger')).toBeNull();
-
- done();
- });
- });
-
- it('disables submit button when title is blank', done => {
- vm.formState.title = '';
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled');
-
- done();
- });
- });
-
- it('should not show delete button if showDeleteButton is false', done => {
- vm.showDeleteButton = false;
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-danger')).toBeNull();
- done();
- });
- });
-
- describe('updateIssuable', () => {
- it('sends update.issauble event when clicking save button', () => {
- vm.$el.querySelector('.btn-success').click();
-
- expect(eventHub.$emit).toHaveBeenCalledWith('update.issuable');
- });
-
- it('shows loading icon after clicking save button', done => {
- vm.$el.querySelector('.btn-success').click();
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-success .fa')).not.toBeNull();
-
- done();
- });
- });
-
- it('disabled button after clicking save button', done => {
- vm.$el.querySelector('.btn-success').click();
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled');
-
- done();
- });
- });
- });
-
- describe('closeForm', () => {
- it('emits close.form when clicking cancel', () => {
- vm.$el.querySelector('.btn-default').click();
-
- expect(eventHub.$emit).toHaveBeenCalledWith('close.form');
- });
- });
-
- describe('deleteIssuable', () => {
- it('sends delete.issuable event when clicking save button', () => {
- spyOn(window, 'confirm').and.returnValue(true);
- vm.$el.querySelector('.btn-danger').click();
-
- expect(eventHub.$emit).toHaveBeenCalledWith('delete.issuable', { destroy_confirm: true });
- });
-
- it('shows loading icon after clicking delete button', done => {
- spyOn(window, 'confirm').and.returnValue(true);
- vm.$el.querySelector('.btn-danger').click();
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn-danger .fa')).not.toBeNull();
-
- done();
- });
- });
-
- it('does no actions when confirm is false', done => {
- spyOn(window, 'confirm').and.returnValue(false);
- vm.$el.querySelector('.btn-danger').click();
-
- Vue.nextTick(() => {
- expect(eventHub.$emit).not.toHaveBeenCalledWith('delete.issuable');
-
- expect(vm.$el.querySelector('.btn-danger .fa')).toBeNull();
-
- done();
- });
- });
- });
-});
diff --git a/spec/javascripts/issue_show/components/fields/description_spec.js b/spec/javascripts/issue_show/components/fields/description_spec.js
deleted file mode 100644
index f5f87a6bfbf..00000000000
--- a/spec/javascripts/issue_show/components/fields/description_spec.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import Vue from 'vue';
-import eventHub from '~/issue_show/event_hub';
-import Store from '~/issue_show/stores';
-import descriptionField from '~/issue_show/components/fields/description.vue';
-import { keyboardDownEvent } from '../../helpers';
-
-describe('Description field component', () => {
- let vm;
- let store;
-
- beforeEach(done => {
- const Component = Vue.extend(descriptionField);
- const el = document.createElement('div');
- store = new Store({
- titleHtml: '',
- descriptionHtml: '',
- issuableRef: '',
- });
- store.formState.description = 'test';
-
- document.body.appendChild(el);
-
- spyOn(eventHub, '$emit');
-
- vm = new Component({
- el,
- propsData: {
- markdownPreviewPath: '/',
- markdownDocsPath: '/',
- formState: store.formState,
- },
- }).$mount();
-
- Vue.nextTick(done);
- });
-
- it('renders markdown field with description', () => {
- expect(vm.$el.querySelector('.md-area textarea').value).toBe('test');
- });
-
- it('renders markdown field with a markdown description', done => {
- store.formState.description = '**test**';
-
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.md-area textarea').value).toBe('**test**');
-
- done();
- });
- });
-
- it('focuses field when mounted', () => {
- expect(document.activeElement).toBe(vm.$refs.textarea);
- });
-
- it('triggers update with meta+enter', () => {
- vm.$el.querySelector('.md-area textarea').dispatchEvent(keyboardDownEvent(13, true));
-
- expect(eventHub.$emit).toHaveBeenCalled();
- });
-
- it('triggers update with ctrl+enter', () => {
- vm.$el.querySelector('.md-area textarea').dispatchEvent(keyboardDownEvent(13, false, true));
-
- expect(eventHub.$emit).toHaveBeenCalled();
- });
-
- it('has a ref named `textarea`', () => {
- expect(vm.$refs.textarea).not.toBeNull();
- });
-});
diff --git a/spec/javascripts/issue_show/components/fields/title_spec.js b/spec/javascripts/issue_show/components/fields/title_spec.js
deleted file mode 100644
index 62dff983250..00000000000
--- a/spec/javascripts/issue_show/components/fields/title_spec.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import Vue from 'vue';
-import eventHub from '~/issue_show/event_hub';
-import Store from '~/issue_show/stores';
-import titleField from '~/issue_show/components/fields/title.vue';
-import { keyboardDownEvent } from '../../helpers';
-
-describe('Title field component', () => {
- let vm;
- let store;
-
- beforeEach(() => {
- const Component = Vue.extend(titleField);
- store = new Store({
- titleHtml: '',
- descriptionHtml: '',
- issuableRef: '',
- });
- store.formState.title = 'test';
-
- spyOn(eventHub, '$emit');
-
- vm = new Component({
- propsData: {
- formState: store.formState,
- },
- }).$mount();
- });
-
- it('renders form control with formState title', () => {
- expect(vm.$el.querySelector('.form-control').value).toBe('test');
- });
-
- it('triggers update with meta+enter', () => {
- vm.$el.querySelector('.form-control').dispatchEvent(keyboardDownEvent(13, true));
-
- expect(eventHub.$emit).toHaveBeenCalled();
- });
-
- it('triggers update with ctrl+enter', () => {
- vm.$el.querySelector('.form-control').dispatchEvent(keyboardDownEvent(13, false, true));
-
- expect(eventHub.$emit).toHaveBeenCalled();
- });
-
- it('has a ref named `input`', () => {
- expect(vm.$refs.input).not.toBeNull();
- });
-});
diff --git a/spec/javascripts/issue_show/index_spec.js b/spec/javascripts/issue_show/index_spec.js
deleted file mode 100644
index fa0b426c06c..00000000000
--- a/spec/javascripts/issue_show/index_spec.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import initIssueableApp from '~/issue_show';
-
-describe('Issue show index', () => {
- describe('initIssueableApp', () => {
- it('should initialize app with no potential XSS attack', () => {
- const d = document.createElement('div');
- d.id = 'js-issuable-app-initial-data';
- d.innerHTML = JSON.stringify({
- initialDescriptionHtml: '&lt;img src=x onerror=alert(1)&gt;',
- });
- document.body.appendChild(d);
-
- const alertSpy = spyOn(window, 'alert');
- initIssueableApp();
-
- expect(alertSpy).not.toHaveBeenCalled();
- });
- });
-});