diff options
Diffstat (limited to 'spec/frontend')
4 files changed, 49 insertions, 11 deletions
diff --git a/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js b/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js index edd18c57f43..1a45ada98f9 100644 --- a/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js +++ b/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js @@ -6,6 +6,7 @@ import { shallowMountExtended, extendedWrapper } from 'helpers/vue_test_utils_he import InlineConflictLines from '~/merge_conflicts/components/inline_conflict_lines.vue'; import ParallelConflictLines from '~/merge_conflicts/components/parallel_conflict_lines.vue'; import component from '~/merge_conflicts/merge_conflict_resolver_app.vue'; +import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import { createStore } from '~/merge_conflicts/store'; import { decorateFiles } from '~/merge_conflicts/utils'; import { conflictsMock } from '../mock_data'; @@ -49,6 +50,7 @@ describe('Merge Conflict Resolver App', () => { const findInlineConflictLines = (w = wrapper) => w.findComponent(InlineConflictLines); const findParallelConflictLines = (w = wrapper) => w.findComponent(ParallelConflictLines); const findCommitMessageTextarea = () => wrapper.findByTestId('commit-message'); + const findClipboardButton = (w = wrapper) => w.findComponent(ClipboardButton); it('shows the amount of conflicts', () => { mountComponent(); @@ -131,6 +133,21 @@ describe('Merge Conflict Resolver App', () => { expect(parallelConflictLinesComponent.props('file')).toEqual(decoratedMockFiles[0]); }); }); + + describe('clipboard button', () => { + it('exists', () => { + mountComponent(); + expect(findClipboardButton().exists()).toBe(true); + }); + + it('has the correct props', () => { + mountComponent(); + expect(findClipboardButton().attributes()).toMatchObject({ + text: decoratedMockFiles[0].filePath, + title: 'Copy file path', + }); + }); + }); }); describe('submit form', () => { diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js index f4e36f51c27..6a1c34df596 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js @@ -1,4 +1,5 @@ import { nextTick } from 'vue'; +import { GlFilteredSearchToken } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { sortableFields } from '~/packages_and_registries/package_registry/utils'; import component from '~/packages_and_registries/package_registry/components/list/package_search.vue'; @@ -7,7 +8,11 @@ import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue'; import { LIST_KEY_CREATED_AT } from '~/packages_and_registries/package_registry/constants'; -import { TOKEN_TYPE_TYPE } from '~/vue_shared/components/filtered_search_bar/constants'; +import { + OPERATORS_IS, + TOKEN_TYPE_TYPE, + TOKEN_TYPE_VERSION, +} from '~/vue_shared/components/filtered_search_bar/constants'; describe('Package Search', () => { let wrapper; @@ -74,6 +79,13 @@ describe('Package Search', () => { token: PackageTypeToken, type: TOKEN_TYPE_TYPE, icon: 'package', + operators: OPERATORS_IS, + }), + expect.objectContaining({ + token: GlFilteredSearchToken, + type: TOKEN_TYPE_VERSION, + icon: 'doc-versions', + operators: OPERATORS_IS, }), ]), sortableFields: sortableFields(isGroupPage), @@ -102,6 +114,7 @@ describe('Package Search', () => { filters: { packageName: '', packageType: undefined, + packageVersion: '', }, sort: payload.sort, sorting: payload.sorting, @@ -114,6 +127,7 @@ describe('Package Search', () => { sort: 'CREATED_FOO', filters: [ { type: 'type', value: { data: 'Generic', operator: '=' }, id: 'token-3' }, + { type: 'version', value: { data: '1.0.1', operator: '=' }, id: 'token-6' }, { id: 'token-4', type: 'filtered-search-term', value: { data: 'gl' } }, { id: 'token-5', type: 'filtered-search-term', value: { data: '' } }, ], @@ -133,6 +147,7 @@ describe('Package Search', () => { filters: { packageName: 'gl', packageType: 'GENERIC', + packageVersion: '1.0.1', }, sort: payload.sort, sorting: payload.sorting, diff --git a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js index 0ce2b86b9a4..db86be3b8ee 100644 --- a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js @@ -44,7 +44,7 @@ describe('PackagesListApp', () => { const searchPayload = { sort: 'VERSION_DESC', - filters: { packageName: 'foo', packageType: 'CONAN' }, + filters: { packageName: 'foo', packageType: 'CONAN', packageVersion: '1.0.1' }, }; const findPackageTitle = () => wrapper.findComponent(PackageTitle); @@ -304,7 +304,12 @@ describe('PackagesListApp', () => { await waitForFirstRequest(); - findSearch().vm.$emit('update', searchPayload); + findSearch().vm.$emit('update', { + sort: 'VERSION_DESC', + filters: { + packageName: 'test', + }, + }); return nextTick(); }); diff --git a/spec/frontend/packages_and_registries/shared/utils_spec.js b/spec/frontend/packages_and_registries/shared/utils_spec.js index 1dc6bb261de..4676544c324 100644 --- a/spec/frontend/packages_and_registries/shared/utils_spec.js +++ b/spec/frontend/packages_and_registries/shared/utils_spec.js @@ -41,19 +41,20 @@ describe('Packages And Registries shared utils', () => { }); describe('extractFilterAndSorting', () => { it.each` - search | type | sort | orderBy | result - ${['one']} | ${'myType'} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [{ type: 'type', value: { data: 'myType' } }, { type: FILTERED_SEARCH_TERM, value: { data: 'one' } }] }} - ${['one']} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [{ type: FILTERED_SEARCH_TERM, value: { data: 'one' } }] }} - ${[]} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [] }} - ${null} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [] }} - ${null} | ${null} | ${null} | ${'foo'} | ${{ sorting: { orderBy: 'foo' }, filters: [] }} - ${null} | ${null} | ${null} | ${null} | ${{ sorting: {}, filters: [] }} + search | type | version | sort | orderBy | result + ${['one']} | ${'myType'} | ${'1.0.1'} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [{ type: 'type', value: { data: 'myType' } }, { type: 'version', value: { data: '1.0.1' } }, { type: FILTERED_SEARCH_TERM, value: { data: 'one' } }] }} + ${['one']} | ${null} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [{ type: FILTERED_SEARCH_TERM, value: { data: 'one' } }] }} + ${[]} | ${null} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [] }} + ${null} | ${null} | ${null} | ${'asc'} | ${'foo'} | ${{ sorting: { sort: 'asc', orderBy: 'foo' }, filters: [] }} + ${null} | ${null} | ${null} | ${null} | ${'foo'} | ${{ sorting: { orderBy: 'foo' }, filters: [] }} + ${null} | ${null} | ${null} | ${null} | ${null} | ${{ sorting: {}, filters: [] }} `( 'returns sorting and filters objects in the correct form', - ({ search, type, sort, orderBy, result }) => { + ({ search, type, version, sort, orderBy, result }) => { const queryObject = { search, type, + version, sort, orderBy, }; |