diff options
Diffstat (limited to 'spec/frontend')
7 files changed, 80 insertions, 109 deletions
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js index 628c34a27c1..c59806a5d60 100644 --- a/spec/frontend/editor/schema/ci/ci_schema_spec.js +++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js @@ -38,6 +38,7 @@ const ajv = new Ajv({ strictTuples: false, allowMatchingProperties: true, }); +ajv.addKeyword('markdownDescription'); AjvFormats(ajv); const schema = ajv.compile(CiSchema); diff --git a/spec/frontend/issues/list/components/issues_list_app_spec.js b/spec/frontend/issues/list/components/issues_list_app_spec.js index d92ba527b5c..7de653e3069 100644 --- a/spec/frontend/issues/list/components/issues_list_app_spec.js +++ b/spec/frontend/issues/list/components/issues_list_app_spec.js @@ -301,17 +301,23 @@ describe('CE IssuesListApp component', () => { describe('initial url params', () => { describe('page', () => { it('page_after is set from the url params', () => { - setWindowLocation('?page_after=randomCursorString'); + setWindowLocation('?page_after=randomCursorString&first_page_size=20'); wrapper = mountComponent(); - expect(wrapper.vm.$route.query).toMatchObject({ page_after: 'randomCursorString' }); + expect(wrapper.vm.$route.query).toMatchObject({ + page_after: 'randomCursorString', + first_page_size: '20', + }); }); it('page_before is set from the url params', () => { - setWindowLocation('?page_before=anotherRandomCursorString'); + setWindowLocation('?page_before=anotherRandomCursorString&last_page_size=20'); wrapper = mountComponent(); - expect(wrapper.vm.$route.query).toMatchObject({ page_before: 'anotherRandomCursorString' }); + expect(wrapper.vm.$route.query).toMatchObject({ + page_before: 'anotherRandomCursorString', + last_page_size: '20', + }); }); }); @@ -675,10 +681,10 @@ describe('CE IssuesListApp component', () => { }); describe.each` - event | paramName | paramValue - ${'next-page'} | ${'page_after'} | ${'endCursor'} - ${'previous-page'} | ${'page_before'} | ${'startCursor'} - `('when "$event" event is emitted by IssuableList', ({ event, paramName, paramValue }) => { + event | params + ${'next-page'} | ${{ page_after: 'endCursor', page_before: undefined, first_page_size: 20, last_page_size: undefined }} + ${'previous-page'} | ${{ page_after: undefined, page_before: 'startCursor', first_page_size: undefined, last_page_size: 20 }} + `('when "$event" event is emitted by IssuableList', ({ event, params }) => { beforeEach(() => { wrapper = mountComponent({ data: { @@ -697,9 +703,9 @@ describe('CE IssuesListApp component', () => { expect(scrollUp).toHaveBeenCalled(); }); - it(`updates url with "${paramName}" param`, () => { + it(`updates url`, () => { expect(wrapper.vm.$router.push).toHaveBeenCalledWith({ - query: expect.objectContaining({ [paramName]: paramValue }), + query: expect.objectContaining(params), }); }); }); diff --git a/spec/frontend/issues/list/utils_spec.js b/spec/frontend/issues/list/utils_spec.js index ce0477883d7..e8ffba9bc80 100644 --- a/spec/frontend/issues/list/utils_spec.js +++ b/spec/frontend/issues/list/utils_spec.js @@ -42,27 +42,37 @@ describe('getInitialPageParams', () => { 'returns the correct page params for sort key %s with afterCursor', (sortKey) => { const firstPageSize = sortKey === RELATIVE_POSITION_ASC ? PAGE_SIZE_MANUAL : PAGE_SIZE; + const lastPageSize = undefined; const afterCursor = 'randomCursorString'; const beforeCursor = undefined; - - expect(getInitialPageParams(sortKey, afterCursor, beforeCursor)).toEqual({ + const pageParams = getInitialPageParams( + sortKey, firstPageSize, + lastPageSize, afterCursor, - }); + beforeCursor, + ); + + expect(pageParams).toEqual({ firstPageSize, afterCursor }); }, ); it.each(Object.keys(urlSortParams))( 'returns the correct page params for sort key %s with beforeCursor', (sortKey) => { - const firstPageSize = sortKey === RELATIVE_POSITION_ASC ? PAGE_SIZE_MANUAL : PAGE_SIZE; + const firstPageSize = undefined; + const lastPageSize = PAGE_SIZE; const afterCursor = undefined; const beforeCursor = 'anotherRandomCursorString'; - - expect(getInitialPageParams(sortKey, afterCursor, beforeCursor)).toEqual({ + const pageParams = getInitialPageParams( + sortKey, firstPageSize, + lastPageSize, + afterCursor, beforeCursor, - }); + ); + + expect(pageParams).toEqual({ lastPageSize, beforeCursor }); }, ); }); diff --git a/spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row_spec.js b/spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row_spec.js index 057312828ff..84f01f10f21 100644 --- a/spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row_spec.js +++ b/spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row_spec.js @@ -10,6 +10,7 @@ import { MISSING_MANIFEST_WARNING_TOOLTIP, NOT_AVAILABLE_TEXT, NOT_AVAILABLE_SIZE, + COPY_IMAGE_PATH_TITLE, } from '~/packages_and_registries/container_registry/explorer/constants/index'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import DetailsRow from '~/vue_shared/components/registry/details_row.vue'; @@ -150,7 +151,7 @@ describe('tags list row', () => { expect(findClipboardButton().attributes()).toMatchObject({ text: tag.location, - title: tag.location, + title: COPY_IMAGE_PATH_TITLE, }); }); diff --git a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js index 690d827ec67..979e1500d7d 100644 --- a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js +++ b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js @@ -13,6 +13,7 @@ import { IMAGE_MIGRATING_STATE, SCHEDULED_STATUS, ROOT_IMAGE_TEXT, + COPY_IMAGE_PATH_TITLE, } from '~/packages_and_registries/container_registry/explorer/constants'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ListItem from '~/vue_shared/components/registry/list_item.vue'; @@ -106,7 +107,7 @@ describe('Image List Row', () => { const button = findClipboardButton(); expect(button.exists()).toBe(true); expect(button.props('text')).toBe(item.location); - expect(button.props('title')).toBe(item.location); + expect(button.props('title')).toBe(COPY_IMAGE_PATH_TITLE); }); describe('cleanup status component', () => { diff --git a/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js b/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js index a61796dbed2..d503aff40b8 100644 --- a/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js +++ b/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js @@ -23,7 +23,6 @@ describe('Pipeline editor file nav', () => { const createComponent = ({ appStatus = EDITOR_APP_STATUS_VALID, isNewCiConfigFile = false, - pipelineEditorFileTree = false, } = {}) => { mockApollo.clients.defaultClient.cache.writeQuery({ query: getAppStatus, @@ -38,11 +37,6 @@ describe('Pipeline editor file nav', () => { wrapper = extendedWrapper( shallowMount(PipelineEditorFileNav, { apolloProvider: mockApollo, - provide: { - glFeatures: { - pipelineEditorFileTree, - }, - }, propsData: { isNewCiConfigFile, }, @@ -66,24 +60,12 @@ describe('Pipeline editor file nav', () => { it('renders the branch switcher', () => { expect(findBranchSwitcher().exists()).toBe(true); }); - - it('does not render the file tree button', () => { - expect(findFileTreeBtn().exists()).toBe(false); - }); - - it('does not render the file tree popover', () => { - expect(findPopoverContainer().exists()).toBe(false); - }); }); - describe('with pipelineEditorFileTree feature flag ON', () => { + describe('file tree', () => { describe('when editor is in the empty state', () => { beforeEach(() => { - createComponent({ - appStatus: EDITOR_APP_STATUS_EMPTY, - isNewCiConfigFile: false, - pipelineEditorFileTree: true, - }); + createComponent({ appStatus: EDITOR_APP_STATUS_EMPTY, isNewCiConfigFile: false }); }); it('does not render the file tree button', () => { @@ -97,11 +79,7 @@ describe('Pipeline editor file nav', () => { describe('when user is about to create their config file for the first time', () => { beforeEach(() => { - createComponent({ - appStatus: EDITOR_APP_STATUS_VALID, - isNewCiConfigFile: true, - pipelineEditorFileTree: true, - }); + createComponent({ appStatus: EDITOR_APP_STATUS_VALID, isNewCiConfigFile: true }); }); it('does not render the file tree button', () => { @@ -115,11 +93,7 @@ describe('Pipeline editor file nav', () => { describe('when app is in a global loading state', () => { it('renders the file tree button with a loading icon', () => { - createComponent({ - appStatus: EDITOR_APP_STATUS_LOADING, - isNewCiConfigFile: false, - pipelineEditorFileTree: true, - }); + createComponent({ appStatus: EDITOR_APP_STATUS_LOADING, isNewCiConfigFile: false }); expect(findFileTreeBtn().exists()).toBe(true); expect(findFileTreeBtn().attributes('loading')).toBe('true'); @@ -128,11 +102,7 @@ describe('Pipeline editor file nav', () => { describe('when editor has a non-empty config file open', () => { beforeEach(() => { - createComponent({ - appStatus: EDITOR_APP_STATUS_VALID, - isNewCiConfigFile: false, - pipelineEditorFileTree: true, - }); + createComponent({ appStatus: EDITOR_APP_STATUS_VALID, isNewCiConfigFile: false }); }); it('renders the file tree button', () => { diff --git a/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js index bf0f7fd8c9f..6307a5aefe7 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js +++ b/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js @@ -247,81 +247,63 @@ describe('Pipeline editor home wrapper', () => { await nextTick(); }; - describe('with pipelineEditorFileTree feature flag OFF', () => { + describe('button toggle', () => { beforeEach(() => { - createComponent(); + createComponent({ + stubs: { + GlButton, + PipelineEditorFileNav, + }, + }); }); - it('hides the file tree', () => { - expect(findFileTreeBtn().exists()).toBe(false); - expect(findPipelineEditorFileTree().exists()).toBe(false); + it('shows button toggle', () => { + expect(findFileTreeBtn().exists()).toBe(true); }); - }); - - describe('with pipelineEditorFileTree feature flag ON', () => { - describe('button toggle', () => { - beforeEach(() => { - createComponent({ - glFeatures: { - pipelineEditorFileTree: true, - }, - stubs: { - GlButton, - PipelineEditorFileNav, - }, - }); - }); - - it('shows button toggle', () => { - expect(findFileTreeBtn().exists()).toBe(true); - }); - it('toggles the drawer on button click', async () => { - await toggleFileTree(); + it('toggles the drawer on button click', async () => { + await toggleFileTree(); - expect(findPipelineEditorFileTree().exists()).toBe(true); + expect(findPipelineEditorFileTree().exists()).toBe(true); - await toggleFileTree(); + await toggleFileTree(); - expect(findPipelineEditorFileTree().exists()).toBe(false); - }); + expect(findPipelineEditorFileTree().exists()).toBe(false); + }); - it('sets the display state in local storage', async () => { - await toggleFileTree(); + it('sets the display state in local storage', async () => { + await toggleFileTree(); - expect(localStorage.getItem(FILE_TREE_DISPLAY_KEY)).toBe('true'); + expect(localStorage.getItem(FILE_TREE_DISPLAY_KEY)).toBe('true'); - await toggleFileTree(); + await toggleFileTree(); - expect(localStorage.getItem(FILE_TREE_DISPLAY_KEY)).toBe('false'); - }); + expect(localStorage.getItem(FILE_TREE_DISPLAY_KEY)).toBe('false'); }); + }); - describe('when file tree display state is saved in local storage', () => { - beforeEach(() => { - localStorage.setItem(FILE_TREE_DISPLAY_KEY, 'true'); - createComponent({ - glFeatures: { pipelineEditorFileTree: true }, - stubs: { PipelineEditorFileNav }, - }); + describe('when file tree display state is saved in local storage', () => { + beforeEach(() => { + localStorage.setItem(FILE_TREE_DISPLAY_KEY, 'true'); + createComponent({ + stubs: { PipelineEditorFileNav }, }); + }); - it('shows the file tree by default', () => { - expect(findPipelineEditorFileTree().exists()).toBe(true); - }); + it('shows the file tree by default', () => { + expect(findPipelineEditorFileTree().exists()).toBe(true); }); + }); - describe('when file tree display state is not saved in local storage', () => { - beforeEach(() => { - createComponent({ - glFeatures: { pipelineEditorFileTree: true }, - stubs: { PipelineEditorFileNav }, - }); + describe('when file tree display state is not saved in local storage', () => { + beforeEach(() => { + createComponent({ + stubs: { PipelineEditorFileNav }, }); + }); - it('hides the file tree by default', () => { - expect(findPipelineEditorFileTree().exists()).toBe(false); - }); + it('hides the file tree by default', () => { + expect(findPipelineEditorFileTree().exists()).toBe(false); }); }); }); |