Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/super_sidebar/components/super_sidebar_spec.js')
-rw-r--r--spec/frontend/super_sidebar/components/super_sidebar_spec.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/spec/frontend/super_sidebar/components/super_sidebar_spec.js b/spec/frontend/super_sidebar/components/super_sidebar_spec.js
index 1371f8f00a7..92736b99e14 100644
--- a/spec/frontend/super_sidebar/components/super_sidebar_spec.js
+++ b/spec/frontend/super_sidebar/components/super_sidebar_spec.js
@@ -45,6 +45,7 @@ const peekHintClass = 'super-sidebar-peek-hint';
describe('SuperSidebar component', () => {
let wrapper;
+ const findSkipToLink = () => wrapper.findByTestId('super-sidebar-skip-to');
const findSidebar = () => wrapper.findByTestId('super-sidebar');
const findUserBar = () => wrapper.findComponent(UserBar);
const findNavContainer = () => wrapper.findByTestId('nav-container');
@@ -89,6 +90,24 @@ describe('SuperSidebar component', () => {
});
describe('default', () => {
+ it('renders skip to main content link when logged in', () => {
+ createWrapper();
+ expect(findSkipToLink().attributes('href')).toBe('#content-body');
+ });
+
+ it('does not render skip to main content link when logged out', () => {
+ createWrapper({ sidebarData: { is_logged_in: false } });
+ expect(findSkipToLink().exists()).toBe(false);
+ });
+
+ it('has accessible role and name', () => {
+ createWrapper();
+ const nav = wrapper.findByRole('navigation');
+ const heading = wrapper.findByText('Primary navigation');
+ expect(nav.attributes('aria-labelledby')).toBe('super-sidebar-heading');
+ expect(heading.attributes('id')).toBe('super-sidebar-heading');
+ });
+
it('adds inert attribute when collapsed', () => {
createWrapper({ sidebarState: { isCollapsed: true } });
expect(findSidebar().attributes('inert')).toBe('inert');
@@ -295,11 +314,4 @@ describe('SuperSidebar component', () => {
expect(findTrialStatusPopover().exists()).toBe(true);
});
});
-
- describe('ARIA attributes', () => {
- it('adds aria-label attribute to nav element', () => {
- createWrapper();
- expect(wrapper.find('nav').attributes('aria-label')).toBe('Primary');
- });
- });
});