summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-23 12:04:03 +0000
committerPhil Hughes <me@iamphill.com>2017-11-23 12:04:03 +0000
commit45631562565760add7a7c52a6137e891f3a0c8f4 (patch)
tree44915f7c46d05fb8c6197662a3341ea8fb610f06 /spec/javascripts/pipelines
parent1d8ab59ebfa0d57e4015665c470c8339cd258a2c (diff)
downloadgitlab-ce-45631562565760add7a7c52a6137e891f3a0c8f4.tar.gz
Improve environments performance
Diffstat (limited to 'spec/javascripts/pipelines')
-rw-r--r--spec/javascripts/pipelines/navigation_tabs_spec.js55
-rw-r--r--spec/javascripts/pipelines/pipelines_spec.js62
2 files changed, 33 insertions, 84 deletions
diff --git a/spec/javascripts/pipelines/navigation_tabs_spec.js b/spec/javascripts/pipelines/navigation_tabs_spec.js
deleted file mode 100644
index f125a2fa189..00000000000
--- a/spec/javascripts/pipelines/navigation_tabs_spec.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import Vue from 'vue';
-import navigationTabs from '~/pipelines/components/navigation_tabs.vue';
-import mountComponent from '../helpers/vue_mount_component_helper';
-
-describe('navigation tabs pipeline component', () => {
- let vm;
- let Component;
- let data;
-
- beforeEach(() => {
- data = [
- {
- name: 'All',
- scope: 'all',
- count: 1,
- isActive: true,
- },
- {
- name: 'Pending',
- scope: 'pending',
- count: 0,
- isActive: false,
- },
- {
- name: 'Running',
- scope: 'running',
- isActive: false,
- },
- ];
-
- Component = Vue.extend(navigationTabs);
- vm = mountComponent(Component, { tabs: data });
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('should render tabs', () => {
- expect(vm.$el.querySelectorAll('li').length).toEqual(data.length);
- });
-
- it('should render active tab', () => {
- expect(vm.$el.querySelector('.active .js-pipelines-tab-all')).toBeDefined();
- });
-
- it('should render badge', () => {
- expect(vm.$el.querySelector('.js-pipelines-tab-all .badge').textContent.trim()).toEqual('1');
- expect(vm.$el.querySelector('.js-pipelines-tab-pending .badge').textContent.trim()).toEqual('0');
- });
-
- it('should not render badge', () => {
- expect(vm.$el.querySelector('.js-pipelines-tab-running .badge')).toEqual(null);
- });
-});
diff --git a/spec/javascripts/pipelines/pipelines_spec.js b/spec/javascripts/pipelines/pipelines_spec.js
index ff38bc1974d..367b42cefb0 100644
--- a/spec/javascripts/pipelines/pipelines_spec.js
+++ b/spec/javascripts/pipelines/pipelines_spec.js
@@ -176,45 +176,49 @@ describe('Pipelines', () => {
});
});
- describe('updateContent', () => {
- it('should set given parameters', () => {
- component = mountComponent(PipelinesComponent, {
- store: new Store(),
- });
- component.updateContent({ scope: 'finished', page: '4' });
-
- expect(component.page).toEqual('4');
- expect(component.scope).toEqual('finished');
- expect(component.requestData.scope).toEqual('finished');
- expect(component.requestData.page).toEqual('4');
+ describe('methods', () => {
+ beforeEach(() => {
+ spyOn(history, 'pushState').and.stub();
});
- });
- describe('onChangeTab', () => {
- it('should set page to 1', () => {
- component = mountComponent(PipelinesComponent, {
- store: new Store(),
- });
+ describe('updateContent', () => {
+ it('should set given parameters', () => {
+ component = mountComponent(PipelinesComponent, {
+ store: new Store(),
+ });
+ component.updateContent({ scope: 'finished', page: '4' });
- spyOn(component, 'updateContent');
+ expect(component.page).toEqual('4');
+ expect(component.scope).toEqual('finished');
+ expect(component.requestData.scope).toEqual('finished');
+ expect(component.requestData.page).toEqual('4');
+ });
+ });
- component.onChangeTab('running');
+ describe('onChangeTab', () => {
+ it('should set page to 1', () => {
+ component = mountComponent(PipelinesComponent, {
+ store: new Store(),
+ });
+ spyOn(component, 'updateContent');
- expect(component.updateContent).toHaveBeenCalledWith({ scope: 'running', page: '1' });
- });
- });
+ component.onChangeTab('running');
- describe('onChangePage', () => {
- it('should update page and keep scope', () => {
- component = mountComponent(PipelinesComponent, {
- store: new Store(),
+ expect(component.updateContent).toHaveBeenCalledWith({ scope: 'running', page: '1' });
});
+ });
- spyOn(component, 'updateContent');
+ describe('onChangePage', () => {
+ it('should update page and keep scope', () => {
+ component = mountComponent(PipelinesComponent, {
+ store: new Store(),
+ });
+ spyOn(component, 'updateContent');
- component.onChangePage(4);
+ component.onChangePage(4);
- expect(component.updateContent).toHaveBeenCalledWith({ scope: component.scope, page: '4' });
+ expect(component.updateContent).toHaveBeenCalledWith({ scope: component.scope, page: '4' });
+ });
});
});
});