File tree Expand file tree Collapse file tree 5 files changed +20
-21
lines changed Expand file tree Collapse file tree 5 files changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -117,10 +117,10 @@ describe('Course', () => {
117
117
render ( < Course { ...mockData } /> ) ;
118
118
expect ( sessionStorage . getItem ( `notificationTrayStatus.${ mockData . courseId } ` ) ) . toBe ( '"open"' ) ;
119
119
const notificationShowButton = await screen . findByRole ( 'button' , { name : / S h o w n o t i f i c a t i o n t r a y / i } ) ;
120
- expect ( screen . queryByRole ( 'region' , { name : / n o t i f i c a t i o n t r a y / i } ) ) . toBeInTheDocument ( ) ;
120
+ expect ( screen . queryByRole ( 'region' , { name : / n o t i f i c a t i o n t r a y / i } ) ) . not . toHaveClass ( 'd-none' ) ;
121
121
fireEvent . click ( notificationShowButton ) ;
122
122
expect ( sessionStorage . getItem ( `notificationTrayStatus.${ mockData . courseId } ` ) ) . toBe ( '"closed"' ) ;
123
- expect ( screen . queryByRole ( 'region' , { name : / n o t i f i c a t i o n t r a y / i } ) ) . not . toBeInTheDocument ( ) ;
123
+ expect ( screen . queryByRole ( 'region' , { name : / n o t i f i c a t i o n t r a y / i } ) ) . toHaveClass ( 'd-none' ) ;
124
124
} ) ;
125
125
126
126
it ( 'handles reload persisting notification tray status' , async ( ) => {
Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ describe('Sequence', () => {
74
74
) ;
75
75
76
76
await waitFor ( ( ) => expect ( screen . queryByText ( 'Loading locked content messaging...' ) ) . toBeInTheDocument ( ) ) ;
77
- // `Previous`, `Active`, `Next` and `Prerequisite ` buttons.
78
- expect ( screen . getAllByRole ( 'button' ) . length ) . toEqual ( 4 ) ;
77
+ // `Previous`, `Active`, `Next`, `Prerequisite` and `Close Tray ` buttons.
78
+ expect ( screen . getAllByRole ( 'button' ) . length ) . toEqual ( 5 ) ;
79
79
80
80
expect ( screen . getByText ( 'Content Locked' ) ) . toBeInTheDocument ( ) ;
81
81
const unitContainer = container . querySelector ( '.unit-container' ) ;
@@ -126,7 +126,7 @@ describe('Sequence', () => {
126
126
render ( < Sequence { ...mockData } /> ) ;
127
127
expect ( await screen . findByText ( 'Loading learning sequence...' ) ) . toBeInTheDocument ( ) ;
128
128
// Renders navigation buttons plus one button for each unit.
129
- expect ( screen . getAllByRole ( 'button' ) ) . toHaveLength ( 3 + unitBlocks . length ) ;
129
+ expect ( screen . getAllByRole ( 'button' ) ) . toHaveLength ( 4 + unitBlocks . length ) ;
130
130
131
131
loadUnit ( ) ;
132
132
await waitFor ( ( ) => expect ( screen . queryByText ( 'Loading learning sequence...' ) ) . not . toBeInTheDocument ( ) ) ;
Original file line number Diff line number Diff line change 1
- import React , { useContext } from 'react' ;
2
- import SidebarContext from './SidebarContext' ;
3
- import { SIDEBARS } from './sidebars' ;
1
+ import React from 'react' ;
2
+ import { SIDEBAR_ORDER , SIDEBARS } from './sidebars' ;
4
3
5
- const Sidebar = ( ) => {
6
- const {
7
- currentSidebar,
8
- } = useContext ( SidebarContext ) ;
9
- if ( ! currentSidebar ) {
10
- return null ;
11
- }
12
- const CurrentSidebar = SIDEBARS [ currentSidebar ] . Sidebar ;
13
- return (
14
- < CurrentSidebar />
15
- ) ;
16
- } ;
4
+ const Sidebar = ( ) => (
5
+ < >
6
+ {
7
+ SIDEBAR_ORDER . map ( ( sideBarId ) => {
8
+ const SidebarToRender = SIDEBARS [ sideBarId ] . Sidebar ;
9
+ return < SidebarToRender /> ;
10
+ } )
11
+ }
12
+ </ >
13
+ ) ;
17
14
18
15
export default Sidebar ;
Original file line number Diff line number Diff line change @@ -34,11 +34,12 @@ const SidebarBase = ({
34
34
35
35
useEventListener ( 'message' , receiveMessage ) ;
36
36
37
- return currentSidebar === sidebarId && (
37
+ return (
38
38
< section
39
39
className = { classNames ( 'ml-0 ml-lg-4 border border-light-400 rounded-sm h-auto align-top' , {
40
40
'bg-white m-0 border-0 fixed-top vh-100 rounded-0' : shouldDisplayFullScreen ,
41
41
'min-vh-100' : ! shouldDisplayFullScreen ,
42
+ 'd-none' : currentSidebar !== sidebarId ,
42
43
} , className ) }
43
44
style = { { width : shouldDisplayFullScreen ? '100%' : width } }
44
45
aria-label = { ariaLabel }
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ const DiscussionsSidebar = ({ intl }) => {
35
35
className = "d-flex w-100 h-100 border-0"
36
36
title = { intl . formatMessage ( messages . discussionsTitle ) }
37
37
allow = "clipboard-write"
38
+ loading = "lazy"
38
39
/>
39
40
</ SidebarBase >
40
41
) ;
You can’t perform that action at this time.
0 commit comments