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
Boxiang Sun
gitlab-ce
Commits
d990df74
Commit
d990df74
authored
Jul 06, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor TaskList class to ES module syntax
parent
571de11e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
38 deletions
+37
-38
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+2
-2
app/assets/javascripts/issue_show/components/description.vue
app/assets/javascripts/issue_show/components/description.vue
+2
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request.js
+2
-2
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+2
-2
app/assets/javascripts/task_list.js
app/assets/javascripts/task_list.js
+1
-4
spec/javascripts/issue_show/components/description_spec.js
spec/javascripts/issue_show/components/description_spec.js
+28
-26
No files found.
app/assets/javascripts/issue.js
View file @
d990df74
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
import
'
vendor/jquery.waitforimages
'
;
import
'
vendor/jquery.waitforimages
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
./flash
'
;
import
'
./flash
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
class
Issue
{
class
Issue
{
constructor
()
{
constructor
()
{
if
(
$
(
'
a.btn-close
'
).
length
)
{
if
(
$
(
'
a.btn-close
'
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
issue
'
,
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/issue_show/components/description.vue
View file @
d990df74
<
script
>
<
script
>
import
animateMixin
from
'
../mixins/animate
'
;
import
animateMixin
from
'
../mixins/animate
'
;
import
TaskList
from
'
../../task_list
'
;
export
default
{
export
default
{
mixins
:
[
animateMixin
],
mixins
:
[
animateMixin
],
...
@@ -46,7 +47,7 @@
...
@@ -46,7 +47,7 @@
if
(
this
.
canUpdate
)
{
if
(
this
.
canUpdate
)
{
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
gl
.
TaskList
({
new
TaskList
({
dataType
:
'
issue
'
,
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/main.js
View file @
d990df74
...
@@ -151,7 +151,6 @@ import './star';
...
@@ -151,7 +151,6 @@ import './star';
import
'
./subscription
'
;
import
'
./subscription
'
;
import
'
./subscription_select
'
;
import
'
./subscription_select
'
;
import
'
./syntax_highlight
'
;
import
'
./syntax_highlight
'
;
import
'
./task_list
'
;
import
'
./user
'
;
import
'
./user
'
;
// eslint-disable-next-line global-require, import/no-commonjs
// eslint-disable-next-line global-require, import/no-commonjs
...
...
app/assets/javascripts/merge_request.js
View file @
d990df74
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* global MergeRequestTabs */
/* global MergeRequestTabs */
import
'
vendor/jquery.waitforimages
'
;
import
'
vendor/jquery.waitforimages
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
import
'
./merge_request_tabs
'
;
import
'
./merge_request_tabs
'
;
(
function
()
{
(
function
()
{
...
@@ -25,7 +25,7 @@ import './merge_request_tabs';
...
@@ -25,7 +25,7 @@ import './merge_request_tabs';
this
.
initMRBtnListeners
();
this
.
initMRBtnListeners
();
this
.
initCommitMessageListeners
();
this
.
initCommitMessageListeners
();
if
(
$
(
"
a.btn-close
"
).
length
)
{
if
(
$
(
"
a.btn-close
"
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
merge_request
'
,
dataType
:
'
merge_request
'
,
fieldName
:
'
description
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/notes.js
View file @
d990df74
...
@@ -21,7 +21,7 @@ import CommentTypeToggle from './comment_type_toggle';
...
@@ -21,7 +21,7 @@ import CommentTypeToggle from './comment_type_toggle';
import
loadAwardsHandler
from
'
./awards_handler
'
;
import
loadAwardsHandler
from
'
./awards_handler
'
;
import
'
./autosave
'
;
import
'
./autosave
'
;
import
'
./dropzone_input
'
;
import
'
./dropzone_input
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
window
.
autosize
=
autosize
;
window
.
autosize
=
autosize
;
window
.
Dropzone
=
Dropzone
;
window
.
Dropzone
=
Dropzone
;
...
@@ -71,7 +71,7 @@ export default class Notes {
...
@@ -71,7 +71,7 @@ export default class Notes {
this
.
addBinding
();
this
.
addBinding
();
this
.
setPollingInterval
();
this
.
setPollingInterval
();
this
.
setupMainTargetNoteForm
();
this
.
setupMainTargetNoteForm
();
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
note
'
,
dataType
:
'
note
'
,
fieldName
:
'
note
'
,
fieldName
:
'
note
'
,
selector
:
'
.notes
'
selector
:
'
.notes
'
...
...
app/assets/javascripts/task_list.js
View file @
d990df74
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
'
deckar01-task_list
'
;
import
'
deckar01-task_list
'
;
class
TaskList
{
export
default
class
TaskList
{
constructor
(
options
=
{})
{
constructor
(
options
=
{})
{
this
.
selector
=
options
.
selector
;
this
.
selector
=
options
.
selector
;
this
.
dataType
=
options
.
dataType
;
this
.
dataType
=
options
.
dataType
;
...
@@ -48,6 +48,3 @@ class TaskList {
...
@@ -48,6 +48,3 @@ class TaskList {
});
});
}
}
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
TaskList
=
TaskList
;
spec/javascripts/issue_show/components/description_spec.js
View file @
d990df74
...
@@ -44,32 +44,34 @@ describe('Description component', () => {
...
@@ -44,32 +44,34 @@ describe('Description component', () => {
});
});
});
});
it
(
'
re-inits the TaskList when description changed
'
,
(
done
)
=>
{
// TODO: gl.TaskList no longer exists. rewrite these tests once we have a way to rewire ES modules
spyOn
(
gl
,
'
TaskList
'
);
vm
.
descriptionHtml
=
'
changed
'
;
// it('re-inits the TaskList when description changed', (done) => {
// spyOn(gl, 'TaskList');
setTimeout
(()
=>
{
// vm.descriptionHtml = 'changed';
expect
(
//
gl
.
TaskList
,
// setTimeout(() => {
).
toHaveBeenCalled
();
// expect(
// gl.TaskList,
done
();
// ).toHaveBeenCalled();
});
//
});
// done();
// });
it
(
'
does not re-init the TaskList when canUpdate is false
'
,
(
done
)
=>
{
// });
spyOn
(
gl
,
'
TaskList
'
);
vm
.
canUpdate
=
false
;
// it('does not re-init the TaskList when canUpdate is false', (done) => {
vm
.
descriptionHtml
=
'
changed
'
;
// spyOn(gl, 'TaskList');
// vm.canUpdate = false;
setTimeout
(()
=>
{
// vm.descriptionHtml = 'changed';
expect
(
//
gl
.
TaskList
,
// setTimeout(() => {
).
not
.
toHaveBeenCalled
();
// expect(
// gl.TaskList,
done
();
// ).not.toHaveBeenCalled();
});
//
});
// done();
// });
// });
describe
(
'
taskStatus
'
,
()
=>
{
describe
(
'
taskStatus
'
,
()
=>
{
it
(
'
adds full taskStatus
'
,
(
done
)
=>
{
it
(
'
adds full taskStatus
'
,
(
done
)
=>
{
...
...
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