diff options
Diffstat (limited to 'spec/frontend/repository/components/table')
3 files changed, 84 insertions, 2 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 97597ed8063..ac60fc4917d 100644 --- a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap +++ b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap @@ -1,5 +1,58 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Repository table row component renders a symlink table row 1`] = ` +<tr + class="tree-item" +> + <td + class="tree-item-file-name cursor-default position-relative" + > + <a + class="tree-item-link str-truncated" + data-qa-selector="file_name_link" + href="https://test.com" + > + <file-icon-stub + class="mr-1 position-relative text-secondary" + cssclasses="position-relative file-icon" + filemode="120000" + filename="test" + size="16" + /> + <span + class="position-relative" + > + test + </span> + </a> + + <!----> + + <!----> + + <!----> + </td> + + <td + class="d-none d-sm-table-cell tree-commit cursor-default" + > + <gl-skeleton-loading-stub + class="h-auto" + lines="1" + /> + </td> + + <td + class="tree-time-ago text-right cursor-default" + > + <gl-skeleton-loading-stub + class="ml-auto h-auto w-50" + lines="1" + /> + </td> +</tr> +`; + exports[`Repository table row component renders table row 1`] = ` <tr class="tree-item" @@ -15,6 +68,7 @@ exports[`Repository table row component renders table row 1`] = ` <file-icon-stub class="mr-1 position-relative text-secondary" cssclasses="position-relative file-icon" + filemode="" filename="test" size="16" /> @@ -67,6 +121,7 @@ exports[`Repository table row component renders table row for path with special <file-icon-stub class="mr-1 position-relative text-secondary" cssclasses="position-relative file-icon" + filemode="" filename="test" size="16" /> diff --git a/spec/frontend/repository/components/table/index_spec.js b/spec/frontend/repository/components/table/index_spec.js index 9db90839b29..ed50f292b8c 100644 --- a/spec/frontend/repository/components/table/index_spec.js +++ b/spec/frontend/repository/components/table/index_spec.js @@ -23,6 +23,15 @@ const MOCK_BLOBS = [ type: 'blob', webUrl: 'http://test.com', }, + { + id: '125abc', + sha: '125abc', + flatPath: 'blob3', + name: 'blob3.md', + type: 'blob', + webUrl: 'http://test.com', + mode: '120000', + }, ]; function factory({ path, isLoading = false, entries = {} }) { @@ -74,7 +83,9 @@ describe('Repository table component', () => { }, }); - expect(vm.find(TableRow).exists()).toBe(true); - expect(vm.findAll(TableRow).length).toBe(2); + const rows = vm.findAll(TableRow); + + expect(rows.length).toEqual(3); + expect(rows.at(2).attributes().mode).toEqual('120000'); }); }); diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js index 800a7e586a8..767b117c798 100644 --- a/spec/frontend/repository/components/table/row_spec.js +++ b/spec/frontend/repository/components/table/row_spec.js @@ -2,6 +2,7 @@ import { shallowMount, RouterLinkStub } from '@vue/test-utils'; import { GlBadge, GlLink, GlIcon } from '@gitlab/ui'; import TableRow from '~/repository/components/table/row.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue'; +import { FILE_SYMLINK_MODE } from '~/vue_shared/constants'; let vm; let $router; @@ -48,6 +49,21 @@ describe('Repository table row component', () => { }); }); + it('renders a symlink table row', () => { + factory({ + id: '1', + sha: '123', + path: 'test', + type: 'blob', + currentPath: '/', + mode: FILE_SYMLINK_MODE, + }); + + return vm.vm.$nextTick().then(() => { + expect(vm.element).toMatchSnapshot(); + }); + }); + it('renders table row for path with special character', () => { factory({ id: '1', |