Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
17307cac
Commit
17307cac
authored
Jun 10, 2021
by
picklesrus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests
parent
fcbcef24
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
src/views/studio/studio-comments.jsx
src/views/studio/studio-comments.jsx
+1
-1
test/unit/components/studio-comments.test.jsx
test/unit/components/studio-comments.test.jsx
+41
-0
No files found.
src/views/studio/studio-comments.jsx
View file @
17307cac
...
...
@@ -75,7 +75,7 @@ const StudioComments = ({
<
h2
><
FormattedMessage
id=
"studio.commentsHeader"
/></
h2
>
{
canEditCommentsAllowed
&&
<
StudioCommentsAllowed
/>
}
</
div
>
{
studioCommentsGloballyEnabled
?
{
!
hasFetchedSession
||
studioCommentsGloballyEnabled
?
<
div
>
{
shouldShowCommentComposer
?
(
commentsAllowed
?
...
...
test/unit/components/studio-comments.test.jsx
View file @
17307cac
...
...
@@ -69,4 +69,45 @@ describe('Studio comments', () => {
);
expect
(
resetComments
).
not
.
toHaveBeenCalled
();
});
test
(
'
Comments do not show when they are off globally
'
,
()
=>
{
const
component
=
mountWithIntl
(
<
StudioComments
hasFetchedSession
isAdmin=
{
false
}
comments=
{
[{
id
:
123
,
author
:
{}}]
}
studioCommentsGloballyEnabled=
{
false
}
/>
);
expect
(
component
.
find
(
'
div.studio-compose-container
'
).
exists
()).
toBe
(
true
);
expect
(
component
.
find
(
'
CommentingStatus
'
).
exists
()).
toBe
(
true
);
expect
(
component
.
find
(
'
TopLevelComment
'
).
exists
()).
toBe
(
false
);
});
test
(
'
Comments do show when they are on globally
'
,
()
=>
{
const
component
=
mountWithIntl
(
<
StudioComments
hasFetchedSession
isAdmin=
{
false
}
comments=
{
[{
id
:
123
,
author
:
{}}]
}
studioCommentsGloballyEnabled
/>
);
expect
(
component
.
find
(
'
div.studio-compose-container
'
).
exists
()).
toBe
(
true
);
expect
(
component
.
find
(
'
CommentingStatus
'
).
exists
()).
toBe
(
false
);
expect
(
component
.
find
(
'
TopLevelComment
'
).
exists
()).
toBe
(
true
);
});
test
(
'
Comments off status does not show if we have not fetched the session
'
,
()
=>
{
const
component
=
mountWithIntl
(
<
StudioComments
hasFetchedSession=
{
false
}
isAdmin=
{
false
}
comments=
{
[{
id
:
123
,
author
:
{}}]
}
studioCommentsGloballyEnabled=
{
false
}
/>
);
expect
(
component
.
find
(
'
div.studio-compose-container
'
).
exists
()).
toBe
(
true
);
expect
(
component
.
find
(
'
CommentingStatus
'
).
exists
()).
toBe
(
false
);
expect
(
component
.
find
(
'
TopLevelComment
'
).
exists
()).
toBe
(
true
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment