Commit 237d101e authored by David O'Regan's avatar David O'Regan

Merge branch 'fix-empty-user-list-dropdown-text' into 'master'

Show "No user list selected" in feature flags

See merge request gitlab-org/gitlab!46790
parents dc82912a ba0630df
......@@ -27,7 +27,7 @@ export default {
rolloutUserListLabel: s__('FeatureFlag|User List'),
rolloutUserListDescription: s__('FeatureFlag|Select a user list'),
rolloutUserListNoListError: s__('FeatureFlag|There are no configured user lists'),
defaultDropdownText: s__('FeatureFlags|Select a user list'),
defaultDropdownText: s__('FeatureFlags|No user list selected'),
},
computed: {
...mapGetters(['hasUserLists', 'isLoading', 'hasError', 'userListOptions']),
......@@ -36,7 +36,7 @@ export default {
return this.strategy?.userList?.id ?? '';
},
dropdownText() {
return this.strategy?.userList?.name ?? this.$options.defaultDropdownText;
return this.strategy?.userList?.name ?? this.$options.translations.defaultDropdownText;
},
},
mounted() {
......
---
title: Show "No user list selected" in feature flags
merge_request: 46790
author:
type: fixed
......@@ -11473,6 +11473,9 @@ msgstr ""
msgid "FeatureFlags|New user list"
msgstr ""
msgid "FeatureFlags|No user list selected"
msgstr ""
msgid "FeatureFlags|Percent of users"
msgstr ""
......@@ -11497,9 +11500,6 @@ msgstr ""
msgid "FeatureFlags|Rollout Strategy"
msgstr ""
msgid "FeatureFlags|Select a user list"
msgstr ""
msgid "FeatureFlags|Set the Unleash client application name to the name of the environment your application runs in. This value is used to match environment scopes. See the %{linkStart}example client configuration%{linkEnd}."
msgstr ""
......
......@@ -25,6 +25,8 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => {
propsData: { ...DEFAULT_PROPS, ...props },
});
const findDropdown = () => wrapper.find(GlDropdown);
describe('with user lists', () => {
const findDropdownItem = () => wrapper.find(GlDropdownItem);
......@@ -34,7 +36,7 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => {
});
it('should show the input for userListId with the correct value', () => {
const dropdownWrapper = wrapper.find(GlDropdown);
const dropdownWrapper = findDropdown();
expect(dropdownWrapper.exists()).toBe(true);
expect(dropdownWrapper.props('text')).toBe(userList.name);
});
......@@ -87,11 +89,15 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => {
describe('without user lists', () => {
beforeEach(() => {
Api.searchFeatureFlagUserLists.mockResolvedValue({ data: [] });
wrapper = factory();
wrapper = factory({ strategy: { ...userListStrategy, userList: null } });
});
it('should display a message that there are no user lists', () => {
expect(wrapper.text()).toContain('There are no configured user lists');
});
it('should dispaly a message that no list has been selected', () => {
expect(findDropdown().text()).toContain('No user list selected');
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment