@@ -21,11 +21,11 @@ let store;
21
21
let axiosMock ;
22
22
let container ;
23
23
24
- function renderComponent ( author , authorLabel , linkToProfile , labelColor ) {
24
+ function renderComponent ( author , authorLabel , linkToProfile , labelColor , enableInContextSidebar ) {
25
25
const wrapper = render (
26
26
< IntlProvider locale = "en" >
27
27
< AppProvider store = { store } >
28
- < DiscussionContext . Provider value = { { courseId } } >
28
+ < DiscussionContext . Provider value = { { courseId, enableInContextSidebar } } >
29
29
< AuthorLabel
30
30
author = { author }
31
31
authorLabel = { authorLabel }
@@ -78,9 +78,9 @@ describe('Author label', () => {
78
78
) ;
79
79
80
80
it (
81
- `it is "${ ! linkToProfile && 'not' } " clickable when linkToProfile is ${ ! ! linkToProfile } ` ,
81
+ `it is "${ ( ! linkToProfile ) && 'not' } " clickable when linkToProfile is ${ ! ! linkToProfile } and enableInContextSidebar is false ` ,
82
82
async ( ) => {
83
- renderComponent ( author , authorLabel , linkToProfile , labelColor ) ;
83
+ renderComponent ( author , authorLabel , linkToProfile , labelColor , false ) ;
84
84
85
85
if ( linkToProfile ) {
86
86
expect ( screen . queryByTestId ( 'learner-posts-link' ) ) . toBeInTheDocument ( ) ;
@@ -90,6 +90,15 @@ describe('Author label', () => {
90
90
} ,
91
91
) ;
92
92
93
+ it (
94
+ 'it is not clickable when enableInContextSidebar is true' ,
95
+ async ( ) => {
96
+ renderComponent ( author , authorLabel , linkToProfile , labelColor , true ) ;
97
+
98
+ expect ( screen . queryByTestId ( 'learner-posts-link' ) ) . not . toBeInTheDocument ( ) ;
99
+ } ,
100
+ ) ;
101
+
93
102
it (
94
103
`it has "${ ! linkToProfile && 'not' } " label text and label color when linkToProfile is ${ ! ! linkToProfile } ` ,
95
104
async ( ) => {
0 commit comments