diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 21:08:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 21:08:27 +0000 |
commit | 6252c30d1707dcd26f6404f861d27a94f0e1d74f (patch) | |
tree | 9c6030d1f8f9698667674e10034da44f57e2b66b /spec/frontend/diffs | |
parent | 24d67ec55454fc6f4e8e80bf7c8dc5bc677e8514 (diff) | |
download | gitlab-ce-6252c30d1707dcd26f6404f861d27a94f0e1d74f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/diffs')
-rw-r--r-- | spec/frontend/diffs/components/tree_list_spec.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/frontend/diffs/components/tree_list_spec.js b/spec/frontend/diffs/components/tree_list_spec.js index 963805f4792..931a9562d36 100644 --- a/spec/frontend/diffs/components/tree_list_spec.js +++ b/spec/frontend/diffs/components/tree_list_spec.js @@ -50,6 +50,19 @@ describe('Diffs tree list component', () => { type: 'blob', parentPath: 'app', }, + 'test.rb': { + addedLines: 0, + changed: true, + deleted: false, + fileHash: 'test', + key: 'test.rb', + name: 'test.rb', + path: 'app/test.rb', + removedLines: 0, + tempFile: true, + type: 'blob', + parentPath: 'app', + }, app: { key: 'app', path: 'app', @@ -85,6 +98,23 @@ describe('Diffs tree list component', () => { createComponent(); }); + describe('search by file extension', () => { + it.each` + extension | itemSize + ${'*.md'} | ${0} + ${'*.js'} | ${1} + ${'index.js'} | ${1} + ${'app/*.js'} | ${1} + ${'*.js, *.rb'} | ${2} + `('it returns $itemSize item for $extension', async ({ extension, itemSize }) => { + wrapper.find('[data-testid="diff-tree-search"]').setValue(extension); + + await nextTick(); + + expect(getFileRows()).toHaveLength(itemSize); + }); + }); + it('renders tree', () => { expect(getFileRows()).toHaveLength(2); expect(getFileRows().at(0).html()).toContain('index.js'); @@ -120,7 +150,7 @@ describe('Diffs tree list component', () => { wrapper.vm.$store.state.diffs.renderTreeList = false; await nextTick(); - expect(getFileRows()).toHaveLength(1); + expect(getFileRows()).toHaveLength(2); }); it('renders file paths when renderTreeList is false', async () => { |