Skip to content
代码片段 群组 项目
提交 4551e82b 编辑于 作者: Florie Guibert's avatar Florie Guibert
浏览文件

Display default text for empty sidebar dropdown

上级 1d6ad8dc
No related branches found
No related tags found
无相关合并请求
......@@ -3,7 +3,7 @@ import { GlButton, GlForm, GlLoadingIcon, GlCollapsibleListbox } from '@gitlab/u
import { isEmpty, debounce } from 'lodash';
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
import { s__, __ } from '~/locale';
import { s__, __, sprintf } from '~/locale';
export default {
i18n: {
......@@ -116,6 +116,11 @@ export default {
resetButton() {
return this.resetButtonLabel || this.$options.i18n.resetButtonText;
},
toggleText() {
return !this.toggleDropdownText && !this.hasValue
? sprintf(__(`No %{label}`), { label: this.dropdownLabel.toLowerCase() })
: this.toggleDropdownText;
},
},
watch: {
itemValue: {
......@@ -212,7 +217,7 @@ export default {
:infinite-scroll="infiniteScroll"
:searching="loading"
:header-text="headerText"
:toggle-text="toggleDropdownText"
:toggle-text="toggleText"
:no-results-text="$options.i18n.noMatchingResults"
:items="listItems"
:selected="localSelectedItem"
......
......@@ -33827,6 +33827,9 @@ msgstr ""
msgid "No %{header} for this request."
msgstr ""
 
msgid "No %{label}"
msgstr ""
msgid "No %{providerTitle} repositories found"
msgstr ""
 
......@@ -220,5 +220,13 @@ describe('WorkItemSidebarDropdownWidgetWithEdit component', () => {
expect(findCollapsibleListbox().props('infiniteScrollLoading')).toBe(true);
});
it('displays default dropdown label when no value is selected', async () => {
createComponent({ isEditing: true });
await nextTick();
expect(findCollapsibleListbox().props('toggleText')).toBe('No iteration');
});
});
});
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册