diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-21 21:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-21 21:09:26 +0300 |
commit | 07d811cd3cf4d3a1802363532756bf69cfc6346f (patch) | |
tree | 4c0488ee52df65d58ba5c97a4e83bf1971469e34 /spec/frontend/super_sidebar | |
parent | 71c6e099a8b019ab7749e43b63885d52de60e316 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/super_sidebar')
3 files changed, 53 insertions, 59 deletions
diff --git a/spec/frontend/super_sidebar/components/frequent_items_list_spec.js b/spec/frontend/super_sidebar/components/frequent_items_list_spec.js index 86cec3f3d13..5329a8f5da3 100644 --- a/spec/frontend/super_sidebar/components/frequent_items_list_spec.js +++ b/spec/frontend/super_sidebar/components/frequent_items_list_spec.js @@ -1,4 +1,3 @@ -import { GlIcon, GlButton } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { s__ } from '~/locale'; import FrequentItemsList from '~/super_sidebar/components//frequent_items_list.vue'; @@ -17,7 +16,6 @@ describe('FrequentItemsList component', () => { let wrapper; const findListTitle = () => wrapper.findByTestId('list-title'); - const findListEditButton = () => findListTitle().findComponent(GlButton); const findItemsList = () => wrapper.findComponent(ItemsList); const findEmptyText = () => wrapper.findByTestId('empty-text'); @@ -68,30 +66,8 @@ describe('FrequentItemsList component', () => { }); describe('items editing', () => { - it('renders edit button within header', () => { - const itemsEditButton = findListEditButton(); - - expect(itemsEditButton.exists()).toBe(true); - expect(itemsEditButton.attributes('title')).toBe('Toggle edit mode'); - expect(itemsEditButton.findComponent(GlIcon).props('name')).toBe('pencil'); - }); - - it('clicking edit button makes items list editable', async () => { - // Off by default - expect(findItemsList().props('editable')).toBe(false); - - // On when clicked - await findListEditButton().vm.$emit('click'); - expect(findItemsList().props('editable')).toBe(true); - - // Off when clicked again - await findListEditButton().vm.$emit('click'); - expect(findItemsList().props('editable')).toBe(false); - }); - it('remove-item event emission from items-list causes list item to be removed', async () => { const localStorageProjects = findItemsList().props('items'); - await findListEditButton().vm.$emit('click'); await findItemsList().vm.$emit('remove-item', localStorageProjects[0]); diff --git a/spec/frontend/super_sidebar/components/help_center_spec.js b/spec/frontend/super_sidebar/components/help_center_spec.js index 4c0e7a89a43..aa94ca301db 100644 --- a/spec/frontend/super_sidebar/components/help_center_spec.js +++ b/spec/frontend/super_sidebar/components/help_center_spec.js @@ -42,45 +42,47 @@ describe('HelpCenter component', () => { }; }; + const DEFAULT_HELP_ITEMS = [ + { text: HelpCenter.i18n.help, href: helpPagePath(), extraAttrs: trackingAttrs('help') }, + { + text: HelpCenter.i18n.support, + href: sidebarData.support_path, + extraAttrs: trackingAttrs('support'), + }, + { + text: HelpCenter.i18n.docs, + href: 'https://docs.gitlab.com', + extraAttrs: trackingAttrs('gitlab_documentation'), + }, + { + text: HelpCenter.i18n.plans, + href: `${PROMO_URL}/pricing`, + extraAttrs: trackingAttrs('compare_gitlab_plans'), + }, + { + text: HelpCenter.i18n.forum, + href: 'https://forum.gitlab.com/', + extraAttrs: trackingAttrs('community_forum'), + }, + { + text: HelpCenter.i18n.contribute, + href: helpPagePath('', { anchor: 'contributing-to-gitlab' }), + extraAttrs: trackingAttrs('contribute_to_gitlab'), + }, + { + text: HelpCenter.i18n.feedback, + href: 'https://about.gitlab.com/submit-feedback', + extraAttrs: trackingAttrs('submit_feedback'), + }, + ]; + describe('default', () => { beforeEach(() => { createWrapper(sidebarData); }); it('renders menu items', () => { - expect(findDropdownGroup(0).props('group').items).toEqual([ - { text: HelpCenter.i18n.help, href: helpPagePath(), extraAttrs: trackingAttrs('help') }, - { - text: HelpCenter.i18n.support, - href: sidebarData.support_path, - extraAttrs: trackingAttrs('support'), - }, - { - text: HelpCenter.i18n.docs, - href: 'https://docs.gitlab.com', - extraAttrs: trackingAttrs('gitlab_documentation'), - }, - { - text: HelpCenter.i18n.plans, - href: `${PROMO_URL}/pricing`, - extraAttrs: trackingAttrs('compare_gitlab_plans'), - }, - { - text: HelpCenter.i18n.forum, - href: 'https://forum.gitlab.com/', - extraAttrs: trackingAttrs('community_forum'), - }, - { - text: HelpCenter.i18n.contribute, - href: helpPagePath('', { anchor: 'contributing-to-gitlab' }), - extraAttrs: trackingAttrs('contribute_to_gitlab'), - }, - { - text: HelpCenter.i18n.feedback, - href: 'https://about.gitlab.com/submit-feedback', - extraAttrs: trackingAttrs('submit_feedback'), - }, - ]); + expect(findDropdownGroup(0).props('group').items).toEqual(DEFAULT_HELP_ITEMS); expect(findDropdownGroup(1).props('group').items).toEqual([ expect.objectContaining({ text: HelpCenter.i18n.shortcuts }), @@ -94,6 +96,23 @@ describe('HelpCenter component', () => { }); }); + describe('with show_tanuki_bot true', () => { + beforeEach(() => { + createWrapper({ ...sidebarData, show_tanuki_bot: true }); + }); + + it('shows Ask the Tanuki Bot with the help items', () => { + expect(findDropdownGroup(0).props('group').items).toEqual([ + expect.objectContaining({ + icon: 'tanuki', + text: HelpCenter.i18n.tanuki, + extraAttrs: trackingAttrs('tanuki_bot_help_dropdown'), + }), + ...DEFAULT_HELP_ITEMS, + ]); + }); + }); + describe('with Gitlab version check feature enabled', () => { beforeEach(() => { createWrapper({ ...sidebarData, show_version_check: true }); diff --git a/spec/frontend/super_sidebar/components/items_list_spec.js b/spec/frontend/super_sidebar/components/items_list_spec.js index d49ef35e9d8..d5e8043cce9 100644 --- a/spec/frontend/super_sidebar/components/items_list_spec.js +++ b/spec/frontend/super_sidebar/components/items_list_spec.js @@ -73,7 +73,6 @@ describe('ItemsList component', () => { createWrapper({ props: { items: [mockProject], - editable: true, }, mountFn: mountExtended, }); @@ -84,7 +83,7 @@ describe('ItemsList component', () => { expect(itemRemoveButton.exists()).toBe(true); expect(itemRemoveButton.attributes('title')).toBe('Remove'); - expect(itemRemoveButton.findComponent(GlIcon).props('name')).toBe('close'); + expect(itemRemoveButton.findComponent(GlIcon).props('name')).toBe('dash'); }); it('emits `remove-item` event with item param when remove button is clicked', () => { |