diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-10 21:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-10 21:09:05 +0300 |
commit | 20a86e7f6fd58882025b1c85b21e891d75220da5 (patch) | |
tree | 31d400a3790b2b3650415e5caf1cabfbe8d9092e /spec/frontend/super_sidebar | |
parent | 04ac4180cb5ba0df460034c7e64862056fd498b3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/super_sidebar')
-rw-r--r-- | spec/frontend/super_sidebar/components/menu_section_spec.js | 13 | ||||
-rw-r--r-- | spec/frontend/super_sidebar/components/sidebar_menu_spec.js | 9 |
2 files changed, 22 insertions, 0 deletions
diff --git a/spec/frontend/super_sidebar/components/menu_section_spec.js b/spec/frontend/super_sidebar/components/menu_section_spec.js index 556e07a2e31..203a65d6a0d 100644 --- a/spec/frontend/super_sidebar/components/menu_section_spec.js +++ b/spec/frontend/super_sidebar/components/menu_section_spec.js @@ -10,6 +10,8 @@ describe('MenuSection component', () => { const findButton = () => wrapper.find('button'); const findCollapse = () => wrapper.getComponent(GlCollapse); const findNavItems = () => wrapper.findAllComponents(NavItem); + const findSectionTitle = () => wrapper.findByTestId('section-title'); + const createWrapper = (item, otherProps) => { wrapper = shallowMountExtended(MenuSection, { propsData: { item, ...otherProps }, @@ -68,6 +70,17 @@ describe('MenuSection component', () => { }); }); + describe('`collectionStyle` prop', () => { + const newClasses = 'gl-font-sm gl-font-weight-semibold'.split(' '); + + it('applies new classes when using new styles', () => { + createWrapper({ title: 'Asdf' }, { collectionStyle: true }); + const classes = findSectionTitle().classes(); + + newClasses.forEach((newClass) => expect(classes).toContain(newClass)); + }); + }); + describe('`separated` prop', () => { describe('by default (false)', () => { it('does not render a separator', () => { diff --git a/spec/frontend/super_sidebar/components/sidebar_menu_spec.js b/spec/frontend/super_sidebar/components/sidebar_menu_spec.js index 26b146f0c8b..55483c46732 100644 --- a/spec/frontend/super_sidebar/components/sidebar_menu_spec.js +++ b/spec/frontend/super_sidebar/components/sidebar_menu_spec.js @@ -1,5 +1,6 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import SidebarMenu from '~/super_sidebar/components/sidebar_menu.vue'; +import MenuSection from '~/super_sidebar/components/menu_section.vue'; import { PANELS_WITH_PINS } from '~/super_sidebar/constants'; import { sidebarData } from '../mock_data'; @@ -101,6 +102,10 @@ describe('SidebarMenu component', () => { 'Also with subitems', ]); }); + + it('passes `supportsPin` to menu sections', () => { + expect(wrapper.findAllComponents(MenuSection).at(1).props('collectionStyle')).toBe(true); + }); }); describe('when the sidebar does not support pins', () => { @@ -115,6 +120,10 @@ describe('SidebarMenu component', () => { it('keeps all items as non-static', () => { expect(wrapper.vm.nonStaticItems).toEqual(menuItems); }); + + it('passes `supportsPin` to menu sections', () => { + expect(wrapper.findAllComponents(MenuSection).at(1).props('collectionStyle')).toBe(false); + }); }); }); |