BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c2f0f8d7
Commit
c2f0f8d7
authored
Feb 08, 2018
by
Constance Okoghenun
Committed by
Jacob Schatz
Feb 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored merge_requests/show path in dispatcher.js
parent
b2761d17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
33 deletions
+35
-33
dispatcher.js
app/assets/javascripts/dispatcher.js
+4
-17
gl_form.js
app/assets/javascripts/gl_form.js
+1
-2
index.js
...s/javascripts/pages/projects/merge_requests/show/index.js
+24
-0
gl_form_spec.js
spec/javascripts/gl_form_spec.js
+6
-14
No files found.
app/assets/javascripts/dispatcher.js
View file @
c2f0f8d7
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
import
MergeRequest
from
'./merge_request'
;
import
Flash
from
'./flash'
;
import
GfmAutoComplete
from
'./gfm_auto_complete'
;
import
ZenMode
from
'./zen_mode'
;
import
initNotes
from
'./init_notes'
;
import
initIssuableSidebar
from
'./init_issuable_sidebar'
;
import
{
convertPermissionToBoolean
}
from
'./lib/utils/common_utils'
;
import
GlFieldErrors
from
'./gl_field_errors'
;
import
Shortcuts
from
'./shortcuts'
;
import
ShortcutsIssuable
from
'./shortcuts_issuable'
;
import
Diff
from
'./diff'
;
import
SearchAutocomplete
from
'./search_autocomplete'
;
var
Dispatcher
;
...
...
@@ -262,17 +256,10 @@ var Dispatcher;
.
catch
(
fail
);
break
;
case
'projects:merge_requests:show'
:
new
Diff
();
new
ZenMode
();
initIssuableSidebar
();
initNotes
();
const
mrShowNode
=
document
.
querySelector
(
'.merge-request'
);
window
.
mergeRequest
=
new
MergeRequest
({
action
:
mrShowNode
.
dataset
.
mrAction
,
});
shortcut_handler
=
new
ShortcutsIssuable
(
true
);
import
(
'./pages/projects/merge_requests/show'
)
.
then
(
callDefault
)
.
catch
(
fail
);
shortcut_handler
=
true
;
break
;
case
'dashboard:activity'
:
import
(
'./pages/dashboard/activity'
)
...
...
app/assets/javascripts/gl_form.js
View file @
c2f0f8d7
/* global autosize */
import
autosize
from
'autosize'
;
import
GfmAutoComplete
from
'./gfm_auto_complete'
;
import
dropzoneInput
from
'./dropzone_input'
;
import
textUtils
from
'./lib/utils/text_markdown'
;
...
...
app/assets/javascripts/pages/projects/merge_requests/show/index.js
0 → 100644
View file @
c2f0f8d7
import
MergeRequest
from
'~/merge_request'
;
import
ZenMode
from
'~/zen_mode'
;
import
initNotes
from
'~/init_notes'
;
import
initIssuableSidebar
from
'~/init_issuable_sidebar'
;
import
ShortcutsIssuable
from
'~/shortcuts_issuable'
;
import
Diff
from
'~/diff'
;
import
{
handleLocationHash
}
from
'~/lib/utils/common_utils'
;
export
default
()
=>
{
new
Diff
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
initIssuableSidebar
();
// eslint-disable-line no-new
initNotes
();
// eslint-disable-line no-new
const
mrShowNode
=
document
.
querySelector
(
'.merge-request'
);
window
.
mergeRequest
=
new
MergeRequest
({
action
:
mrShowNode
.
dataset
.
mrAction
,
});
new
ShortcutsIssuable
(
true
);
// eslint-disable-line no-new
handleLocationHash
();
};
spec/javascripts/gl_form_spec.js
View file @
c2f0f8d7
import
A
utosize
from
'autosize'
;
import
a
utosize
from
'autosize'
;
import
GLForm
from
'~/gl_form'
;
import
'~/lib/utils/text_utility'
;
import
'~/lib/utils/common_utils'
;
window
.
autosize
=
Autosize
;
describe
(
'GLForm'
,
()
=>
{
describe
(
'when instantiated'
,
function
()
{
beforeEach
((
done
)
=>
{
...
...
@@ -13,14 +11,12 @@ describe('GLForm', () => {
spyOn
(
$
.
prototype
,
'off'
).
and
.
returnValue
(
this
.
textarea
);
spyOn
(
$
.
prototype
,
'on'
).
and
.
returnValue
(
this
.
textarea
);
spyOn
(
$
.
prototype
,
'css'
);
spyOn
(
window
,
'autosize'
);
this
.
glForm
=
new
GLForm
(
this
.
form
);
this
.
glForm
=
new
GLForm
(
this
.
form
,
false
);
setTimeout
(()
=>
{
$
.
prototype
.
off
.
calls
.
reset
();
$
.
prototype
.
on
.
calls
.
reset
();
$
.
prototype
.
css
.
calls
.
reset
();
window
.
autosize
.
calls
.
reset
();
done
();
});
});
...
...
@@ -43,10 +39,6 @@ describe('GLForm', () => {
expect
(
$
.
prototype
.
on
).
toHaveBeenCalledWith
(
'mouseup.autosize'
,
jasmine
.
any
(
Function
));
});
it
(
'should autosize the textarea'
,
()
=>
{
expect
(
window
.
autosize
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Object
));
});
it
(
'should set the resize css property to vertical'
,
()
=>
{
expect
(
$
.
prototype
.
css
).
toHaveBeenCalledWith
(
'resize'
,
'vertical'
);
});
...
...
@@ -74,7 +66,7 @@ describe('GLForm', () => {
spyOn
(
$
.
prototype
,
'data'
);
spyOn
(
$
.
prototype
,
'outerHeight'
).
and
.
returnValue
(
200
);
spyOn
(
window
,
'outerHeight'
).
and
.
returnValue
(
400
);
spyOn
(
window
.
autosize
,
'destroy'
);
spyOn
(
autosize
,
'destroy'
);
this
.
glForm
.
destroyAutosize
();
});
...
...
@@ -88,7 +80,7 @@ describe('GLForm', () => {
});
it
(
'should call autosize destroy'
,
()
=>
{
expect
(
window
.
autosize
.
destroy
).
toHaveBeenCalledWith
(
this
.
textarea
);
expect
(
autosize
.
destroy
).
toHaveBeenCalledWith
(
this
.
textarea
);
});
it
(
'should set the data-height attribute'
,
()
=>
{
...
...
@@ -107,9 +99,9 @@ describe('GLForm', () => {
it
(
'should return undefined if the data-height equals the outerHeight'
,
()
=>
{
spyOn
(
$
.
prototype
,
'outerHeight'
).
and
.
returnValue
(
200
);
spyOn
(
$
.
prototype
,
'data'
).
and
.
returnValue
(
200
);
spyOn
(
window
.
autosize
,
'destroy'
);
spyOn
(
autosize
,
'destroy'
);
expect
(
this
.
glForm
.
destroyAutosize
()).
toBeUndefined
();
expect
(
window
.
autosize
.
destroy
).
not
.
toHaveBeenCalled
();
expect
(
autosize
.
destroy
).
not
.
toHaveBeenCalled
();
});
});
});
...
...
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