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
Léo-Paul Géneau
gitlab-ce
Commits
f28cd19d
Commit
f28cd19d
authored
Jul 07, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MR and issue specs
parent
c7f23e25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
15 deletions
+18
-15
app/assets/javascripts/helpers/issuables_helper.js
app/assets/javascripts/helpers/issuables_helper.js
+7
-1
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+4
-4
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request.js
+2
-2
spec/javascripts/merge_request_spec.js
spec/javascripts/merge_request_spec.js
+5
-8
No files found.
app/assets/javascripts/helpers/issuables_helper.js
View file @
f28cd19d
import
CloseReopenReportToggle
from
'
../close_reopen_report_toggle
'
;
import
CloseReopenReportToggle
from
'
../close_reopen_report_toggle
'
;
export
default
function
initCloseReopenReport
()
{
function
initCloseReopenReport
()
{
const
container
=
document
.
querySelector
(
'
.js-issuable-close-dropdown
'
);
const
container
=
document
.
querySelector
(
'
.js-issuable-close-dropdown
'
);
if
(
!
container
)
return
undefined
;
if
(
!
container
)
return
undefined
;
...
@@ -19,3 +19,9 @@ export default function initCloseReopenReport() {
...
@@ -19,3 +19,9 @@ export default function initCloseReopenReport() {
return
closeReopenReportToggle
;
return
closeReopenReportToggle
;
}
}
const
IssuablesHelper
=
{
initCloseReopenReport
,
};
export
default
IssuablesHelper
;
app/assets/javascripts/issue.js
View file @
f28cd19d
...
@@ -6,7 +6,7 @@ import '~/lib/utils/text_utility';
...
@@ -6,7 +6,7 @@ import '~/lib/utils/text_utility';
import
'
./flash
'
;
import
'
./flash
'
;
import
'
./task_list
'
;
import
'
./task_list
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
import
initCloseReopenReport
from
'
./helpers/issuables_helper
'
;
import
IssuablesHelper
from
'
./helpers/issuables_helper
'
;
class
Issue
{
class
Issue
{
constructor
()
{
constructor
()
{
...
@@ -98,10 +98,10 @@ class Issue {
...
@@ -98,10 +98,10 @@ class Issue {
}
}
initCloseReopenReport
()
{
initCloseReopenReport
()
{
this
.
closeReopenReportToggle
=
initCloseReopenReport
();
this
.
closeReopenReportToggle
=
IssuablesHelper
.
initCloseReopenReport
();
this
.
closeButtons
=
this
.
closeButtons
.
not
(
'
.issuable-close-button
'
);
if
(
this
.
closeButtons
)
this
.
closeButtons
=
this
.
closeButtons
.
not
(
'
.issuable-close-button
'
);
this
.
reopenButtons
=
this
.
reopenButtons
.
not
(
'
.issuable-close-button
'
);
if
(
this
.
reopenButtons
)
this
.
reopenButtons
=
this
.
reopenButtons
.
not
(
'
.issuable-close-button
'
);
}
}
disableCloseReopenButton
(
$button
,
shouldDisable
)
{
disableCloseReopenButton
(
$button
,
shouldDisable
)
{
...
...
app/assets/javascripts/merge_request.js
View file @
f28cd19d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
'
vendor/jquery.waitforimages
'
;
import
'
vendor/jquery.waitforimages
'
;
import
'
./task_list
'
;
import
'
./task_list
'
;
import
'
./merge_request_tabs
'
;
import
'
./merge_request_tabs
'
;
import
initCloseReopenReport
from
'
./helpers/issuables_helper
'
;
import
IssuablesHelper
from
'
./helpers/issuables_helper
'
;
(
function
()
{
(
function
()
{
this
.
MergeRequest
=
(
function
()
{
this
.
MergeRequest
=
(
function
()
{
...
@@ -26,7 +26,7 @@ import initCloseReopenReport from './helpers/issuables_helper';
...
@@ -26,7 +26,7 @@ import initCloseReopenReport from './helpers/issuables_helper';
this
.
initTabs
();
this
.
initTabs
();
this
.
initMRBtnListeners
();
this
.
initMRBtnListeners
();
this
.
initCommitMessageListeners
();
this
.
initCommitMessageListeners
();
this
.
closeReopenReportToggle
=
initCloseReopenReport
();
this
.
closeReopenReportToggle
=
IssuablesHelper
.
initCloseReopenReport
();
if
(
$
(
"
a.btn-close
"
).
length
)
{
if
(
$
(
"
a.btn-close
"
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
gl
.
TaskList
({
...
...
spec/javascripts/merge_request_spec.js
View file @
f28cd19d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
'
~/merge_request
'
;
import
'
~/merge_request
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
import
IssuablesHelper
from
'
~/helpers/issuables_helper
'
;
(
function
()
{
(
function
()
{
describe
(
'
MergeRequest
'
,
function
()
{
describe
(
'
MergeRequest
'
,
function
()
{
...
@@ -31,28 +32,24 @@ import CloseReopenReportToggle from '~/close_reopen_report_toggle';
...
@@ -31,28 +32,24 @@ import CloseReopenReportToggle from '~/close_reopen_report_toggle';
describe
(
'
class constructor
'
,
()
=>
{
describe
(
'
class constructor
'
,
()
=>
{
it
(
'
calls .initCloseReopenReport
'
,
()
=>
{
it
(
'
calls .initCloseReopenReport
'
,
()
=>
{
spyOn
(
MergeRequest
.
prototype
,
'
initCloseReopenReport
'
);
spyOn
(
IssuablesHelper
,
'
initCloseReopenReport
'
);
const
mergeRequest
=
new
MergeRequest
();
new
MergeRequest
();
// eslint-disable-line no-new
expect
(
mergeRequest
.
initCloseReopenReport
).
toHaveBeenCalled
();
expect
(
IssuablesHelper
.
initCloseReopenReport
).
toHaveBeenCalled
();
});
});
});
describe
(
'
initCloseReopenReport
'
,
()
=>
{
it
(
'
calls .initDroplab
'
,
()
=>
{
it
(
'
calls .initDroplab
'
,
()
=>
{
const
container
=
jasmine
.
createSpyObj
(
'
container
'
,
[
'
querySelector
'
]);
const
container
=
jasmine
.
createSpyObj
(
'
container
'
,
[
'
querySelector
'
]);
const
dropdownTrigger
=
{};
const
dropdownTrigger
=
{};
const
dropdownList
=
{};
const
dropdownList
=
{};
const
button
=
{};
const
button
=
{};
const
mergeRequest
=
new
MergeRequest
();
spyOn
(
CloseReopenReportToggle
.
prototype
,
'
initDroplab
'
);
spyOn
(
CloseReopenReportToggle
.
prototype
,
'
initDroplab
'
);
spyOn
(
document
,
'
querySelector
'
).
and
.
returnValue
(
container
);
spyOn
(
document
,
'
querySelector
'
).
and
.
returnValue
(
container
);
container
.
querySelector
.
and
.
returnValues
(
dropdownTrigger
,
dropdownList
,
button
);
container
.
querySelector
.
and
.
returnValues
(
dropdownTrigger
,
dropdownList
,
button
);
mergeRequest
.
initCloseReopenReport
();
new
MergeRequest
();
// eslint-disable-line no-new
expect
(
document
.
querySelector
).
toHaveBeenCalledWith
(
'
.js-issuable-close-dropdown
'
);
expect
(
document
.
querySelector
).
toHaveBeenCalledWith
(
'
.js-issuable-close-dropdown
'
);
expect
(
container
.
querySelector
).
toHaveBeenCalledWith
(
'
.js-issuable-close-toggle
'
);
expect
(
container
.
querySelector
).
toHaveBeenCalledWith
(
'
.js-issuable-close-toggle
'
);
...
...
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