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-02-25 12:09:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 12:09:10 +0300
commitb98fa9ef3d5bead417ae2f325cb64637883264e9 (patch)
tree409f2002dd056f12d82d3959b3e6f012c4087123 /spec/frontend
parent7e3005967df23a957fe1998c8de4f50b412e69e7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/fixtures/labels.rb17
-rw-r--r--spec/frontend/ide/lib/files_spec.js3
-rw-r--r--spec/frontend/ide/stores/mutations_spec.js6
-rw-r--r--spec/frontend/vue_shared/components/file_row_spec.js37
4 files changed, 53 insertions, 10 deletions
diff --git a/spec/frontend/fixtures/labels.rb b/spec/frontend/fixtures/labels.rb
index e4d66dbcd0a..e5a0501ac03 100644
--- a/spec/frontend/fixtures/labels.rb
+++ b/spec/frontend/fixtures/labels.rb
@@ -41,6 +41,23 @@ describe 'Labels (JavaScript fixtures)' do
end
end
+ describe API::Helpers::LabelHelpers, type: :request do
+ include JavaScriptFixturesHelpers
+ include ApiHelpers
+
+ let(:user) { create(:user) }
+
+ before do
+ group.add_owner(user)
+ end
+
+ it 'api/group_labels.json' do
+ get api("/groups/#{group.id}/labels", user)
+
+ expect(response).to be_successful
+ end
+ end
+
describe Projects::LabelsController, '(JavaScript fixtures)', type: :controller do
render_views
diff --git a/spec/frontend/ide/lib/files_spec.js b/spec/frontend/ide/lib/files_spec.js
index 34eb57ae0d3..2b15aef6454 100644
--- a/spec/frontend/ide/lib/files_spec.js
+++ b/spec/frontend/ide/lib/files_spec.js
@@ -1,7 +1,6 @@
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import { decorateFiles, splitParent } from '~/ide/lib/files';
import { decorateData } from '~/ide/stores/utils';
-import { escapeFileUrl } from '~/lib/utils/url_utility';
const TEST_BRANCH_ID = 'lorem-ipsum';
const TEST_PROJECT_ID = 10;
@@ -22,7 +21,7 @@ const createEntries = paths => {
id: path,
name,
path,
- url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${escapeFileUrl(path)}`),
+ url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${path}`),
type,
previewMode,
binary: (previewMode && previewMode.binary) || false,
diff --git a/spec/frontend/ide/stores/mutations_spec.js b/spec/frontend/ide/stores/mutations_spec.js
index 9fe75d596fb..d9ce59ad378 100644
--- a/spec/frontend/ide/stores/mutations_spec.js
+++ b/spec/frontend/ide/stores/mutations_spec.js
@@ -494,7 +494,7 @@ describe('Multi-file store mutations', () => {
it('properly handles files with spaces in name', () => {
const path = 'my fancy path';
const newPath = 'new path';
- const oldEntry = { ...file(path, path, 'blob'), url: `project/-/${encodeURI(path)}` };
+ const oldEntry = { ...file(path, path, 'blob'), url: `project/-/${path}` };
localState.entries[path] = oldEntry;
@@ -510,12 +510,12 @@ describe('Multi-file store mutations', () => {
id: newPath,
path: newPath,
name: newPath,
- url: `project/-/new%20path`,
+ url: `project/-/new path`,
key: expect.stringMatching(newPath),
prevId: path,
prevName: path,
prevPath: path,
- prevUrl: `project/-/my%20fancy%20path`,
+ prevUrl: `project/-/my fancy path`,
prevKey: oldEntry.key,
prevParentPath: oldEntry.parentPath,
});
diff --git a/spec/frontend/vue_shared/components/file_row_spec.js b/spec/frontend/vue_shared/components/file_row_spec.js
index 420281e844c..b3ced84ddb5 100644
--- a/spec/frontend/vue_shared/components/file_row_spec.js
+++ b/spec/frontend/vue_shared/components/file_row_spec.js
@@ -1,13 +1,19 @@
import { file } from 'jest/ide/helpers';
import FileRow from '~/vue_shared/components/file_row.vue';
-import { mount } from '@vue/test-utils';
+import FileHeader from '~/vue_shared/components/file_row_header.vue';
+import { shallowMount } from '@vue/test-utils';
+import { nextTick } from 'vue';
+import { escapeFileUrl } from '~/lib/utils/url_utility';
describe('File row component', () => {
let wrapper;
- function createComponent(propsData) {
- wrapper = mount(FileRow, {
+ function createComponent(propsData, $router = undefined) {
+ wrapper = shallowMount(FileRow, {
propsData,
+ mocks: {
+ $router,
+ },
});
}
@@ -61,7 +67,7 @@ describe('File row component', () => {
}),
});
- return wrapper.vm.$nextTick().then(() => {
+ return nextTick().then(() => {
expect(wrapper.vm.scrollIntoView).toHaveBeenCalled();
});
});
@@ -85,6 +91,27 @@ describe('File row component', () => {
level: 0,
});
- expect(wrapper.element.classList).toContain('js-file-row-header');
+ expect(wrapper.contains(FileHeader)).toBe(true);
+ });
+
+ it('matches the current route against encoded file URL', () => {
+ const fileName = 'with space';
+ const rowFile = Object.assign({}, file(fileName), {
+ url: `/${fileName}`,
+ });
+ const routerPath = `/project/${escapeFileUrl(fileName)}`;
+ createComponent(
+ {
+ file: rowFile,
+ level: 0,
+ },
+ {
+ currentRoute: {
+ path: routerPath,
+ },
+ },
+ );
+
+ expect(wrapper.vm.hasUrlAtCurrentRoute()).toBe(true);
});
});