summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-27 18:08:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-27 18:08:14 +0000
commitab801bd018f129b2c2f7ebe0de677728582c66f0 (patch)
tree017d87f33afadcbc15f6570abaa08c53ed4bdefd /spec/frontend
parent4d5ee2b81486df708e04a0e32ec2ea58b0e5ed5e (diff)
downloadgitlab-ce-ab801bd018f129b2c2f7ebe0de677728582c66f0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/ide/components/repo_commit_section_spec.js20
-rw-r--r--spec/frontend/ide/stores/actions/file_spec.js14
-rw-r--r--spec/frontend/ide/stores/actions_spec.js42
-rw-r--r--spec/frontend/ide/stores/mutations/file_spec.js29
-rw-r--r--spec/frontend/ide/stores/mutations_spec.js10
-rw-r--r--spec/frontend/monitoring/store/getters_spec.js26
6 files changed, 28 insertions, 113 deletions
diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js
index 237be018807..d4e4e064a52 100644
--- a/spec/frontend/ide/components/repo_commit_section_spec.js
+++ b/spec/frontend/ide/components/repo_commit_section_spec.js
@@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils';
import { createStore } from '~/ide/stores';
import router from '~/ide/ide_router';
import RepoCommitSection from '~/ide/components/repo_commit_section.vue';
+import EmptyState from '~/ide/components/commit_sidebar/empty_state.vue';
import { stageKeys } from '~/ide/constants';
import { file } from '../helpers';
@@ -63,7 +64,7 @@ describe('RepoCommitSection', () => {
wrapper.destroy();
});
- describe('empty Stage', () => {
+ describe('empty state', () => {
beforeEach(() => {
store.state.noChangesStateSvgPath = TEST_NO_CHANGES_SVG;
store.state.committedStateSvgPath = 'svg';
@@ -74,11 +75,16 @@ describe('RepoCommitSection', () => {
it('renders no changes text', () => {
expect(
wrapper
- .find('.js-empty-state')
+ .find(EmptyState)
.text()
.trim(),
).toContain('No changes');
- expect(wrapper.find('.js-empty-state img').attributes('src')).toBe(TEST_NO_CHANGES_SVG);
+ expect(
+ wrapper
+ .find(EmptyState)
+ .find('img')
+ .attributes('src'),
+ ).toBe(TEST_NO_CHANGES_SVG);
});
});
@@ -109,6 +115,10 @@ describe('RepoCommitSection', () => {
expect(changedFileNames).toEqual(allFiles.map(x => x.path));
});
+
+ it('does not show empty state', () => {
+ expect(wrapper.find(EmptyState).exists()).toBe(false);
+ });
});
describe('with unstaged file', () => {
@@ -129,5 +139,9 @@ describe('RepoCommitSection', () => {
keyPrefix: stageKeys.unstaged,
});
});
+
+ it('does not show empty state', () => {
+ expect(wrapper.find(EmptyState).exists()).toBe(false);
+ });
});
});
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js
index 43cb06f5d92..e50697af5eb 100644
--- a/spec/frontend/ide/stores/actions/file_spec.js
+++ b/spec/frontend/ide/stores/actions/file_spec.js
@@ -587,20 +587,6 @@ describe('IDE store file actions', () => {
})
.catch(done.fail);
});
-
- it('bursts unused seal', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content',
- })
- .then(() => {
- expect(store.state.unusedSeal).toBe(false);
-
- done();
- })
- .catch(done.fail);
- });
});
describe('with changed file', () => {
diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js
index d52b0435906..666ed8a24aa 100644
--- a/spec/frontend/ide/stores/actions_spec.js
+++ b/spec/frontend/ide/stores/actions_spec.js
@@ -292,21 +292,6 @@ describe('Multi-file store actions', () => {
})
.catch(done.fail);
});
-
- it('bursts unused seal', done => {
- store
- .dispatch('createTempEntry', {
- name: 'test',
- branchId: 'mybranch',
- type: 'blob',
- })
- .then(() => {
- expect(store.state.unusedSeal).toBe(false);
-
- done();
- })
- .catch(done.fail);
- });
});
});
@@ -682,19 +667,6 @@ describe('Multi-file store actions', () => {
});
});
});
-
- it('bursts unused seal', done => {
- store.state.entries.test = file('test');
-
- store
- .dispatch('deleteEntry', 'test')
- .then(() => {
- expect(store.state.unusedSeal).toBe(false);
-
- done();
- })
- .catch(done.fail);
- });
});
describe('renameEntry', () => {
@@ -839,20 +811,6 @@ describe('Multi-file store actions', () => {
.then(done)
.catch(done.fail);
});
-
- it('bursts unused seal', done => {
- store
- .dispatch('renameEntry', {
- path: 'orig',
- name: 'renamed',
- })
- .then(() => {
- expect(store.state.unusedSeal).toBe(false);
-
- done();
- })
- .catch(done.fail);
- });
});
describe('folder', () => {
diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js
index 9b96b910fcb..cd308ee9991 100644
--- a/spec/frontend/ide/stores/mutations/file_spec.js
+++ b/spec/frontend/ide/stores/mutations/file_spec.js
@@ -356,14 +356,6 @@ describe('IDE store file mutations', () => {
expect(localState.changedFiles.length).toBe(1);
});
-
- it('bursts unused seal', () => {
- expect(localState.unusedSeal).toBe(true);
-
- mutations.ADD_FILE_TO_CHANGED(localState, localFile.path);
-
- expect(localState.unusedSeal).toBe(false);
- });
});
describe('REMOVE_FILE_FROM_CHANGED', () => {
@@ -374,14 +366,6 @@ describe('IDE store file mutations', () => {
expect(localState.changedFiles.length).toBe(0);
});
-
- it('bursts unused seal', () => {
- expect(localState.unusedSeal).toBe(true);
-
- mutations.REMOVE_FILE_FROM_CHANGED(localState, localFile.path);
-
- expect(localState.unusedSeal).toBe(false);
- });
});
describe.each`
@@ -533,19 +517,6 @@ describe('IDE store file mutations', () => {
},
);
- describe('STAGE_CHANGE', () => {
- it('bursts unused seal', () => {
- expect(localState.unusedSeal).toBe(true);
-
- mutations.STAGE_CHANGE(localState, {
- path: localFile.path,
- diffInfo: localStore.getters.getDiffInfo(localFile.path),
- });
-
- expect(localState.unusedSeal).toBe(false);
- });
- });
-
describe('TOGGLE_FILE_CHANGED', () => {
it('updates file changed status', () => {
mutations.TOGGLE_FILE_CHANGED(localState, {
diff --git a/spec/frontend/ide/stores/mutations_spec.js b/spec/frontend/ide/stores/mutations_spec.js
index 2eca9acb8d8..55cc6eb66ab 100644
--- a/spec/frontend/ide/stores/mutations_spec.js
+++ b/spec/frontend/ide/stores/mutations_spec.js
@@ -265,16 +265,6 @@ describe('Multi-file store mutations', () => {
expect(localState.changedFiles).toEqual([]);
expect(localState.stagedFiles).toEqual([]);
});
-
- it('bursts unused seal', () => {
- localState.entries.test = file('test');
-
- expect(localState.unusedSeal).toBe(true);
-
- mutations.DELETE_ENTRY(localState, 'test');
-
- expect(localState.unusedSeal).toBe(false);
- });
});
describe('UPDATE_FILE_AFTER_COMMIT', () => {
diff --git a/spec/frontend/monitoring/store/getters_spec.js b/spec/frontend/monitoring/store/getters_spec.js
index 9f17dda3b9f..c7d0fb119de 100644
--- a/spec/frontend/monitoring/store/getters_spec.js
+++ b/spec/frontend/monitoring/store/getters_spec.js
@@ -329,7 +329,7 @@ describe('Monitoring store Getters', () => {
});
});
- describe('getCustomVariablesArray', () => {
+ describe('getCustomVariablesParams', () => {
let state;
beforeEach(() => {
@@ -340,25 +340,21 @@ describe('Monitoring store Getters', () => {
it('transforms the variables object to an array in the [variable, variable_value] format for all variable types', () => {
mutations[types.SET_VARIABLES](state, mockTemplatingDataResponses.allVariableTypes);
- const variablesArray = getters.getCustomVariablesArray(state);
-
- expect(variablesArray).toEqual([
- 'simpleText',
- 'Simple text',
- 'advText',
- 'default',
- 'simpleCustom',
- 'value1',
- 'advCustomNormal',
- 'value2',
- ]);
+ const variablesArray = getters.getCustomVariablesParams(state);
+
+ expect(variablesArray).toEqual({
+ 'variables[advCustomNormal]': 'value2',
+ 'variables[advText]': 'default',
+ 'variables[simpleCustom]': 'value1',
+ 'variables[simpleText]': 'Simple text',
+ });
});
it('transforms the variables object to an empty array when no keys are present', () => {
mutations[types.SET_VARIABLES](state, {});
- const variablesArray = getters.getCustomVariablesArray(state);
+ const variablesArray = getters.getCustomVariablesParams(state);
- expect(variablesArray).toEqual([]);
+ expect(variablesArray).toEqual({});
});
});