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
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
DropLab
from
'
~/droplab/drop_
lab
'
;
import
InputSetter
from
'
@gitlab-org/droplab/dist/plugins/InputS
etter
'
;
import
InputSetter
from
'
~/droplab/plugins/input_s
etter
'
;
class
CommentTypeToggle
{
class
CommentTypeToggle
{
constructor
(
dropdownTrigger
,
dropdownList
,
noteTypeInput
,
submitButton
,
closeButton
)
{
constructor
(
dropdownTrigger
,
dropdownList
,
noteTypeInput
,
submitButton
,
closeButton
)
{
...
@@ -33,7 +33,7 @@ class CommentTypeToggle {
...
@@ -33,7 +33,7 @@ class CommentTypeToggle {
}
}
this
.
droplab
.
init
(
this
.
dropdownTrigger
,
this
.
dropdownList
,
[
InputSetter
],
{
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');
...
@@ -738,7 +738,7 @@ require('./task_list');
Notes
.
prototype
.
replyToDiscussionNote
=
function
(
e
)
{
Notes
.
prototype
.
replyToDiscussionNote
=
function
(
e
)
{
var
form
,
replyLink
;
var
form
,
replyLink
;
form
=
this
.
cleanForm
(
this
.
formClone
.
clone
());
form
=
this
.
cleanForm
(
this
.
formClone
.
clone
());
replyLink
=
$
(
e
.
target
).
closest
(
"
.js-discussion-reply-button
"
);
replyLink
=
$
(
e
.
target
).
closest
(
"
.js-discussion-reply-button
"
);
// insert the form after the button
// insert the form after the button
replyLink
replyLink
...
@@ -1060,7 +1060,7 @@ require('./task_list');
...
@@ -1060,7 +1060,7 @@ require('./task_list');
.
remove
();
.
remove
();
return
$form
;
return
$form
;
}
}
;
return
Notes
;
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
CommentTypeToggle
from
'
~/comment_type_toggle
'
;
import
DropLab
from
'
@gitlab-org/drop
lab
'
;
import
*
as
dropLabSrc
from
'
~/droplab/drop_
lab
'
;
import
InputSetter
from
'
@gitlab-org/droplab/dist/plugins/InputS
etter
'
;
import
InputSetter
from
'
~/droplab/plugins/input_s
etter
'
;
describe
(
'
CommentTypeToggle
'
,
function
()
{
describe
(
'
CommentTypeToggle
'
,
function
()
{
describe
(
'
class constructor
'
,
function
()
{
describe
(
'
class constructor
'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
this
.
trigger
=
{};
this
.
dropdownTrigger
=
{};
this
.
list
=
{};
this
.
dropdownList
=
{};
this
.
input
=
{};
this
.
noteTypeInput
=
{};
this
.
button
=
{};
this
.
submitButton
=
{};
this
.
closeButton
=
{};
this
.
commentTypeToggle
=
new
CommentTypeToggle
(
this
.
commentTypeToggle
=
new
CommentTypeToggle
(
this
.
trigger
,
this
.
dropdownTrigger
,
this
.
list
,
this
.
dropdownList
,
this
.
input
,
this
.
noteTypeInput
,
this
.
button
,
this
.
submitButton
,
this
.
closeButton
,
);
);
});
});
it
(
'
should set .
t
rigger
'
,
function
()
{
it
(
'
should set .
dropdownT
rigger
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
trigger
).
toBe
(
this
.
t
rigger
);
expect
(
this
.
commentTypeToggle
.
dropdownTrigger
).
toBe
(
this
.
dropdownT
rigger
);
});
});
it
(
'
should set .
l
ist
'
,
function
()
{
it
(
'
should set .
dropdownL
ist
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
list
).
toBe
(
this
.
l
ist
);
expect
(
this
.
commentTypeToggle
.
dropdownList
).
toBe
(
this
.
dropdownL
ist
);
});
});
it
(
'
should set .
i
nput
'
,
function
()
{
it
(
'
should set .
noteTypeI
nput
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
input
).
toBe
(
this
.
i
nput
);
expect
(
this
.
commentTypeToggle
.
noteTypeInput
).
toBe
(
this
.
noteTypeI
nput
);
});
});
it
(
'
should set .button
'
,
function
()
{
it
(
'
should set .submitButton
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
button
).
toBe
(
this
.
button
);
expect
(
this
.
commentTypeToggle
.
submitButton
).
toBe
(
this
.
submitButton
);
});
it
(
'
should set .closeButton
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
closeButton
).
toBe
(
this
.
closeButton
);
});
});
});
});
describe
(
'
initDroplab
'
,
function
()
{
describe
(
'
initDroplab
'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
this
.
commentTypeToggle
=
{
this
.
commentTypeToggle
=
{
trigger
:
{},
dropdownTrigger
:
{},
list
:
{},
dropdownList
:
{},
input
:
{},
noteTypeInput
:
{},
button
:
{},
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
);
this
.
initDroplab
=
CommentTypeToggle
.
prototype
.
initDroplab
.
call
(
this
.
commentTypeToggle
);
});
});
it
(
'
should instantiate a DropLab instance
'
,
function
()
{
it
(
'
should instantiate a DropLab instance
'
,
function
()
{
expect
(
window
.
DropLab
).
toHaveBeenCalled
();
expect
(
dropLabSrc
.
default
).
toHaveBeenCalled
();
});
});
it
(
'
should set .droplab
'
,
function
()
{
it
(
'
should set .droplab
'
,
function
()
{
expect
(
this
.
commentTypeToggle
.
droplab
).
toBe
(
this
.
droplab
);
expect
(
this
.
commentTypeToggle
.
droplab
).
toBe
(
this
.
droplab
);
});
});
it
(
'
should call DropLab.prototype.
addHook
'
,
function
()
{
it
(
'
should call DropLab.prototype.
init
'
,
function
()
{
expect
(
this
.
droplab
.
addHook
).
toHaveBeenCalledWith
(
expect
(
this
.
droplab
.
init
).
toHaveBeenCalledWith
(
this
.
commentTypeToggle
.
t
rigger
,
this
.
commentTypeToggle
.
dropdownT
rigger
,
this
.
commentTypeToggle
.
l
ist
,
this
.
commentTypeToggle
.
dropdownL
ist
,
[
InputSetter
],
[
InputSetter
],
{
{
InputSetter
:
[{
InputSetter
:
[{
input
:
this
.
commentTypeToggle
.
i
nput
,
input
:
this
.
commentTypeToggle
.
noteTypeI
nput
,
valueAttribute
:
'
data-value
'
,
valueAttribute
:
'
data-value
'
,
},
{
},
{
input
:
this
.
commentTypeToggle
.
b
utton
,
input
:
this
.
commentTypeToggle
.
submitB
utton
,
valueAttribute
:
'
data-button-text
'
,
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