From 07487628f4c900f4eb09e3cf11a525be0498bd58 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Wed, 28 Feb 2018 21:47:44 +0000 Subject: Rename modal.vue to deprecated_modal.vue --- .../vue_shared/components/deprecated_modal_spec.js | 67 ++++++++++++++++++++++ .../vue_shared/components/modal_spec.js | 67 ---------------------- 2 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 spec/javascripts/vue_shared/components/deprecated_modal_spec.js delete mode 100644 spec/javascripts/vue_shared/components/modal_spec.js (limited to 'spec') diff --git a/spec/javascripts/vue_shared/components/deprecated_modal_spec.js b/spec/javascripts/vue_shared/components/deprecated_modal_spec.js new file mode 100644 index 00000000000..59d4e549a91 --- /dev/null +++ b/spec/javascripts/vue_shared/components/deprecated_modal_spec.js @@ -0,0 +1,67 @@ +import $ from 'jquery'; +import Vue from 'vue'; +import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue'; +import mountComponent from 'spec/helpers/vue_mount_component_helper'; + +const modalComponent = Vue.extend(DeprecatedModal); + +describe('DeprecatedModal', () => { + let vm; + + afterEach(() => { + vm.$destroy(); + }); + + describe('props', () => { + describe('without primaryButtonLabel', () => { + beforeEach(() => { + vm = mountComponent(modalComponent, { + primaryButtonLabel: null, + }); + }); + + it('does not render a primary button', () => { + expect(vm.$el.querySelector('.js-primary-button')).toBeNull(); + }); + }); + + describe('with id', () => { + describe('does not render a primary button', () => { + beforeEach(() => { + vm = mountComponent(modalComponent, { + id: 'my-modal', + }); + }); + + it('assigns the id to the modal', () => { + expect(vm.$el.querySelector('#my-modal.modal')).not.toBeNull(); + }); + + it('does not show the modal immediately', () => { + expect(vm.$el.querySelector('#my-modal.modal')).not.toHaveClass('show'); + }); + + it('does not show a backdrop', () => { + expect(vm.$el.querySelector('modal-backdrop')).toBeNull(); + }); + }); + }); + + it('works with data-toggle="modal"', (done) => { + setFixtures(` + + + `); + + const modalContainer = document.getElementById('modal-container'); + const modalButton = document.getElementById('modal-button'); + vm = mountComponent(modalComponent, { + id: 'my-modal', + }, modalContainer); + const modalElement = vm.$el.querySelector('#my-modal'); + $(modalElement).on('shown.bs.modal', () => done()); + + modalButton.click(); + }); + }); +}); diff --git a/spec/javascripts/vue_shared/components/modal_spec.js b/spec/javascripts/vue_shared/components/modal_spec.js deleted file mode 100644 index d01a94c25e5..00000000000 --- a/spec/javascripts/vue_shared/components/modal_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -import $ from 'jquery'; -import Vue from 'vue'; -import modal from '~/vue_shared/components/modal.vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; - -const modalComponent = Vue.extend(modal); - -describe('Modal', () => { - let vm; - - afterEach(() => { - vm.$destroy(); - }); - - describe('props', () => { - describe('without primaryButtonLabel', () => { - beforeEach(() => { - vm = mountComponent(modalComponent, { - primaryButtonLabel: null, - }); - }); - - it('does not render a primary button', () => { - expect(vm.$el.querySelector('.js-primary-button')).toBeNull(); - }); - }); - - describe('with id', () => { - describe('does not render a primary button', () => { - beforeEach(() => { - vm = mountComponent(modalComponent, { - id: 'my-modal', - }); - }); - - it('assigns the id to the modal', () => { - expect(vm.$el.querySelector('#my-modal.modal')).not.toBeNull(); - }); - - it('does not show the modal immediately', () => { - expect(vm.$el.querySelector('#my-modal.modal')).not.toHaveClass('show'); - }); - - it('does not show a backdrop', () => { - expect(vm.$el.querySelector('modal-backdrop')).toBeNull(); - }); - }); - }); - - it('works with data-toggle="modal"', (done) => { - setFixtures(` - - - `); - - const modalContainer = document.getElementById('modal-container'); - const modalButton = document.getElementById('modal-button'); - vm = mountComponent(modalComponent, { - id: 'my-modal', - }, modalContainer); - const modalElement = vm.$el.querySelector('#my-modal'); - $(modalElement).on('shown.bs.modal', () => done()); - - modalButton.click(); - }); - }); -}); -- cgit v1.2.1