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-16 15:08:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 15:08:32 +0300
commitc158fa8d69c704663d289341a014c44c062cda88 (patch)
treed0cac82a9ac9e9ad28bb0030266eb8d5dc91fbbc /spec/frontend
parentb806264d29b8d52ccb78a41dcc3d67f2b040700c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/diffs/components/compare_versions_spec.js3
-rw-r--r--spec/frontend/diffs/components/diff_stats_spec.js18
-rw-r--r--spec/frontend/ide/stores/actions/file_spec.js68
-rw-r--r--spec/frontend/registry/settings/components/__snapshots__/settings_form_spec.js.snap4
-rw-r--r--spec/frontend/registry/settings/store/actions_spec.js14
-rw-r--r--spec/frontend/repository/components/last_commit_spec.js14
-rw-r--r--spec/frontend/vue_shared/components/changed_file_icon_spec.js6
7 files changed, 84 insertions, 43 deletions
diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js
index 7f47677f56c..7648c39976c 100644
--- a/spec/frontend/diffs/components/compare_versions_spec.js
+++ b/spec/frontend/diffs/components/compare_versions_spec.js
@@ -50,8 +50,7 @@ describe('CompareVersions', () => {
expect(treeListBtn.exists()).toBe(true);
expect(treeListBtn.attributes('title')).toBe('Hide file browser');
- expect(treeListBtn.findAll(Icon).length).not.toBe(0);
- expect(treeListBtn.find(Icon).props('name')).toBe('collapse-left');
+ expect(treeListBtn.find(Icon).props('name')).toBe('file-tree');
});
it('should render comparison dropdowns with correct values', () => {
diff --git a/spec/frontend/diffs/components/diff_stats_spec.js b/spec/frontend/diffs/components/diff_stats_spec.js
index 4482abf18c1..aa5c7f6278a 100644
--- a/spec/frontend/diffs/components/diff_stats_spec.js
+++ b/spec/frontend/diffs/components/diff_stats_spec.js
@@ -1,5 +1,4 @@
import { shallowMount } from '@vue/test-utils';
-import Icon from '~/vue_shared/components/icon.vue';
import DiffStats from '~/diffs/components/diff_stats.vue';
describe('diff_stats', () => {
@@ -24,18 +23,11 @@ describe('diff_stats', () => {
},
});
- const findIcon = name =>
- wrapper
- .findAll(Icon)
- .filter(c => c.attributes('name') === name)
- .at(0).element.parentNode;
+ const findFileLine = name => wrapper.find(name);
+ const additions = findFileLine('.js-file-addition-line');
+ const deletions = findFileLine('.js-file-deletion-line');
- const additions = findIcon('file-addition');
- const deletions = findIcon('file-deletion');
- const filesChanged = findIcon('doc-code');
-
- expect(additions.textContent).toContain('100');
- expect(deletions.textContent).toContain('200');
- expect(filesChanged.textContent).toContain('300');
+ expect(additions.text()).toBe('100');
+ expect(deletions.text()).toBe('200');
});
});
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js
index e7b34aa3e7a..a8e48f0b85e 100644
--- a/spec/frontend/ide/stores/actions/file_spec.js
+++ b/spec/frontend/ide/stores/actions/file_spec.js
@@ -514,6 +514,8 @@ describe('IDE store file actions', () => {
describe('changeFileContent', () => {
let tmpFile;
+ const callAction = (content = 'content\n') =>
+ store.dispatch('changeFileContent', { path: tmpFile.path, content });
beforeEach(() => {
tmpFile = file('tmpFile');
@@ -523,11 +525,7 @@ describe('IDE store file actions', () => {
});
it('updates file content', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content\n',
- })
+ callAction()
.then(() => {
expect(tmpFile.content).toBe('content\n');
@@ -537,11 +535,7 @@ describe('IDE store file actions', () => {
});
it('adds a newline to the end of the file if it doesnt already exist', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content',
- })
+ callAction('content')
.then(() => {
expect(tmpFile.content).toBe('content\n');
@@ -551,11 +545,7 @@ describe('IDE store file actions', () => {
});
it('adds file into changedFiles array', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content',
- })
+ callAction()
.then(() => {
expect(store.state.changedFiles.length).toBe(1);
@@ -564,7 +554,7 @@ describe('IDE store file actions', () => {
.catch(done.fail);
});
- it('adds file once into changedFiles array', done => {
+ it('adds file not more than once into changedFiles array', done => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
@@ -604,6 +594,52 @@ describe('IDE store file actions', () => {
.catch(done.fail);
});
+ describe('when `gon.feature.stageAllByDefault` is true', () => {
+ const originalGonFeatures = Object.assign({}, gon.features);
+
+ beforeAll(() => {
+ gon.features = { stageAllByDefault: true };
+ });
+
+ afterAll(() => {
+ gon.features = originalGonFeatures;
+ });
+
+ it('adds file into stagedFiles array', done => {
+ store
+ .dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content',
+ })
+ .then(() => {
+ expect(store.state.stagedFiles.length).toBe(1);
+
+ done();
+ })
+ .catch(done.fail);
+ });
+
+ it('adds file not more than once into stagedFiles array', done => {
+ store
+ .dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content',
+ })
+ .then(() =>
+ store.dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content 123',
+ }),
+ )
+ .then(() => {
+ expect(store.state.stagedFiles.length).toBe(1);
+
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
+
it('bursts unused seal', done => {
store
.dispatch('changeFileContent', {
diff --git a/spec/frontend/registry/settings/components/__snapshots__/settings_form_spec.js.snap b/spec/frontend/registry/settings/components/__snapshots__/settings_form_spec.js.snap
index bef4674bd8b..d26df308b97 100644
--- a/spec/frontend/registry/settings/components/__snapshots__/settings_form_spec.js.snap
+++ b/spec/frontend/registry/settings/components/__snapshots__/settings_form_spec.js.snap
@@ -106,7 +106,7 @@ exports[`Settings Form renders 1`] = `
<glformgroup-stub
id="expiration-policy-latest-group"
- label="Expiration latest:"
+ label="Number of tags to retain:"
label-align="right"
label-cols="3"
label-for="expiration-policy-latest"
@@ -136,7 +136,7 @@ exports[`Settings Form renders 1`] = `
<glformgroup-stub
id="expiration-policy-name-matching-group"
invalid-feedback="The value of this input should be less than 255 characters"
- label="Expire Docker tags with name matching:"
+ label="Expire Docker tags that match this regex:"
label-align="right"
label-cols="3"
label-for="expiration-policy-name-matching"
diff --git a/spec/frontend/registry/settings/store/actions_spec.js b/spec/frontend/registry/settings/store/actions_spec.js
index 71c815cd19c..80fb800ac3a 100644
--- a/spec/frontend/registry/settings/store/actions_spec.js
+++ b/spec/frontend/registry/settings/store/actions_spec.js
@@ -44,7 +44,9 @@ describe('Actions Registry Store', () => {
};
const payload = {
- tag_expiration_policies: 'foo',
+ data: {
+ container_expiration_policy: 'foo',
+ },
};
it('should fetch the data from the API', done => {
@@ -56,7 +58,7 @@ describe('Actions Registry Store', () => {
[],
[
{ type: 'toggleLoading' },
- { type: 'receiveSettingsSuccess', payload: payload.tag_expiration_policies },
+ { type: 'receiveSettingsSuccess', payload: payload.data.container_expiration_policy },
{ type: 'toggleLoading' },
],
done,
@@ -83,7 +85,9 @@ describe('Actions Registry Store', () => {
};
const payload = {
- tag_expiration_policies: 'foo',
+ data: {
+ tag_expiration_policies: 'foo',
+ },
};
it('should fetch the data from the API', done => {
@@ -95,11 +99,11 @@ describe('Actions Registry Store', () => {
[],
[
{ type: 'toggleLoading' },
- { type: 'receiveSettingsSuccess', payload: payload.tag_expiration_policies },
+ { type: 'receiveSettingsSuccess', payload: payload.data.container_expiration_policy },
{ type: 'toggleLoading' },
],
() => {
- expect(createFlash).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE);
+ expect(createFlash).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE, 'success');
done();
},
);
diff --git a/spec/frontend/repository/components/last_commit_spec.js b/spec/frontend/repository/components/last_commit_spec.js
index 30f701ed77a..d2576ec26b7 100644
--- a/spec/frontend/repository/components/last_commit_spec.js
+++ b/spec/frontend/repository/components/last_commit_spec.js
@@ -6,7 +6,7 @@ import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link
let vm;
function createCommitData(data = {}) {
- return {
+ const defaultData = {
sha: '123456789',
title: 'Commit title',
message: 'Commit message',
@@ -26,8 +26,8 @@ function createCommitData(data = {}) {
group: {},
},
},
- ...data,
};
+ return Object.assign(defaultData, data);
}
function factory(commit = createCommitData(), loading = false) {
@@ -46,6 +46,8 @@ function factory(commit = createCommitData(), loading = false) {
vm.vm.$apollo.queries.commit.loading = loading;
}
+const emptyMessageClass = 'font-italic';
+
describe('Repository last commit component', () => {
afterEach(() => {
vm.destroy();
@@ -135,4 +137,12 @@ describe('Repository last commit component', () => {
expect(vm.element).toMatchSnapshot();
});
});
+
+ it('sets correct CSS class if the commit message is empty', () => {
+ factory(createCommitData({ message: '' }));
+
+ return vm.vm.$nextTick().then(() => {
+ expect(vm.find('.item-title').classes()).toContain(emptyMessageClass);
+ });
+ });
});
diff --git a/spec/frontend/vue_shared/components/changed_file_icon_spec.js b/spec/frontend/vue_shared/components/changed_file_icon_spec.js
index 9197cb8bc00..3a52941a06e 100644
--- a/spec/frontend/vue_shared/components/changed_file_icon_spec.js
+++ b/spec/frontend/vue_shared/components/changed_file_icon_spec.js
@@ -57,10 +57,10 @@ describe('Changed file icon', () => {
describe.each`
file | iconName | tooltipText | desc
- ${changedFile()} | ${'file-modified'} | ${'Unstaged modification'} | ${'with file changed'}
+ ${changedFile()} | ${'file-modified-solid'} | ${'Unstaged modification'} | ${'with file changed'}
${stagedFile()} | ${'file-modified-solid'} | ${'Staged modification'} | ${'with file staged'}
- ${changedAndStagedFile()} | ${'file-modified'} | ${'Unstaged and staged modification'} | ${'with file changed and staged'}
- ${newFile()} | ${'file-addition'} | ${'Unstaged addition'} | ${'with file new'}
+ ${changedAndStagedFile()} | ${'file-modified-solid'} | ${'Unstaged and staged modification'} | ${'with file changed and staged'}
+ ${newFile()} | ${'file-addition-solid'} | ${'Unstaged addition'} | ${'with file new'}
`('$desc', ({ file, iconName, tooltipText }) => {
beforeEach(() => {
factory({ file });