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
f6f1095d
Commit
f6f1095d
authored
Mar 23, 2021
by
seotts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add justMuted variable, fix linting
parent
60bf05fb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
src/views/preview/comment/compose-comment.jsx
src/views/preview/comment/compose-comment.jsx
+5
-1
test/unit/components/compose-comment.test.jsx
test/unit/components/compose-comment.test.jsx
+18
-11
No files found.
src/views/preview/comment/compose-comment.jsx
View file @
f6f1095d
...
...
@@ -292,7 +292,11 @@ class ComposeComment extends React.Component {
<
CommentingStatus
>
<
p
>
<
FormattedMessage
id=
{
this
.
getMuteMessageInfo
(
this
.
state
.
status
===
ComposeStatus
.
REJECTED_MUTE
).
commentType
}
id=
{
this
.
getMuteMessageInfo
(
this
.
state
.
status
===
ComposeStatus
.
REJECTED_MUTE
).
commentType
}
/>
</
p
>
<
p
>
...
...
test/unit/components/compose-comment.test.jsx
View file @
f6f1095d
...
...
@@ -556,45 +556,52 @@ describe('Compose Comment test', () => {
});
test
(
'
getMuteMessageInfo: muteType set and just got muted
'
,
()
=>
{
const
justMuted
=
true
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
commentInstance
.
setState
({
muteType
:
'
unconstructive
'
});
expect
(
commentInstance
.
getMuteMessageInfo
(
true
).
commentType
).
toBe
(
'
comment.type.unconstructive
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
true
).
muteStepContent
[
0
]).
toBe
(
'
comment.unconstructive.content1
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.unconstructive
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
)
.
muteStepContent
[
0
]).
toBe
(
'
comment.unconstructive.content1
'
);
});
test
(
'
getMuteMessageInfo: muteType set and already muted
'
,
()
=>
{
const
justMuted
=
false
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
commentInstance
.
setState
({
muteType
:
'
pii
'
});
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
commentType
).
toBe
(
'
comment.type.pii.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.pii.past
'
);
// PII has the same content1 regardless of whether you were just muted
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
muteStepContent
[
0
]).
toBe
(
'
comment.pii.content1
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
muteStepContent
[
0
]).
toBe
(
'
comment.pii.content1
'
);
commentInstance
.
setState
({
muteType
:
'
vulgarity
'
});
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
commentType
).
toBe
(
'
comment.type.vulgarity.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
muteStepContent
[
0
]).
toBe
(
'
comment.type.vulgarity.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.vulgarity.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
muteStepContent
[
0
]).
toBe
(
'
comment.type.vulgarity.past
'
);
});
test
(
'
getMuteMessageInfo: muteType not set and just got muted
'
,
()
=>
{
const
justMuted
=
true
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
expect
(
commentInstance
.
getMuteMessageInfo
(
true
).
commentType
).
toBe
(
'
comment.type.general
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.general
'
);
// general has the same content1 regardless of whether you were just muted
expect
(
commentInstance
.
getMuteMessageInfo
(
true
).
muteStepContent
[
0
]).
toBe
(
'
comment.general.content1
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
muteStepContent
[
0
]).
toBe
(
'
comment.general.content1
'
);
});
test
(
'
getMuteMessageInfo: muteType not set and already muted
'
,
()
=>
{
const
justMuted
=
false
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
commentType
).
toBe
(
'
comment.type.general.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.general.past
'
);
});
test
(
'
getMuteMessageInfo: muteType set to something we don
\'
t have messages for and just got muted
'
,
()
=>
{
const
justMuted
=
true
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
commentInstance
.
setState
({
muteType
:
'
spaghetti
'
});
expect
(
commentInstance
.
getMuteMessageInfo
(
true
).
commentType
).
toBe
(
'
comment.type.general
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.general
'
);
});
test
(
'
getMuteMessageInfo: muteType set to something we don
\'
t have messages for and already muted
'
,
()
=>
{
const
justMuted
=
false
;
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
commentInstance
.
setState
({
muteType
:
'
spaghetti
'
});
expect
(
commentInstance
.
getMuteMessageInfo
(
false
).
commentType
).
toBe
(
'
comment.type.general.past
'
);
expect
(
commentInstance
.
getMuteMessageInfo
(
justMuted
).
commentType
).
toBe
(
'
comment.type.general.past
'
);
});
});
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