Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f43f24e1
Commit
f43f24e1
authored
Aug 16, 2021
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove vestigial close/reopen logic from comment_type_toggle.js
parent
a6d3e124
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
126 deletions
+7
-126
app/assets/javascripts/comment_type_toggle.js
app/assets/javascripts/comment_type_toggle.js
+7
-30
app/assets/javascripts/deprecated_notes.js
app/assets/javascripts/deprecated_notes.js
+0
-4
spec/frontend/comment_type_toggle_spec.js
spec/frontend/comment_type_toggle_spec.js
+0
-92
No files found.
app/assets/javascripts/comment_type_toggle.js
View file @
f43f24e1
...
...
@@ -10,8 +10,6 @@ class CommentTypeToggle {
this
.
dropdownList
=
opts
.
dropdownList
;
this
.
noteTypeInput
=
opts
.
noteTypeInput
;
this
.
submitButton
=
opts
.
submitButton
;
this
.
closeButton
=
opts
.
closeButton
;
this
.
reopenButton
=
opts
.
reopenButton
;
}
initDroplab
()
{
...
...
@@ -26,44 +24,23 @@ class CommentTypeToggle {
const
config
=
{
InputSetter
:
[
{
// when option is clicked, sets the `value` attribute on
// `#note_type` to whatever the `data-value` attribute was
// on the clicked option
input
:
this
.
noteTypeInput
,
valueAttribute
:
'
data-value
'
,
},
{
// when option is clicked, sets the `value` attribute on
// `.js-comment-type-dropdown .js-comment-submit-button` to
// whatever the `data-value` attribute was on the clicked
// option
input
:
this
.
submitButton
,
valueAttribute
:
'
data-submit-text
'
,
},
],
};
if
(
this
.
closeButton
)
{
config
.
InputSetter
.
push
(
{
input
:
this
.
closeButton
,
valueAttribute
:
'
data-close-text
'
,
},
{
input
:
this
.
closeButton
,
valueAttribute
:
'
data-close-text
'
,
inputAttribute
:
'
data-alternative-text
'
,
},
);
}
if
(
this
.
reopenButton
)
{
config
.
InputSetter
.
push
(
{
input
:
this
.
reopenButton
,
valueAttribute
:
'
data-reopen-text
'
,
},
{
input
:
this
.
reopenButton
,
valueAttribute
:
'
data-reopen-text
'
,
inputAttribute
:
'
data-alternative-text
'
,
},
);
}
return
config
;
}
}
...
...
app/assets/javascripts/deprecated_notes.js
View file @
f43f24e1
...
...
@@ -205,16 +205,12 @@ export default class Notes {
const
dropdownList
=
form
.
querySelector
(
'
.js-comment-type-dropdown .dropdown-menu
'
);
const
noteTypeInput
=
form
.
querySelector
(
'
#note_type
'
);
const
submitButton
=
form
.
querySelector
(
'
.js-comment-type-dropdown .js-comment-submit-button
'
);
const
closeButton
=
form
.
querySelector
(
'
.js-note-target-close
'
);
const
reopenButton
=
form
.
querySelector
(
'
.js-note-target-reopen
'
);
const
commentTypeToggle
=
new
CommentTypeToggle
({
dropdownTrigger
,
dropdownList
,
noteTypeInput
,
submitButton
,
closeButton
,
reopenButton
,
});
commentTypeToggle
.
initDroplab
();
...
...
spec/frontend/comment_type_toggle_spec.js
View file @
f43f24e1
...
...
@@ -11,14 +11,12 @@ describe('CommentTypeToggle', () => {
testContext
.
dropdownList
=
{};
testContext
.
noteTypeInput
=
{};
testContext
.
submitButton
=
{};
testContext
.
closeButton
=
{};
testContext
.
commentTypeToggle
=
new
CommentTypeToggle
({
dropdownTrigger
:
testContext
.
dropdownTrigger
,
dropdownList
:
testContext
.
dropdownList
,
noteTypeInput
:
testContext
.
noteTypeInput
,
submitButton
:
testContext
.
submitButton
,
closeButton
:
testContext
.
closeButton
,
});
});
...
...
@@ -37,14 +35,6 @@ describe('CommentTypeToggle', () => {
it
(
'
should set .submitButton
'
,
()
=>
{
expect
(
testContext
.
commentTypeToggle
.
submitButton
).
toBe
(
testContext
.
submitButton
);
});
it
(
'
should set .closeButton
'
,
()
=>
{
expect
(
testContext
.
commentTypeToggle
.
closeButton
).
toBe
(
testContext
.
closeButton
);
});
it
(
'
should set .reopenButton
'
,
()
=>
{
expect
(
testContext
.
commentTypeToggle
.
reopenButton
).
toBe
(
testContext
.
reopenButton
);
});
});
describe
(
'
initDroplab
'
,
()
=>
{
...
...
@@ -84,86 +74,4 @@ describe('CommentTypeToggle', () => {
);
});
});
describe
(
'
setConfig
'
,
()
=>
{
describe
(
'
if no .closeButton is provided
'
,
()
=>
{
beforeEach
(()
=>
{
testContext
.
commentTypeToggle
=
{
dropdownTrigger
:
{},
dropdownList
:
{},
noteTypeInput
:
{},
submitButton
:
{},
reopenButton
:
{},
};
testContext
.
setConfig
=
CommentTypeToggle
.
prototype
.
setConfig
.
call
(
testContext
.
commentTypeToggle
,
);
});
it
(
'
should not add .closeButton related InputSetter config
'
,
()
=>
{
expect
(
testContext
.
setConfig
).
toEqual
({
InputSetter
:
[
{
input
:
testContext
.
commentTypeToggle
.
noteTypeInput
,
valueAttribute
:
'
data-value
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
submitButton
,
valueAttribute
:
'
data-submit-text
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
reopenButton
,
valueAttribute
:
'
data-reopen-text
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
reopenButton
,
valueAttribute
:
'
data-reopen-text
'
,
inputAttribute
:
'
data-alternative-text
'
,
},
],
});
});
});
describe
(
'
if no .reopenButton is provided
'
,
()
=>
{
beforeEach
(()
=>
{
testContext
.
commentTypeToggle
=
{
dropdownTrigger
:
{},
dropdownList
:
{},
noteTypeInput
:
{},
submitButton
:
{},
closeButton
:
{},
};
testContext
.
setConfig
=
CommentTypeToggle
.
prototype
.
setConfig
.
call
(
testContext
.
commentTypeToggle
,
);
});
it
(
'
should not add .reopenButton related InputSetter config
'
,
()
=>
{
expect
(
testContext
.
setConfig
).
toEqual
({
InputSetter
:
[
{
input
:
testContext
.
commentTypeToggle
.
noteTypeInput
,
valueAttribute
:
'
data-value
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
submitButton
,
valueAttribute
:
'
data-submit-text
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
closeButton
,
valueAttribute
:
'
data-close-text
'
,
},
{
input
:
testContext
.
commentTypeToggle
.
closeButton
,
valueAttribute
:
'
data-close-text
'
,
inputAttribute
:
'
data-alternative-text
'
,
},
],
});
});
});
});
});
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