Skip to content
代码片段 群组 项目
未验证 提交 981b0533 编辑于 作者: Stan Hu's avatar Stan Hu 提交者: GitLab
浏览文件

Merge branch 'revert-b3d0d3b3' into 'master'

Revert "Merge branch '439276-released-at-sort' into 'master'"

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/143450



Merged-by: default avatarStan Hu <stanhu@gmail.com>
Approved-by: default avatarEulyeon Ko <5961404-euko@users.noreply.gitlab.com>
Approved-by: default avatarJennifer Li <jli@gitlab.com>
No related branches found
No related tags found
无相关合并请求
<script> <script>
import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui'; import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { SORT_ASC, SORT_DESC, SORT_OPTION_CREATED, SORT_OPTION_RELEASED } from '../../constants'; import { SORT_ASC, SORT_DESC, SORT_OPTION_CREATED } from '../../constants';
export default { export default {
components: { components: {
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
}, },
data() { data() {
return { return {
currentSortOption: SORT_OPTION_RELEASED, currentSortOption: SORT_OPTION_CREATED,
isAscending: false, isAscending: false,
searchTerm: '', searchTerm: '',
}; };
...@@ -48,10 +48,7 @@ export default { ...@@ -48,10 +48,7 @@ export default {
this.currentSortOption = sortingItem; this.currentSortOption = sortingItem;
}, },
}, },
sortOptions: [ sortOptions: [{ value: SORT_OPTION_CREATED, text: __('Created at') }],
{ value: SORT_OPTION_RELEASED, text: __('Released at') },
{ value: SORT_OPTION_CREATED, text: __('Created at') },
],
}; };
</script> </script>
<template> <template>
......
...@@ -8,7 +8,6 @@ export const SCOPE = { ...@@ -8,7 +8,6 @@ export const SCOPE = {
}; };
export const SORT_OPTION_CREATED = 'CREATED'; export const SORT_OPTION_CREATED = 'CREATED';
export const SORT_OPTION_RELEASED = 'LATEST_RELEASED_AT';
export const SORT_ASC = 'ASC'; export const SORT_ASC = 'ASC';
export const SORT_DESC = 'DESC'; export const SORT_DESC = 'DESC';
export const DEFAULT_SORT_VALUE = `${SORT_OPTION_CREATED}_${SORT_DESC}`; export const DEFAULT_SORT_VALUE = `${SORT_OPTION_CREATED}_${SORT_DESC}`;
......
...@@ -40723,9 +40723,6 @@ msgstr "" ...@@ -40723,9 +40723,6 @@ msgstr ""
msgid "Released" msgid "Released"
msgstr "" msgstr ""
   
msgid "Released at"
msgstr ""
msgid "Released date" msgid "Released date"
msgstr "" msgstr ""
   
import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui'; import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import CatalogSearch from '~/ci/catalog/components/list/catalog_search.vue'; import CatalogSearch from '~/ci/catalog/components/list/catalog_search.vue';
import { import { SORT_ASC, SORT_DESC, SORT_OPTION_CREATED } from '~/ci/catalog/constants';
SORT_ASC,
SORT_DESC,
SORT_OPTION_CREATED,
SORT_OPTION_RELEASED,
} from '~/ci/catalog/constants';
describe('CatalogSearch', () => { describe('CatalogSearch', () => {
let wrapper; let wrapper;
...@@ -30,12 +25,12 @@ describe('CatalogSearch', () => { ...@@ -30,12 +25,12 @@ describe('CatalogSearch', () => {
it('sets sorting options', () => { it('sets sorting options', () => {
const sortOptionsProp = findAllSortingItems(); const sortOptionsProp = findAllSortingItems();
expect(sortOptionsProp).toHaveLength(2); expect(sortOptionsProp).toHaveLength(1);
expect(sortOptionsProp[0].text).toBe('Released at'); expect(sortOptionsProp[0].text).toBe('Created at');
}); });
it('renders the `Released at` option as the default', () => { it('renders the `Created at` option as the default', () => {
expect(findSorting().props('text')).toBe('Released at'); expect(findSorting().props('text')).toBe('Created at');
}); });
}); });
...@@ -100,19 +95,10 @@ describe('CatalogSearch', () => { ...@@ -100,19 +95,10 @@ describe('CatalogSearch', () => {
await findSorting().vm.$emit('sortDirectionChange'); await findSorting().vm.$emit('sortDirectionChange');
expect(wrapper.emitted('update-sorting')).toEqual([ expect(wrapper.emitted('update-sorting')).toEqual([
[`${SORT_OPTION_RELEASED}_${SORT_ASC}`], [`${SORT_OPTION_CREATED}_${SORT_ASC}`],
[`${SORT_OPTION_RELEASED}_${SORT_DESC}`], [`${SORT_OPTION_CREATED}_${SORT_DESC}`],
]); ]);
}); });
}); });
describe('when changing sort option', () => {
it('changes the sort option to `Created at`', async () => {
await findSorting().vm.$emit('sortByChange', SORT_OPTION_CREATED);
expect(findSorting().props().sortBy).toBe(SORT_OPTION_CREATED);
expect(findSorting().props().text).toBe('Created at');
});
});
}); });
}); });
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册