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>
import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui';
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 {
components: {
......@@ -10,7 +10,7 @@ export default {
},
data() {
return {
currentSortOption: SORT_OPTION_RELEASED,
currentSortOption: SORT_OPTION_CREATED,
isAscending: false,
searchTerm: '',
};
......@@ -48,10 +48,7 @@ export default {
this.currentSortOption = sortingItem;
},
},
sortOptions: [
{ value: SORT_OPTION_RELEASED, text: __('Released at') },
{ value: SORT_OPTION_CREATED, text: __('Created at') },
],
sortOptions: [{ value: SORT_OPTION_CREATED, text: __('Created at') }],
};
</script>
<template>
......
......@@ -8,7 +8,6 @@ export const SCOPE = {
};
export const SORT_OPTION_CREATED = 'CREATED';
export const SORT_OPTION_RELEASED = 'LATEST_RELEASED_AT';
export const SORT_ASC = 'ASC';
export const SORT_DESC = 'DESC';
export const DEFAULT_SORT_VALUE = `${SORT_OPTION_CREATED}_${SORT_DESC}`;
......
......@@ -40723,9 +40723,6 @@ msgstr ""
msgid "Released"
msgstr ""
 
msgid "Released at"
msgstr ""
msgid "Released date"
msgstr ""
 
import { GlSearchBoxByClick, GlSorting } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import CatalogSearch from '~/ci/catalog/components/list/catalog_search.vue';
import {
SORT_ASC,
SORT_DESC,
SORT_OPTION_CREATED,
SORT_OPTION_RELEASED,
} from '~/ci/catalog/constants';
import { SORT_ASC, SORT_DESC, SORT_OPTION_CREATED } from '~/ci/catalog/constants';
describe('CatalogSearch', () => {
let wrapper;
......@@ -30,12 +25,12 @@ describe('CatalogSearch', () => {
it('sets sorting options', () => {
const sortOptionsProp = findAllSortingItems();
expect(sortOptionsProp).toHaveLength(2);
expect(sortOptionsProp[0].text).toBe('Released at');
expect(sortOptionsProp).toHaveLength(1);
expect(sortOptionsProp[0].text).toBe('Created at');
});
it('renders the `Released at` option as the default', () => {
expect(findSorting().props('text')).toBe('Released at');
it('renders the `Created at` option as the default', () => {
expect(findSorting().props('text')).toBe('Created at');
});
});
......@@ -100,19 +95,10 @@ describe('CatalogSearch', () => {
await findSorting().vm.$emit('sortDirectionChange');
expect(wrapper.emitted('update-sorting')).toEqual([
[`${SORT_OPTION_RELEASED}_${SORT_ASC}`],
[`${SORT_OPTION_RELEASED}_${SORT_DESC}`],
[`${SORT_OPTION_CREATED}_${SORT_ASC}`],
[`${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.
先完成此消息的编辑!
想要评论请 注册