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>2020-01-30 00:09:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-30 00:09:22 +0300
commit27d314277bfe7fffec215efa9b1833a23bb82940 (patch)
tree898c606409718e70579beea62174624f84e28629 /spec/javascripts/vue_shared
parent6b9d3a4e8351e662c4586b24bb152de78ae9e3bf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/vue_shared')
-rw-r--r--spec/javascripts/vue_shared/components/header_ci_component_spec.js37
1 files changed, 15 insertions, 22 deletions
diff --git a/spec/javascripts/vue_shared/components/header_ci_component_spec.js b/spec/javascripts/vue_shared/components/header_ci_component_spec.js
index ea2eed2886a..b1abc972e1d 100644
--- a/spec/javascripts/vue_shared/components/header_ci_component_spec.js
+++ b/spec/javascripts/vue_shared/components/header_ci_component_spec.js
@@ -1,5 +1,5 @@
import Vue from 'vue';
-import mountComponent from 'spec/helpers/vue_mount_component_helper';
+import mountComponent, { mountComponentWithSlots } from 'spec/helpers/vue_mount_component_helper';
import headerCi from '~/vue_shared/components/header_ci_component.vue';
describe('Header CI Component', () => {
@@ -27,14 +27,6 @@ describe('Header CI Component', () => {
email: 'foo@bar.com',
avatar_url: 'link',
},
- actions: [
- {
- label: 'Retry',
- path: 'path',
- cssClass: 'btn',
- isLoading: false,
- },
- ],
hasSidebarButton: true,
};
});
@@ -43,6 +35,8 @@ describe('Header CI Component', () => {
vm.$destroy();
});
+ const findActionButtons = () => vm.$el.querySelector('.header-action-buttons');
+
describe('render', () => {
beforeEach(() => {
vm = mountComponent(HeaderCi, props);
@@ -68,24 +62,23 @@ describe('Header CI Component', () => {
expect(vm.$el.querySelector('.js-user-link').innerText.trim()).toContain(props.user.name);
});
- it('should render provided actions', () => {
- const btn = vm.$el.querySelector('.btn');
+ it('should render sidebar toggle button', () => {
+ expect(vm.$el.querySelector('.js-sidebar-build-toggle')).not.toBeNull();
+ });
- expect(btn.tagName).toEqual('BUTTON');
- expect(btn.textContent.trim()).toEqual(props.actions[0].label);
+ it('should not render header action buttons when empty', () => {
+ expect(findActionButtons()).toBeNull();
});
+ });
- it('should show loading icon', done => {
- vm.actions[0].isLoading = true;
+ describe('slot', () => {
+ it('should render header action buttons', () => {
+ vm = mountComponentWithSlots(HeaderCi, { props, slots: { default: 'Test Actions' } });
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.btn .gl-spinner').getAttribute('style')).toBeFalsy();
- done();
- });
- });
+ const buttons = findActionButtons();
- it('should render sidebar toggle button', () => {
- expect(vm.$el.querySelector('.js-sidebar-build-toggle')).not.toBeNull();
+ expect(buttons).not.toBeNull();
+ expect(buttons.textContent).toEqual('Test Actions');
});
});