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:
Diffstat (limited to 'spec/frontend/repository/components')
-rw-r--r--spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap58
-rw-r--r--spec/frontend/repository/components/table/row_spec.js64
2 files changed, 34 insertions, 88 deletions
diff --git a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
index 2d411fcce79..5b5c9fd714e 100644
--- a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
+++ b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
@@ -2,25 +2,28 @@
exports[`Repository table row component renders table row 1`] = `
<tr
- class="tree-item file_1"
+ class="tree-item"
>
<td
- class="tree-item-file-name"
+ class="tree-item-file-name cursor-default position-relative"
>
- <i
- aria-label="file"
- class="fa fa-fw fa-file-text-o"
- role="img"
- />
+ <!---->
<a
- class="str-truncated"
+ class="tree-item-link str-truncated"
data-qa-selector="file_name_link"
href="https://test.com"
>
-
- test
-
+ <i
+ aria-label="file"
+ class="fa fa-fw mr-1 fa-file-text-o"
+ role="img"
+ />
+ <span
+ class="position-relative"
+ >
+ test
+ </span>
</a>
<!---->
@@ -31,7 +34,7 @@ exports[`Repository table row component renders table row 1`] = `
</td>
<td
- class="d-none d-sm-table-cell tree-commit"
+ class="d-none d-sm-table-cell tree-commit cursor-default"
>
<gl-skeleton-loading-stub
class="h-auto"
@@ -40,7 +43,7 @@ exports[`Repository table row component renders table row 1`] = `
</td>
<td
- class="tree-time-ago text-right"
+ class="tree-time-ago text-right cursor-default"
>
<gl-skeleton-loading-stub
class="ml-auto h-auto w-50"
@@ -52,25 +55,28 @@ exports[`Repository table row component renders table row 1`] = `
exports[`Repository table row component renders table row for path with special character 1`] = `
<tr
- class="tree-item file_1"
+ class="tree-item"
>
<td
- class="tree-item-file-name"
+ class="tree-item-file-name cursor-default position-relative"
>
- <i
- aria-label="file"
- class="fa fa-fw fa-file-text-o"
- role="img"
- />
+ <!---->
<a
- class="str-truncated"
+ class="tree-item-link str-truncated"
data-qa-selector="file_name_link"
href="https://test.com"
>
-
- test
-
+ <i
+ aria-label="file"
+ class="fa fa-fw mr-1 fa-file-text-o"
+ role="img"
+ />
+ <span
+ class="position-relative"
+ >
+ test
+ </span>
</a>
<!---->
@@ -81,7 +87,7 @@ exports[`Repository table row component renders table row for path with special
</td>
<td
- class="d-none d-sm-table-cell tree-commit"
+ class="d-none d-sm-table-cell tree-commit cursor-default"
>
<gl-skeleton-loading-stub
class="h-auto"
@@ -90,7 +96,7 @@ exports[`Repository table row component renders table row for path with special
</td>
<td
- class="tree-time-ago text-right"
+ class="tree-time-ago text-right cursor-default"
>
<gl-skeleton-loading-stub
class="ml-auto h-auto w-50"
diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js
index 22aacdc735c..7bb7ad6e5dd 100644
--- a/spec/frontend/repository/components/table/row_spec.js
+++ b/spec/frontend/repository/components/table/row_spec.js
@@ -1,14 +1,8 @@
import { shallowMount, RouterLinkStub } from '@vue/test-utils';
import { GlBadge, GlLink, GlLoadingIcon } from '@gitlab/ui';
-import { visitUrl } from '~/lib/utils/url_utility';
import TableRow from '~/repository/components/table/row.vue';
import Icon from '~/vue_shared/components/icon.vue';
-jest.mock('~/lib/utils/url_utility', () => ({
- ...jest.requireActual('~/lib/utils/url_utility'),
- visitUrl: jest.fn(),
-}));
-
let vm;
let $router;
@@ -88,31 +82,6 @@ describe('Repository table row component', () => {
});
it.each`
- type | pushes
- ${'tree'} | ${true}
- ${'file'} | ${false}
- ${'commit'} | ${false}
- `('pushes new router if type $type is tree', ({ type, pushes }) => {
- factory({
- id: '1',
- sha: '123',
- path: 'test',
- type,
- currentPath: '/',
- });
-
- return vm.vm.$nextTick().then(() => {
- vm.trigger('click');
-
- if (pushes) {
- expect($router.push).toHaveBeenCalledWith({ path: '/-/tree/master/test' });
- } else {
- expect($router.push).not.toHaveBeenCalled();
- }
- });
- });
-
- it.each`
path
${'test#'}
${'Ă„nderungen'}
@@ -132,7 +101,7 @@ describe('Repository table row component', () => {
});
});
- it('pushes new route for directory with hash', () => {
+ it('renders link for directory with hash', () => {
factory({
id: '1',
sha: '123',
@@ -142,36 +111,7 @@ describe('Repository table row component', () => {
});
return vm.vm.$nextTick().then(() => {
- vm.trigger('click');
-
- expect($router.push).toHaveBeenCalledWith({ path: '/-/tree/master/test%23' });
- });
- });
-
- it.each`
- type | pushes
- ${'tree'} | ${true}
- ${'file'} | ${false}
- ${'commit'} | ${false}
- `('calls visitUrl if $type is not tree', ({ type, pushes }) => {
- factory({
- id: '1',
- sha: '123',
- path: 'test',
- type,
- currentPath: '/',
- });
-
- return vm.vm.$nextTick().then(() => {
- vm.trigger('click');
-
- if (pushes) {
- expect(visitUrl).not.toHaveBeenCalled();
- } else {
- const [url, external] = visitUrl.mock.calls[0];
- expect(url).toBe('https://test.com');
- expect(external).toBeFalsy();
- }
+ expect(vm.find('.tree-item-link').props('to')).toEqual({ path: '/-/tree/master/test%23' });
});
});