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
Hide 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 @@
import
'
vendor/jquery.waitforimages
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
./flash
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
class
Issue
{
constructor
()
{
if
(
$
(
'
a.btn-close
'
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/issue_show/components/description.vue
View file @
d990df74
<
script
>
import
animateMixin
from
'
../mixins/animate
'
;
import
TaskList
from
'
../../task_list
'
;
export
default
{
mixins
:
[
animateMixin
],
...
...
@@ -46,7 +47,7 @@
if
(
this
.
canUpdate
)
{
// eslint-disable-next-line no-new
new
gl
.
TaskList
({
new
TaskList
({
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/main.js
View file @
d990df74
...
...
@@ -151,7 +151,6 @@ import './star';
import
'
./subscription
'
;
import
'
./subscription_select
'
;
import
'
./syntax_highlight
'
;
import
'
./task_list
'
;
import
'
./user
'
;
// eslint-disable-next-line global-require, import/no-commonjs
...
...
app/assets/javascripts/merge_request.js
View file @
d990df74
...
...
@@ -2,7 +2,7 @@
/* global MergeRequestTabs */
import
'
vendor/jquery.waitforimages
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
import
'
./merge_request_tabs
'
;
(
function
()
{
...
...
@@ -25,7 +25,7 @@ import './merge_request_tabs';
this
.
initMRBtnListeners
();
this
.
initCommitMessageListeners
();
if
(
$
(
"
a.btn-close
"
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
merge_request
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
...
...
app/assets/javascripts/notes.js
View file @
d990df74
...
...
@@ -21,7 +21,7 @@ import CommentTypeToggle from './comment_type_toggle';
import
loadAwardsHandler
from
'
./awards_handler
'
;
import
'
./autosave
'
;
import
'
./dropzone_input
'
;
import
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
window
.
autosize
=
autosize
;
window
.
Dropzone
=
Dropzone
;
...
...
@@ -71,7 +71,7 @@ export default class Notes {
this
.
addBinding
();
this
.
setPollingInterval
();
this
.
setupMainTargetNoteForm
();
this
.
taskList
=
new
gl
.
TaskList
({
this
.
taskList
=
new
TaskList
({
dataType
:
'
note
'
,
fieldName
:
'
note
'
,
selector
:
'
.notes
'
...
...
app/assets/javascripts/task_list.js
View file @
d990df74
...
...
@@ -2,7 +2,7 @@
import
'
deckar01-task_list
'
;
class
TaskList
{
export
default
class
TaskList
{
constructor
(
options
=
{})
{
this
.
selector
=
options
.
selector
;
this
.
dataType
=
options
.
dataType
;
...
...
@@ -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', () => {
});
});
it
(
'
re-inits the TaskList when description changed
'
,
(
done
)
=>
{
spyOn
(
gl
,
'
TaskList
'
);
vm
.
descriptionHtml
=
'
changed
'
;
setTimeout
(()
=>
{
expect
(
gl
.
TaskList
,
).
toHaveBeenCalled
();
done
();
});
});
it
(
'
does not re-init the TaskList when canUpdate is false
'
,
(
done
)
=>
{
spyOn
(
gl
,
'
TaskList
'
);
vm
.
canUpdate
=
false
;
vm
.
descriptionHtml
=
'
changed
'
;
setTimeout
(()
=>
{
expect
(
gl
.
TaskList
,
).
not
.
toHaveBeenCalled
();
done
();
});
});
// TODO: gl.TaskList no longer exists. rewrite these tests once we have a way to rewire ES modules
// it('re-inits the TaskList when description changed', (done) => {
// spyOn(gl, 'TaskList');
// vm.descriptionHtml = 'changed';
//
// setTimeout(() => {
// expect(
// gl.TaskList,
// ).toHaveBeenCalled();
//
// done();
// });
// });
// it('does not re-init the TaskList when canUpdate is false', (done) => {
// spyOn(gl, 'TaskList');
// vm.canUpdate = false;
// vm.descriptionHtml = 'changed';
//
// setTimeout(() => {
// expect(
// gl.TaskList,
// ).not.toHaveBeenCalled();
//
// done();
// });
// });
describe
(
'
taskStatus
'
,
()
=>
{
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