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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
99e4431c
Commit
99e4431c
authored
Apr 06, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit tests
parent
9cee280d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
36 deletions
+81
-36
app/assets/javascripts/comment_type_toggle.js
app/assets/javascripts/comment_type_toggle.js
+3
-3
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+2
-2
spec/features/merge_requests/discussions_spec.rb
spec/features/merge_requests/discussions_spec.rb
+0
-0
spec/javascripts/comment_type_toggle_spec.js
spec/javascripts/comment_type_toggle_spec.js
+76
-31
No files found.
app/assets/javascripts/comment_type_toggle.js
View file @
99e4431c
import
DropLab
from
'
@gitlab-org/drop
lab
'
;
import
InputSetter
from
'
@gitlab-org/droplab/dist/plugins/InputS
etter
'
;
import
DropLab
from
'
~/droplab/drop_
lab
'
;
import
InputSetter
from
'
~/droplab/plugins/input_s
etter
'
;
class
CommentTypeToggle
{
constructor
(
dropdownTrigger
,
dropdownList
,
noteTypeInput
,
submitButton
,
closeButton
)
{
...
...
@@ -33,7 +33,7 @@ class CommentTypeToggle {
}
this
.
droplab
.
init
(
this
.
dropdownTrigger
,
this
.
dropdownList
,
[
InputSetter
],
{
InputSetter
:
inputSetterConfig
InputSetter
:
inputSetterConfig
,
});
}
}
...
...
app/assets/javascripts/notes.js
View file @
99e4431c
...
...
@@ -738,7 +738,7 @@ require('./task_list');
Notes
.
prototype
.
replyToDiscussionNote
=
function
(
e
)
{
var
form
,
replyLink
;
form
=
this
.
cleanForm
(
this
.
formClone
.
clone
());
form
=
this
.
cleanForm
(
this
.
formClone
.
clone
());
replyLink
=
$
(
e
.
target
).
closest
(
"
.js-discussion-reply-button
"
);
// insert the form after the button
replyLink
...
...
@@ -1060,7 +1060,7 @@ require('./task_list');
.
remove
();
return
$form
;
}
}
;
return
Notes
;
})();
...
...
spec/features/merge_requests/discussion_spec.rb
→
spec/features/merge_requests/discussion
s
_spec.rb
View file @
99e4431c
File moved
spec/javascripts/comment_type_toggle_spec.js
View file @
99e4431c
import
CommentTypeToggle
from
'
~/comment_type_toggle
'
;
import
DropLab
from
'
@gitlab-org/drop
lab
'
;
import
InputSetter
from
'
@gitlab-org/droplab/dist/plugins/InputS
etter
'
;
import
*
as
dropLabSrc
from
'
~/droplab/drop_
lab
'
;
import
InputSetter
from
'
~/droplab/plugins/input_s
etter
'
;
describe
(
'
CommentTypeToggle
'
,
function
()
{
describe
(
'
class constructor
'
,
function
()
{
beforeEach
(
function
()
{
this
.
trigger
=
{};
this
.
list
=
{};
this
.
input
=
{};
this
.
button
=
{};
this
.
dropdownTrigger
=
{};
this
.
dropdownList
=
{};
this
.
noteTypeInput
=
{};
this
.
submitButton
=
{};
this
.
closeButton
=
{};
this
.
commentTypeToggle
=
new
CommentTypeToggle
(
this
.
trigger
,
this
.
list
,
this
.
input
,
this
.
button
,
this
.
dropdownTrigger
,
this
.
dropdownList
,
this
.
noteTypeInput
,
this
.
submitButton
,
this
.
closeButton
,
);
});
it
(
'
should set .
t
rigger
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
trigger
).
toBe
(
this
.
t
rigger
);
it
(
'
should set .
dropdownT
rigger
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
dropdownTrigger
).
toBe
(
this
.
dropdownT
rigger
);
});
it
(
'
should set .
l
ist
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
list
).
toBe
(
this
.
l
ist
);
it
(
'
should set .
dropdownL
ist
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
dropdownList
).
toBe
(
this
.
dropdownL
ist
);
});
it
(
'
should set .
i
nput
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
input
).
toBe
(
this
.
i
nput
);
it
(
'
should set .
noteTypeI
nput
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
noteTypeInput
).
toBe
(
this
.
noteTypeI
nput
);
});
it
(
'
should set .button
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
button
).
toBe
(
this
.
button
);
it
(
'
should set .submitButton
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
submitButton
).
toBe
(
this
.
submitButton
);
});
it
(
'
should set .closeButton
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
closeButton
).
toBe
(
this
.
closeButton
);
});
});
describe
(
'
initDroplab
'
,
function
()
{
beforeEach
(
function
()
{
this
.
commentTypeToggle
=
{
trigger
:
{},
list
:
{},
input
:
{},
button
:
{},
dropdownTrigger
:
{},
dropdownList
:
{},
noteTypeInput
:
{},
submitButton
:
{},
closeButton
:
{},
};
this
.
droplab
=
jasmine
.
createSpyObj
(
'
droplab
'
,
[
'
addHook
'
]);
this
.
droplab
=
jasmine
.
createSpyObj
(
'
droplab
'
,
[
'
init
'
]);
spyOn
(
window
,
'
DropLab
'
).
and
.
returnValue
(
this
.
droplab
);
spyOn
(
dropLabSrc
,
'
default
'
).
and
.
returnValue
(
this
.
droplab
);
this
.
initDroplab
=
CommentTypeToggle
.
prototype
.
initDroplab
.
call
(
this
.
commentTypeToggle
);
});
it
(
'
should instantiate a DropLab instance
'
,
function
()
{
expect
(
window
.
DropLab
).
toHaveBeenCalled
();
expect
(
dropLabSrc
.
default
).
toHaveBeenCalled
();
});
it
(
'
should set .droplab
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
droplab
).
toBe
(
this
.
droplab
);
});
it
(
'
should call DropLab.prototype.
addHook
'
,
function
()
{
expect
(
this
.
droplab
.
addHook
).
toHaveBeenCalledWith
(
this
.
commentTypeToggle
.
t
rigger
,
this
.
commentTypeToggle
.
l
ist
,
it
(
'
should call DropLab.prototype.
init
'
,
function
()
{
expect
(
this
.
droplab
.
init
).
toHaveBeenCalledWith
(
this
.
commentTypeToggle
.
dropdownT
rigger
,
this
.
commentTypeToggle
.
dropdownL
ist
,
[
InputSetter
],
{
InputSetter
:
[{
input
:
this
.
commentTypeToggle
.
i
nput
,
input
:
this
.
commentTypeToggle
.
noteTypeI
nput
,
valueAttribute
:
'
data-value
'
,
},
{
input
:
this
.
commentTypeToggle
.
b
utton
,
input
:
this
.
commentTypeToggle
.
submitB
utton
,
valueAttribute
:
'
data-button-text
'
,
},
{
input
:
this
.
commentTypeToggle
.
closeButton
,
valueAttribute
:
'
data-secondary-button-text
'
,
},
{
input
:
this
.
commentTypeToggle
.
closeButton
,
valueAttribute
:
'
data-secondary-button-text
'
,
inputAttribute
:
'
data-alternative-text
'
,
}],
},
);
});
describe
(
'
if no .closeButton is provided
'
,
function
()
{
beforeEach
(
function
()
{
this
.
commentTypeToggle
=
{
dropdownTrigger
:
{},
dropdownList
:
{},
noteTypeInput
:
{},
submitButton
:
{},
};
this
.
initDroplab
=
CommentTypeToggle
.
prototype
.
initDroplab
.
call
(
this
.
commentTypeToggle
);
});
it
(
'
should not add .closeButton related InputSetter config
'
,
function
()
{
expect
(
this
.
droplab
.
init
).
toHaveBeenCalledWith
(
this
.
commentTypeToggle
.
dropdownTrigger
,
this
.
commentTypeToggle
.
dropdownList
,
[
InputSetter
],
{
InputSetter
:
[{
input
:
this
.
commentTypeToggle
.
noteTypeInput
,
valueAttribute
:
'
data-value
'
,
},
{
input
:
this
.
commentTypeToggle
.
submitButton
,
valueAttribute
:
'
data-button-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