File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,6 +200,30 @@ describe('<UnitInfoSidebar /> - rendering', () => {
200200 expect ( screen . getByText ( 'Content Summary' ) ) . toBeInTheDocument ( ) ;
201201 expect ( screen . queryByText ( 'Unit Content Summary' ) ) . not . toBeInTheDocument ( ) ;
202202 } ) ;
203+
204+ it ( 'shows Settings tab when isVertical is true' , ( ) => {
205+ unitSidebarContext . useUnitSidebarContext . mockReturnValue ( {
206+ currentTabKey : 'details' ,
207+ setCurrentTabKey : jest . fn ( ) ,
208+ isVertical : true ,
209+ } ) ;
210+
211+ renderComponent ( ) ;
212+
213+ expect ( screen . getByRole ( 'tab' , { name : 'Settings' } ) ) . toBeInTheDocument ( ) ;
214+ } ) ;
215+
216+ it ( 'hides Settings tab when isVertical is false' , ( ) => {
217+ unitSidebarContext . useUnitSidebarContext . mockReturnValue ( {
218+ currentTabKey : 'details' ,
219+ setCurrentTabKey : jest . fn ( ) ,
220+ isVertical : false ,
221+ } ) ;
222+
223+ renderComponent ( ) ;
224+
225+ expect ( screen . queryByRole ( 'tab' , { name : 'Settings' } ) ) . not . toBeInTheDocument ( ) ;
226+ } ) ;
203227} ) ;
204228
205229describe ( '<UnitInfoSidebar /> - menu behavior' , ( ) => {
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ export const UnitInfoSidebar = () => {
121121 const currentItemData = useSelector ( getCourseUnitData ) ;
122122 const {
123123 currentTabKey,
124+ isVertical,
124125 setCurrentTabKey,
125126 } = useUnitSidebarContext ( ) ;
126127 const { showToast } = useContext ( ToastContext ) ;
@@ -228,14 +229,16 @@ export const UnitInfoSidebar = () => {
228229 < UnitInfoDetails />
229230 </ div >
230231 </ Tab >
231- < Tab
232- eventKey = "settings"
233- title = { intl . formatMessage ( messages . sidebarInfoSettingsTab ) }
234- >
235- < div className = "mt-4" >
236- < UnitInfoSettings />
237- </ div >
238- </ Tab >
232+ { isVertical && (
233+ < Tab
234+ eventKey = "settings"
235+ title = { intl . formatMessage ( messages . sidebarInfoSettingsTab ) }
236+ >
237+ < div className = "mt-4" >
238+ < UnitInfoSettings />
239+ </ div >
240+ </ Tab >
241+ ) }
239242 </ Tabs >
240243 < DeleteModal
241244 isOpen = { isDeleteModalOpen }
You can’t perform that action at this time.
0 commit comments