diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 12:08:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 12:08:17 +0300 |
commit | 375c6d54dd85bfdf4be302c9cdac088a58b64c59 (patch) | |
tree | f803cce0a2234e68bc550c7768c603aa6cbe49d3 /spec/frontend/search/sidebar | |
parent | da92a12093920ecd79d9979a29d987157dd0ef78 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/search/sidebar')
-rw-r--r-- | spec/frontend/search/sidebar/components/scope_navigation_spec.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/spec/frontend/search/sidebar/components/scope_navigation_spec.js b/spec/frontend/search/sidebar/components/scope_navigation_spec.js index 6262a52e01a..d08fb9911ff 100644 --- a/spec/frontend/search/sidebar/components/scope_navigation_spec.js +++ b/spec/frontend/search/sidebar/components/scope_navigation_spec.js @@ -37,6 +37,7 @@ describe('ScopeNavigation', () => { const findGlNav = () => wrapper.findComponent(GlNav); const findGlNavItems = () => wrapper.findAllComponents(GlNavItem); const findGlNavItemActive = () => findGlNavItems().wrappers.filter((w) => w.attributes('active')); + const findGlNavItemActiveLabel = () => findGlNavItemActive().at(0).findAll('span').at(0).text(); const findGlNavItemActiveCount = () => findGlNavItemActive().at(0).findAll('span').at(1); describe('scope navigation', () => { @@ -64,17 +65,35 @@ describe('ScopeNavigation', () => { }); }); - describe('scope navigation sets proper state', () => { + describe('scope navigation sets proper state with url scope set', () => { beforeEach(() => { createComponent(); }); - it('sets proper class to active item', () => { + it('correct item is active', () => { expect(findGlNavItemActive()).toHaveLength(1); + expect(findGlNavItemActiveLabel()).toBe('Issues'); }); - it('active item', () => { + it('correct active item count', () => { expect(findGlNavItemActiveCount().text()).toBe('2.4K'); }); + + it('correct active item count is highlighted', () => { + expect(findGlNavItemActiveCount().classes('gl-text-gray-900')).toBe(true); + }); + }); + + describe('scope navigation sets proper state with NO url scope set', () => { + beforeEach(() => { + createComponent({ + urlQuery: {}, + }); + }); + + it('correct item is active', () => { + expect(findGlNavItems().at(0).attributes('active')).toBe('true'); + expect(findGlNavItemActiveLabel()).toBe('Projects'); + }); }); }); |