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
40263a06
Commit
40263a06
authored
Oct 06, 2014
by
Vinnie Okada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor task list tests and coffeescript
parent
31bc42de
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
80 deletions
+59
-80
taskable_behavior.js.coffee
app/assets/javascripts/behaviors/taskable_behavior.js.coffee
+21
-0
issue.js.coffee
app/assets/javascripts/issue.js.coffee
+5
-19
merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+6
-20
issues.feature
features/project/issues/issues.feature
+1
-1
merge_requests.feature
features/project/merge_requests.feature
+1
-2
issues.rb
features/steps/project/issues/issues.rb
+2
-20
merge_requests.rb
features/steps/project/merge_requests.rb
+1
-11
markdown.rb
features/steps/shared/markdown.rb
+22
-7
No files found.
app/assets/javascripts/behaviors/taskable_behavior.js.coffee
0 → 100644
View file @
40263a06
window
.
updateTaskState
=
(
taskableType
)
->
objType
=
taskableType
.
data
isChecked
=
$
(
this
).
prop
(
"checked"
)
if
$
(
this
).
is
(
":checked"
)
stateEvent
=
"task_check"
else
stateEvent
=
"task_uncheck"
taskableUrl
=
$
(
"form.edit-"
+
objType
).
first
().
attr
(
"action"
)
taskableNum
=
taskableUrl
.
match
(
/\d+$/
)
taskNum
=
0
$
(
"li.task-list-item input:checkbox"
).
each
(
(
index
,
e
)
=>
if
e
==
this
taskNum
=
index
+
1
)
$
.
ajax
type
:
"PATCH"
url
:
taskableUrl
data
:
objType
+
"[state_event]="
+
stateEvent
+
"&"
+
objType
+
"[task_num]="
+
taskNum
app/assets/javascripts/issue.js.coffee
View file @
40263a06
...
@@ -9,25 +9,11 @@ class Issue
...
@@ -9,25 +9,11 @@ class Issue
if
$
(
"a.btn-close"
).
length
if
$
(
"a.btn-close"
).
length
$
(
"li.task-list-item input:checkbox"
).
prop
(
"disabled"
,
false
)
$
(
"li.task-list-item input:checkbox"
).
prop
(
"disabled"
,
false
)
$
(
".task-list-item input:checkbox"
).
on
"click"
,
->
$
(
".task-list-item input:checkbox"
).
on
(
is_checked
=
$
(
this
).
prop
(
"checked"
)
"click"
if
$
(
this
).
is
(
":checked"
)
null
state_event
=
"task_check"
"issue"
else
updateTaskState
state_event
=
"task_uncheck"
mr_url
=
$
(
"form.edit-issue"
).
first
().
attr
(
"action"
)
mr_num
=
mr_url
.
match
(
/\d+$/
)
task_num
=
0
$
(
"li.task-list-item input:checkbox"
).
each
(
(
index
,
e
)
=>
if
e
==
this
task_num
=
index
+
1
)
)
$
.
ajax
type
:
"PATCH"
url
:
mr_url
data
:
"issue[state_event]="
+
state_event
+
"&issue[task_num]="
+
task_num
@
Issue
=
Issue
@
Issue
=
Issue
app/assets/javascripts/merge_request.js.coffee
View file @
40263a06
...
@@ -17,7 +17,7 @@ class MergeRequest
...
@@ -17,7 +17,7 @@ class MergeRequest
disableButtonIfEmptyField
'#commit_message'
,
'.accept_merge_request'
disableButtonIfEmptyField
'#commit_message'
,
'.accept_merge_request'
if
$
(
"a.
close-mr-link
"
).
length
if
$
(
"a.
btn-close
"
).
length
$
(
"li.task-list-item input:checkbox"
).
prop
(
"disabled"
,
false
)
$
(
"li.task-list-item input:checkbox"
).
prop
(
"disabled"
,
false
)
# Local jQuery finder
# Local jQuery finder
...
@@ -74,27 +74,13 @@ class MergeRequest
...
@@ -74,27 +74,13 @@ class MergeRequest
this
.
$
(
'.remove_source_branch_in_progress'
).
hide
()
this
.
$
(
'.remove_source_branch_in_progress'
).
hide
()
this
.
$
(
'.remove_source_branch_widget.failed'
).
show
()
this
.
$
(
'.remove_source_branch_widget.failed'
).
show
()
this
.
$
(
".task-list-item input:checkbox"
).
on
"click"
,
->
$
(
".task-list-item input:checkbox"
).
on
(
is_checked
=
$
(
this
).
prop
(
"checked"
)
"click"
if
$
(
this
).
is
(
":checked"
)
null
state_event
=
"task_check"
"merge_request"
else
updateTaskState
state_event
=
"task_uncheck"
mr_url
=
$
(
"form.edit-merge_request"
).
first
().
attr
(
"action"
)
mr_num
=
mr_url
.
match
(
/\d+$/
)
task_num
=
0
$
(
"li.task-list-item input:checkbox"
).
each
(
(
index
,
e
)
=>
if
e
==
this
task_num
=
index
+
1
)
)
$
.
ajax
type
:
"PATCH"
url
:
mr_url
data
:
"merge_request[state_event]="
+
state_event
+
"&merge_request[task_num]="
+
task_num
activateTab
:
(
action
)
->
activateTab
:
(
action
)
->
this
.
$
(
'.merge-request-tabs li'
).
removeClass
'active'
this
.
$
(
'.merge-request-tabs li'
).
removeClass
'active'
this
.
$
(
'.tab-content'
).
hide
()
this
.
$
(
'.tab-content'
).
hide
()
...
...
features/project/issues/issues.feature
View file @
40263a06
...
@@ -144,7 +144,7 @@ Feature: Project Issues
...
@@ -144,7 +144,7 @@ Feature: Project Issues
Scenario
:
Issues list should display task status
Scenario
:
Issues list should display task status
Given
project
"Shop"
has
"Tasks-open"
open issue with task markdown
Given
project
"Shop"
has
"Tasks-open"
open issue with task markdown
When
I visit project
"Shop"
issues page
When
I visit project
"Shop"
issues page
Then
I should see the task status for
issue
"Tasks-open"
Then
I should see the task status for
the Taskable
# Toggling task items
# Toggling task items
...
...
features/project/merge_requests.feature
View file @
40263a06
...
@@ -170,11 +170,10 @@ Feature: Project Merge Requests
...
@@ -170,11 +170,10 @@ Feature: Project Merge Requests
# Task status in issues list
# Task status in issues list
@now
Scenario
:
Merge requests list should display task status
Scenario
:
Merge requests list should display task status
Given
project
"Shop"
has
"MR-task-open"
open MR with task markdown
Given
project
"Shop"
has
"MR-task-open"
open MR with task markdown
When
I visit project
"Shop"
merge requests page
When
I visit project
"Shop"
merge requests page
Then
I should see the task status for
merge request
"MR-task-open"
Then
I should see the task status for
the Taskable
# Toggling task items
# Toggling task items
...
...
features/steps/project/issues/issues.rb
View file @
40263a06
...
@@ -154,29 +154,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -154,29 +154,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
step
'project "Shop" has "Tasks-open" open issue with task markdown'
do
step
'project "Shop" has "Tasks-open" open issue with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
create_taskable
(
:issue
,
'Tasks-open'
)
* [ ] Task 1
* [x] Task 2
EOT
create
(
:issue
,
title:
'Tasks-open'
,
project:
project
,
author:
project
.
users
.
first
,
description:
desc_text
)
end
end
step
'project "Shop" has "Tasks-closed" closed issue with task markdown'
do
step
'project "Shop" has "Tasks-closed" closed issue with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
create_taskable
(
:closed_issue
,
'Tasks-closed'
)
* [ ] Task 1
* [x] Task 2
EOT
create
(
:closed_issue
,
title:
'Tasks-closed'
,
project:
project
,
author:
project
.
users
.
first
,
description:
desc_text
)
end
end
step
'empty project "Empty Project"'
do
step
'empty project "Empty Project"'
do
...
...
features/steps/project/merge_requests.rb
View file @
40263a06
...
@@ -98,17 +98,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -98,17 +98,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
end
step
'project "Shop" has "MR-task-open" open MR with task markdown'
do
step
'project "Shop" has "MR-task-open" open MR with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
create_taskable
(
:merge_request
,
'MR-task-open'
)
* [ ] Task 1
* [x] Task 2
EOT
create
(
:merge_request
,
title:
'MR-task-open'
,
source_project:
project
,
target_project:
project
,
author:
project
.
users
.
first
,
description:
desc_text
)
end
end
step
'I switch to the diff tab'
do
step
'I switch to the diff tab'
do
...
...
features/steps/shared/markdown.rb
View file @
40263a06
...
@@ -6,6 +6,27 @@ module SharedMarkdown
...
@@ -6,6 +6,27 @@ module SharedMarkdown
find
(
:css
,
"
#{
parent
}
h
#{
level
}
#
#{
id
}
> :last-child"
)[
:href
].
should
=~
/#
#{
id
}
$/
find
(
:css
,
"
#{
parent
}
h
#{
level
}
#
#{
id
}
> :last-child"
)[
:href
].
should
=~
/#
#{
id
}
$/
end
end
def
create_taskable
(
type
,
title
)
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
* [ ] Task 1
* [x] Task 2
EOT
case
type
when
:issue
,
:closed_issue
options
=
{
project:
project
}
when
:merge_request
options
=
{
source_project:
project
,
target_project:
project
}
end
create
(
type
,
options
.
merge
(
title:
title
,
author:
project
.
users
.
first
,
description:
desc_text
)
)
end
step
'Header "Description header" should have correct id and link'
do
step
'Header "Description header" should have correct id and link'
do
header_should_have_correct_id_and_link
(
1
,
'Description header'
,
'description-header'
)
header_should_have_correct_id_and_link
(
1
,
'Description header'
,
'description-header'
)
end
end
...
@@ -16,13 +37,7 @@ module SharedMarkdown
...
@@ -16,13 +37,7 @@ module SharedMarkdown
)
)
end
end
step
'I should see the task status for issue "Tasks-open"'
do
step
'I should see the task status for the Taskable'
do
expect
(
find
(
:css
,
'span.task-status'
).
text
).
to
eq
(
'2 tasks (1 done, 1 unfinished)'
)
end
step
'I should see the task status for merge request "MR-task-open"'
do
expect
(
find
(
:css
,
'span.task-status'
).
text
).
to
eq
(
expect
(
find
(
:css
,
'span.task-status'
).
text
).
to
eq
(
'2 tasks (1 done, 1 unfinished)'
'2 tasks (1 done, 1 unfinished)'
)
)
...
...
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