Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
cf1aa36a
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
cf1aa36a
编写于
10月 08, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7979 from mr-vinn/refactor-tasks
Refactor task list tests and coffeescript
上级
928178de
9dcb643f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
61 addition
and
82 deletion
+61
-82
app/assets/javascripts/behaviors/taskable.js.coffee
app/assets/javascripts/behaviors/taskable.js.coffee
+21
-0
app/assets/javascripts/issue.js.coffee
app/assets/javascripts/issue.js.coffee
+6
-20
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+7
-21
features/project/issues/issues.feature
features/project/issues/issues.feature
+1
-1
features/project/merge_requests.feature
features/project/merge_requests.feature
+1
-2
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+2
-20
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+1
-11
features/steps/shared/markdown.rb
features/steps/shared/markdown.rb
+22
-7
未找到文件。
app/assets/javascripts/behaviors/taskable.js.coffee
0 → 100644
浏览文件 @
cf1aa36a
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
浏览文件 @
cf1aa36a
...
...
@@ -9,25 +9,11 @@ class Issue
if
$
(
"a.btn-close"
).
length
$
(
"li.task-list-item input:checkbox"
).
prop
(
"disabled"
,
false
)
$
(
".task-list-item input:checkbox"
).
on
"click"
,
->
is_checked
=
$
(
this
).
prop
(
"checked"
)
if
$
(
this
).
is
(
":checked"
)
state_event
=
"task_check"
else
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
$
(
".task-list-item input:checkbox"
).
on
(
"click"
null
"issue"
updateTaskState
)
@
Issue
=
Issue
app/assets/javascripts/merge_request.js.coffee
浏览文件 @
cf1aa36a
...
...
@@ -17,7 +17,7 @@ class MergeRequest
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
)
# Local jQuery finder
...
...
@@ -74,26 +74,12 @@ class MergeRequest
this
.
$
(
'.remove_source_branch_in_progress'
).
hide
()
this
.
$
(
'.remove_source_branch_widget.failed'
).
show
()
this
.
$
(
".task-list-item input:checkbox"
).
on
"click"
,
->
is_checked
=
$
(
this
).
prop
(
"checked"
)
if
$
(
this
).
is
(
":checked"
)
state_event
=
"task_check"
else
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
$
(
".task-list-item input:checkbox"
).
on
(
"click"
null
"merge_request"
updateTaskState
)
activateTab
:
(
action
)
->
this
.
$
(
'.merge-request-tabs li'
).
removeClass
'active'
...
...
features/project/issues/issues.feature
浏览文件 @
cf1aa36a
...
...
@@ -144,7 +144,7 @@ Feature: Project Issues
Scenario
:
Issues list should display task status
Given
project
"Shop"
has
"Tasks-open"
open issue with task markdown
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
...
...
features/project/merge_requests.feature
浏览文件 @
cf1aa36a
...
...
@@ -168,11 +168,10 @@ Feature: Project Merge Requests
# Task status in issues list
@now
Scenario
:
Merge requests list should display task status
Given
project
"Shop"
has
"MR-task-open"
open MR with task markdown
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
...
...
features/steps/project/issues/issues.rb
浏览文件 @
cf1aa36a
...
...
@@ -154,29 +154,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step
'project "Shop" has "Tasks-open" open issue with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
* [ ] Task 1
* [x] Task 2
EOT
create
(
:issue
,
title:
'Tasks-open'
,
project:
project
,
author:
project
.
users
.
first
,
description:
desc_text
)
create_taskable
(
:issue
,
'Tasks-open'
)
end
step
'project "Shop" has "Tasks-closed" closed issue with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
* [ ] Task 1
* [x] Task 2
EOT
create
(
:closed_issue
,
title:
'Tasks-closed'
,
project:
project
,
author:
project
.
users
.
first
,
description:
desc_text
)
create_taskable
(
:closed_issue
,
'Tasks-closed'
)
end
step
'empty project "Empty Project"'
do
...
...
features/steps/project/merge_requests.rb
浏览文件 @
cf1aa36a
...
...
@@ -98,17 +98,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step
'project "Shop" has "MR-task-open" open MR with task markdown'
do
desc_text
=
<<
EOT
.
gsub
(
/^ {6}/
,
''
)
* [ ] 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
)
create_taskable
(
:merge_request
,
'MR-task-open'
)
end
step
'I switch to the diff tab'
do
...
...
features/steps/shared/markdown.rb
浏览文件 @
cf1aa36a
...
...
@@ -6,6 +6,27 @@ module SharedMarkdown
find
(
:css
,
"
#{
parent
}
h
#{
level
}
#
#{
id
}
> :last-child"
)[
:href
].
should
=~
/#
#{
id
}
$/
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
header_should_have_correct_id_and_link
(
1
,
'Description header'
,
'description-header'
)
end
...
...
@@ -16,13 +37,7 @@ module SharedMarkdown
)
end
step
'I should see the task status for issue "Tasks-open"'
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
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)'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录