diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 03:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 03:08:01 +0300 |
commit | 1caa60060b2f9e3417ab335e2f1dea1064163434 (patch) | |
tree | 01c0d5825bd345ee625bb70b7433c6e10307fcce /spec/javascripts/vue_shared | |
parent | 7f8330873c1a5860b8a9a52d111083a65d210249 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/vue_shared')
-rw-r--r-- | spec/javascripts/vue_shared/components/loading_button_spec.js | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/spec/javascripts/vue_shared/components/loading_button_spec.js b/spec/javascripts/vue_shared/components/loading_button_spec.js deleted file mode 100644 index 6b03c354e01..00000000000 --- a/spec/javascripts/vue_shared/components/loading_button_spec.js +++ /dev/null @@ -1,111 +0,0 @@ -import Vue from 'vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import loadingButton from '~/vue_shared/components/loading_button.vue'; - -const LABEL = 'Hello'; - -describe('LoadingButton', function() { - let vm; - let LoadingButton; - - beforeEach(() => { - LoadingButton = Vue.extend(loadingButton); - }); - - afterEach(() => { - vm.$destroy(); - }); - - describe('loading spinner', () => { - it('shown when loading', () => { - vm = mountComponent(LoadingButton, { - loading: true, - }); - - expect(vm.$el.querySelector('.js-loading-button-icon')).toBeDefined(); - }); - }); - - describe('disabled state', () => { - it('disabled when loading', () => { - vm = mountComponent(LoadingButton, { - loading: true, - }); - - expect(vm.$el.disabled).toEqual(true); - }); - - it('not disabled when normal', () => { - vm = mountComponent(LoadingButton, { - loading: false, - }); - - expect(vm.$el.disabled).toEqual(false); - }); - }); - - describe('label', () => { - it('shown when normal', () => { - vm = mountComponent(LoadingButton, { - loading: false, - label: LABEL, - }); - const label = vm.$el.querySelector('.js-loading-button-label'); - - expect(label.textContent.trim()).toEqual(LABEL); - }); - - it('shown when loading', () => { - vm = mountComponent(LoadingButton, { - loading: true, - label: LABEL, - }); - const label = vm.$el.querySelector('.js-loading-button-label'); - - expect(label.textContent.trim()).toEqual(LABEL); - }); - }); - - describe('container class', () => { - it('should default to btn btn-align-content', () => { - vm = mountComponent(LoadingButton, {}); - - expect(vm.$el.classList.contains('btn')).toEqual(true); - expect(vm.$el.classList.contains('btn-align-content')).toEqual(true); - }); - - it('should be configurable through props', () => { - vm = mountComponent(LoadingButton, { - containerClass: 'test-class', - }); - - expect(vm.$el.classList.contains('btn')).toEqual(false); - expect(vm.$el.classList.contains('btn-align-content')).toEqual(false); - expect(vm.$el.classList.contains('test-class')).toEqual(true); - }); - }); - - describe('click callback prop', () => { - it('calls given callback when normal', () => { - vm = mountComponent(LoadingButton, { - loading: false, - }); - spyOn(vm, '$emit'); - - vm.$el.click(); - - expect(vm.$emit).toHaveBeenCalledWith('click', jasmine.any(Object)); - }); - - it('does not call given callback when disabled because of loading', () => { - vm = mountComponent(LoadingButton, { - loading: true, - }); - spyOn(vm, '$emit'); - - vm.$el.click(); - - expect(vm.$emit).not.toHaveBeenCalled(); - }); - }); -}); |