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
Jérome Perrin
gitlab-ce
Commits
c28d52a3
Commit
c28d52a3
authored
Sep 06, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FE backport of group boards to reduce CE conflicts
parent
b9aa55e1
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
116 additions
and
53 deletions
+116
-53
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+10
-4
app/assets/javascripts/boards/boards_bundle.js
app/assets/javascripts/boards/boards_bundle.js
+33
-18
app/assets/javascripts/boards/components/board_list.js
app/assets/javascripts/boards/components/board_list.js
+4
-6
app/assets/javascripts/boards/components/board_new_issue.js
app/assets/javascripts/boards/components/board_new_issue.js
+4
-1
app/assets/javascripts/boards/components/issue_card_inner.js
app/assets/javascripts/boards/components/issue_card_inner.js
+5
-2
app/assets/javascripts/boards/components/modal/footer.js
app/assets/javascripts/boards/components/modal/footer.js
+1
-1
app/assets/javascripts/boards/components/new_list_dropdown.js
...assets/javascripts/boards/components/new_list_dropdown.js
+1
-1
app/assets/javascripts/boards/components/sidebar/remove_issue.js
...ets/javascripts/boards/components/sidebar/remove_issue.js
+19
-4
app/assets/javascripts/boards/models/issue.js
app/assets/javascripts/boards/models/issue.js
+2
-2
app/assets/javascripts/boards/models/label.js
app/assets/javascripts/boards/models/label.js
+1
-0
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/models/list.js
+14
-13
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+22
-1
No files found.
app/assets/javascripts/api.js
View file @
c28d52a3
...
@@ -6,7 +6,8 @@ const Api = {
...
@@ -6,7 +6,8 @@ const Api = {
namespacesPath
:
'
/api/:version/namespaces.json
'
,
namespacesPath
:
'
/api/:version/namespaces.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
projectsPath
:
'
/api/:version/projects.json
'
,
projectsPath
:
'
/api/:version/projects.json
'
,
labelsPath
:
'
/:namespace_path/:project_path/labels
'
,
projectLabelsPath
:
'
/:namespace_path/:project_path/labels
'
,
groupLabelsPath
:
'
/groups/:namespace_path/labels
'
,
licensePath
:
'
/api/:version/templates/licenses/:key
'
,
licensePath
:
'
/api/:version/templates/licenses/:key
'
,
gitignorePath
:
'
/api/:version/templates/gitignores/:key
'
,
gitignorePath
:
'
/api/:version/templates/gitignores/:key
'
,
gitlabCiYmlPath
:
'
/api/:version/templates/gitlab_ci_ymls/:key
'
,
gitlabCiYmlPath
:
'
/api/:version/templates/gitlab_ci_ymls/:key
'
,
...
@@ -74,9 +75,14 @@ const Api = {
...
@@ -74,9 +75,14 @@ const Api = {
},
},
newLabel
(
namespacePath
,
projectPath
,
data
,
callback
)
{
newLabel
(
namespacePath
,
projectPath
,
data
,
callback
)
{
const
url
=
Api
.
buildUrl
(
Api
.
labelsPath
)
let
url
;
.
replace
(
'
:namespace_path
'
,
namespacePath
)
if
(
projectPath
)
{
.
replace
(
'
:project_path
'
,
projectPath
);
url
=
Api
.
buildUrl
(
Api
.
projectLabelsPath
)
.
replace
(
'
:namespace_path
'
,
namespacePath
)
.
replace
(
'
:project_path
'
,
projectPath
);
}
else
{
url
=
Api
.
buildUrl
(
Api
.
groupLabelsPath
).
replace
(
'
:namespace_path
'
,
namespacePath
);
}
return
$
.
ajax
({
return
$
.
ajax
({
url
,
url
,
type
:
'
POST
'
,
type
:
'
POST
'
,
...
...
app/assets/javascripts/boards/boards_bundle.js
View file @
c28d52a3
...
@@ -53,7 +53,8 @@ $(() => {
...
@@ -53,7 +53,8 @@ $(() => {
data
:
{
data
:
{
state
:
Store
.
state
,
state
:
Store
.
state
,
loading
:
true
,
loading
:
true
,
endpoint
:
$boardApp
.
dataset
.
endpoint
,
boardsEndpoint
:
$boardApp
.
dataset
.
boardsEndpoint
,
listsEndpoint
:
$boardApp
.
dataset
.
listsEndpoint
,
boardId
:
$boardApp
.
dataset
.
boardId
,
boardId
:
$boardApp
.
dataset
.
boardId
,
disabled
:
$boardApp
.
dataset
.
disabled
===
'
true
'
,
disabled
:
$boardApp
.
dataset
.
disabled
===
'
true
'
,
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
issueLinkBase
:
$boardApp
.
dataset
.
issueLinkBase
,
...
@@ -68,7 +69,13 @@ $(() => {
...
@@ -68,7 +69,13 @@ $(() => {
},
},
},
},
created
()
{
created
()
{
gl
.
boardService
=
new
BoardService
(
this
.
endpoint
,
this
.
bulkUpdatePath
,
this
.
boardId
);
gl
.
boardService
=
new
BoardService
({
boardsEndpoint
:
this
.
boardsEndpoint
,
listsEndpoint
:
this
.
listsEndpoint
,
bulkUpdatePath
:
this
.
bulkUpdatePath
,
boardId
:
this
.
boardId
,
});
Store
.
rootPath
=
this
.
boardsEndpoint
;
this
.
filterManager
=
new
FilteredSearchBoards
(
Store
.
filter
,
true
);
this
.
filterManager
=
new
FilteredSearchBoards
(
Store
.
filter
,
true
);
this
.
filterManager
.
setup
();
this
.
filterManager
.
setup
();
...
@@ -112,19 +119,21 @@ $(() => {
...
@@ -112,19 +119,21 @@ $(() => {
gl
.
IssueBoardsSearch
=
new
Vue
({
gl
.
IssueBoardsSearch
=
new
Vue
({
el
:
document
.
getElementById
(
'
js-add-list
'
),
el
:
document
.
getElementById
(
'
js-add-list
'
),
data
:
{
data
:
{
filters
:
Store
.
state
.
filters
filters
:
Store
.
state
.
filters
,
},
},
mounted
()
{
mounted
()
{
gl
.
issueBoards
.
newListDropdownInit
();
gl
.
issueBoards
.
newListDropdownInit
();
}
}
,
});
});
gl
.
IssueBoardsModalAddBtn
=
new
Vue
({
gl
.
IssueBoardsModalAddBtn
=
new
Vue
({
mixins
:
[
gl
.
issueBoards
.
ModalMixins
],
mixins
:
[
gl
.
issueBoards
.
ModalMixins
],
el
:
document
.
getElementById
(
'
js-add-issues-btn
'
),
el
:
document
.
getElementById
(
'
js-add-issues-btn
'
),
data
:
{
data
()
{
modal
:
ModalStore
.
store
,
return
{
store
:
Store
.
state
,
modal
:
ModalStore
.
store
,
store
:
Store
.
state
,
};
},
},
watch
:
{
watch
:
{
disabled
()
{
disabled
()
{
...
@@ -133,6 +142,9 @@ $(() => {
...
@@ -133,6 +142,9 @@ $(() => {
},
},
computed
:
{
computed
:
{
disabled
()
{
disabled
()
{
if
(
!
this
.
store
)
{
return
true
;
}
return
!
this
.
store
.
lists
.
filter
(
list
=>
!
list
.
preset
).
length
;
return
!
this
.
store
.
lists
.
filter
(
list
=>
!
list
.
preset
).
length
;
},
},
tooltipTitle
()
{
tooltipTitle
()
{
...
@@ -145,7 +157,7 @@ $(() => {
...
@@ -145,7 +157,7 @@ $(() => {
},
},
methods
:
{
methods
:
{
updateTooltip
()
{
updateTooltip
()
{
const
$tooltip
=
$
(
this
.
$
el
);
const
$tooltip
=
$
(
this
.
$
refs
.
addIssuesButton
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
disabled
)
{
if
(
this
.
disabled
)
{
...
@@ -165,16 +177,19 @@ $(() => {
...
@@ -165,16 +177,19 @@ $(() => {
this
.
updateTooltip
();
this
.
updateTooltip
();
},
},
template
:
`
template
:
`
<button
<div class="board-extra-actions">
class="btn btn-create pull-right prepend-left-10"
<button
type="button"
class="btn btn-create prepend-left-10"
data-placement="bottom"
type="button"
:class="{ 'disabled': disabled }"
data-placement="bottom"
:title="tooltipTitle"
ref="addIssuesButton"
:aria-disabled="disabled"
:class="{ 'disabled': disabled }"
@click="openModal">
:title="tooltipTitle"
Add issues
:aria-disabled="disabled"
</button>
@click="openModal">
Add issues
</button>
</div>
`
,
`
,
});
});
});
});
app/assets/javascripts/boards/components/board_list.js
View file @
c28d52a3
...
@@ -77,7 +77,7 @@ export default {
...
@@ -77,7 +77,7 @@ export default {
this
.
showIssueForm
=
!
this
.
showIssueForm
;
this
.
showIssueForm
=
!
this
.
showIssueForm
;
},
},
onScroll
()
{
onScroll
()
{
if
(
(
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
&&
!
this
.
list
.
loadingMore
)
{
if
(
!
this
.
loadingMore
&&
(
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
)
{
this
.
loadNextPage
();
this
.
loadNextPage
();
}
}
},
},
...
@@ -165,11 +165,9 @@ export default {
...
@@ -165,11 +165,9 @@ export default {
v-if="loading">
v-if="loading">
<loading-icon />
<loading-icon />
</div>
</div>
<transition name="slide-down">
<board-new-issue
<board-new-issue
:list="list"
:list="list"
v-if="list.type !== 'closed' && showIssueForm"/>
v-if="list.type !== 'closed' && showIssueForm"/>
</transition>
<ul
<ul
class="board-list"
class="board-list"
v-show="!loading"
v-show="!loading"
...
...
app/assets/javascripts/boards/components/board_new_issue.js
View file @
c28d52a3
...
@@ -6,7 +6,10 @@ const Store = gl.issueBoards.BoardsStore;
...
@@ -6,7 +6,10 @@ const Store = gl.issueBoards.BoardsStore;
export
default
{
export
default
{
name
:
'
BoardNewIssue
'
,
name
:
'
BoardNewIssue
'
,
props
:
{
props
:
{
list
:
Object
,
list
:
{
type
:
Object
,
required
:
true
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
...
app/assets/javascripts/boards/components/issue_card_inner.js
View file @
c28d52a3
...
@@ -67,7 +67,10 @@ gl.issueBoards.IssueCardInner = Vue.extend({
...
@@ -67,7 +67,10 @@ gl.issueBoards.IssueCardInner = Vue.extend({
return
`
${
this
.
issueLinkBase
}
/
${
this
.
issue
.
id
}
`
;
return
`
${
this
.
issueLinkBase
}
/
${
this
.
issue
.
id
}
`
;
},
},
issueId
()
{
issueId
()
{
return
`#
${
this
.
issue
.
id
}
`
;
if
(
this
.
issue
.
iid
)
{
return
`#
${
this
.
issue
.
iid
}
`
;
}
return
false
;
},
},
showLabelFooter
()
{
showLabelFooter
()
{
return
this
.
issue
.
labels
.
find
(
l
=>
this
.
showLabel
(
l
))
!==
undefined
;
return
this
.
issue
.
labels
.
find
(
l
=>
this
.
showLabel
(
l
))
!==
undefined
;
...
@@ -143,7 +146,7 @@ gl.issueBoards.IssueCardInner = Vue.extend({
...
@@ -143,7 +146,7 @@ gl.issueBoards.IssueCardInner = Vue.extend({
:title="issue.title">{{ issue.title }}</a>
:title="issue.title">{{ issue.title }}</a>
<span
<span
class="card-number"
class="card-number"
v-if="issue
.i
d"
v-if="issue
I
d"
>
>
{{ issueId }}
{{ issueId }}
</span>
</span>
...
...
app/assets/javascripts/boards/components/modal/footer.js
View file @
c28d52a3
...
@@ -29,7 +29,7 @@ gl.issueBoards.ModalFooter = Vue.extend({
...
@@ -29,7 +29,7 @@ gl.issueBoards.ModalFooter = Vue.extend({
const
firstListIndex
=
1
;
const
firstListIndex
=
1
;
const
list
=
this
.
modal
.
selectedList
||
this
.
state
.
lists
[
firstListIndex
];
const
list
=
this
.
modal
.
selectedList
||
this
.
state
.
lists
[
firstListIndex
];
const
selectedIssues
=
ModalStore
.
getSelectedIssues
();
const
selectedIssues
=
ModalStore
.
getSelectedIssues
();
const
issueIds
=
selectedIssues
.
map
(
issue
=>
issue
.
globalI
d
);
const
issueIds
=
selectedIssues
.
map
(
issue
=>
issue
.
i
d
);
// Post the data to the backend
// Post the data to the backend
gl
.
boardService
.
bulkUpdate
(
issueIds
,
{
gl
.
boardService
.
bulkUpdate
(
issueIds
,
{
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js
View file @
c28d52a3
...
@@ -27,7 +27,7 @@ gl.issueBoards.newListDropdownInit = () => {
...
@@ -27,7 +27,7 @@ gl.issueBoards.newListDropdownInit = () => {
$this
.
glDropdown
({
$this
.
glDropdown
({
data
(
term
,
callback
)
{
data
(
term
,
callback
)
{
$
.
get
(
$this
.
attr
(
'
data-l
abels
'
))
$
.
get
(
$this
.
attr
(
'
data-l
ist-labels-path
'
))
.
then
((
resp
)
=>
{
.
then
((
resp
)
=>
{
callback
(
resp
);
callback
(
resp
);
});
});
...
...
app/assets/javascripts/boards/components/sidebar/remove_issue.js
View file @
c28d52a3
...
@@ -18,17 +18,32 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
...
@@ -18,17 +18,32 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
issueUpdate
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
updateUrl
()
{
return
this
.
issueUpdate
;
},
},
},
methods
:
{
methods
:
{
removeIssue
()
{
removeIssue
()
{
const
issue
=
this
.
issue
;
const
issue
=
this
.
issue
;
const
lists
=
issue
.
getLists
();
const
lists
=
issue
.
getLists
();
const
labelIds
=
lists
.
map
(
list
=>
list
.
label
.
id
);
const
listLabelIds
=
lists
.
map
(
list
=>
list
.
label
.
id
);
const
labelIds
=
this
.
issue
.
labels
.
map
(
label
=>
label
.
id
)
.
filter
(
id
=>
!
listLabelIds
.
includes
(
id
));
// Post the remove data
// Post the remove data
gl
.
boardService
.
bulkUpdate
([
issue
.
globalId
],
{
const
data
=
{
remove_label_ids
:
labelIds
,
issue
:
{
}).
catch
(()
=>
{
label_ids
:
labelIds
,
},
};
Vue
.
http
.
patch
(
this
.
updateUrl
,
data
).
catch
(()
=>
{
new
Flash
(
'
Failed to remove issue from board, please try again.
'
,
'
alert
'
);
new
Flash
(
'
Failed to remove issue from board, please try again.
'
,
'
alert
'
);
lists
.
forEach
((
list
)
=>
{
lists
.
forEach
((
list
)
=>
{
...
...
app/assets/javascripts/boards/models/issue.js
View file @
c28d52a3
...
@@ -7,8 +7,8 @@ import Vue from 'vue';
...
@@ -7,8 +7,8 @@ import Vue from 'vue';
class
ListIssue
{
class
ListIssue
{
constructor
(
obj
,
defaultAvatar
)
{
constructor
(
obj
,
defaultAvatar
)
{
this
.
globalI
d
=
obj
.
id
;
this
.
i
d
=
obj
.
id
;
this
.
id
=
obj
.
iid
;
this
.
i
i
d
=
obj
.
iid
;
this
.
title
=
obj
.
title
;
this
.
title
=
obj
.
title
;
this
.
confidential
=
obj
.
confidential
;
this
.
confidential
=
obj
.
confidential
;
this
.
dueDate
=
obj
.
due_date
;
this
.
dueDate
=
obj
.
due_date
;
...
...
app/assets/javascripts/boards/models/label.js
View file @
c28d52a3
...
@@ -4,6 +4,7 @@ class ListLabel {
...
@@ -4,6 +4,7 @@ class ListLabel {
constructor
(
obj
)
{
constructor
(
obj
)
{
this
.
id
=
obj
.
id
;
this
.
id
=
obj
.
id
;
this
.
title
=
obj
.
title
;
this
.
title
=
obj
.
title
;
this
.
type
=
obj
.
type
;
this
.
color
=
obj
.
color
;
this
.
color
=
obj
.
color
;
this
.
textColor
=
obj
.
text_color
;
this
.
textColor
=
obj
.
text_color
;
this
.
description
=
obj
.
description
;
this
.
description
=
obj
.
description
;
...
...
app/assets/javascripts/boards/models/list.js
View file @
c28d52a3
...
@@ -110,11 +110,12 @@ class List {
...
@@ -110,11 +110,12 @@ class List {
return
gl
.
boardService
.
newIssue
(
this
.
id
,
issue
)
return
gl
.
boardService
.
newIssue
(
this
.
id
,
issue
)
.
then
(
resp
=>
resp
.
json
())
.
then
(
resp
=>
resp
.
json
())
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
issue
.
id
=
data
.
iid
;
issue
.
id
=
data
.
id
;
issue
.
iid
=
data
.
iid
;
if
(
this
.
issuesSize
>
1
)
{
if
(
this
.
issuesSize
>
1
)
{
const
moveBeforeI
i
d
=
this
.
issues
[
1
].
id
;
const
moveBeforeId
=
this
.
issues
[
1
].
id
;
gl
.
boardService
.
moveIssue
(
issue
.
id
,
null
,
null
,
null
,
moveBeforeI
i
d
);
gl
.
boardService
.
moveIssue
(
issue
.
id
,
null
,
null
,
null
,
moveBeforeId
);
}
}
});
});
}
}
...
@@ -126,19 +127,19 @@ class List {
...
@@ -126,19 +127,19 @@ class List {
}
}
addIssue
(
issue
,
listFrom
,
newIndex
)
{
addIssue
(
issue
,
listFrom
,
newIndex
)
{
let
moveBeforeI
i
d
=
null
;
let
moveBeforeId
=
null
;
let
moveAfterI
i
d
=
null
;
let
moveAfterId
=
null
;
if
(
!
this
.
findIssue
(
issue
.
id
))
{
if
(
!
this
.
findIssue
(
issue
.
id
))
{
if
(
newIndex
!==
undefined
)
{
if
(
newIndex
!==
undefined
)
{
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
if
(
this
.
issues
[
newIndex
-
1
])
{
if
(
this
.
issues
[
newIndex
-
1
])
{
moveBeforeI
i
d
=
this
.
issues
[
newIndex
-
1
].
id
;
moveBeforeId
=
this
.
issues
[
newIndex
-
1
].
id
;
}
}
if
(
this
.
issues
[
newIndex
+
1
])
{
if
(
this
.
issues
[
newIndex
+
1
])
{
moveAfterI
i
d
=
this
.
issues
[
newIndex
+
1
].
id
;
moveAfterId
=
this
.
issues
[
newIndex
+
1
].
id
;
}
}
}
else
{
}
else
{
this
.
issues
.
push
(
issue
);
this
.
issues
.
push
(
issue
);
...
@@ -151,30 +152,30 @@ class List {
...
@@ -151,30 +152,30 @@ class List {
if
(
listFrom
)
{
if
(
listFrom
)
{
this
.
issuesSize
+=
1
;
this
.
issuesSize
+=
1
;
this
.
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeI
id
,
moveAfterIi
d
);
this
.
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeI
d
,
moveAfterI
d
);
}
}
}
}
}
}
moveIssue
(
issue
,
oldIndex
,
newIndex
,
moveBeforeI
id
,
moveAfterIi
d
)
{
moveIssue
(
issue
,
oldIndex
,
newIndex
,
moveBeforeI
d
,
moveAfterI
d
)
{
this
.
issues
.
splice
(
oldIndex
,
1
);
this
.
issues
.
splice
(
oldIndex
,
1
);
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
this
.
issues
.
splice
(
newIndex
,
0
,
issue
);
gl
.
boardService
.
moveIssue
(
issue
.
id
,
null
,
null
,
moveBeforeI
id
,
moveAfterIi
d
)
gl
.
boardService
.
moveIssue
(
issue
.
id
,
null
,
null
,
moveBeforeI
d
,
moveAfterI
d
)
.
catch
(()
=>
{
.
catch
(()
=>
{
// TODO: handle request error
// TODO: handle request error
});
});
}
}
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeI
id
,
moveAfterIi
d
)
{
updateIssueLabel
(
issue
,
listFrom
,
moveBeforeI
d
,
moveAfterI
d
)
{
gl
.
boardService
.
moveIssue
(
issue
.
id
,
listFrom
.
id
,
this
.
id
,
moveBeforeI
id
,
moveAfterIi
d
)
gl
.
boardService
.
moveIssue
(
issue
.
id
,
listFrom
.
id
,
this
.
id
,
moveBeforeI
d
,
moveAfterI
d
)
.
catch
(()
=>
{
.
catch
(()
=>
{
// TODO: handle request error
// TODO: handle request error
});
});
}
}
findIssue
(
id
)
{
findIssue
(
id
)
{
return
this
.
issues
.
fi
lter
(
issue
=>
issue
.
id
===
id
)[
0
]
;
return
this
.
issues
.
fi
nd
(
issue
=>
issue
.
id
===
id
)
;
}
}
removeIssue
(
removeIssue
)
{
removeIssue
(
removeIssue
)
{
...
...
spec/javascripts/api_spec.js
View file @
c28d52a3
...
@@ -145,7 +145,7 @@ describe('Api', () => {
...
@@ -145,7 +145,7 @@ describe('Api', () => {
});
});
});
});
describe
(
'
newLabel
'
,
()
=>
{
f
describe
(
'
newLabel
'
,
()
=>
{
it
(
'
creates a new label
'
,
(
done
)
=>
{
it
(
'
creates a new label
'
,
(
done
)
=>
{
const
namespace
=
'
some namespace
'
;
const
namespace
=
'
some namespace
'
;
const
project
=
'
some project
'
;
const
project
=
'
some project
'
;
...
@@ -167,6 +167,27 @@ describe('Api', () => {
...
@@ -167,6 +167,27 @@ describe('Api', () => {
done
();
done
();
});
});
});
});
it
(
'
creates a new group label
'
,
(
done
)
=>
{
const
namespace
=
'
some namespace
'
;
const
labelData
=
{
some
:
'
data
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/
${
namespace
}
/labels`
;
const
expectedData
=
{
label
:
labelData
,
};
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
((
request
)
=>
{
expect
(
request
.
url
).
toEqual
(
expectedUrl
);
expect
(
request
.
dataType
).
toEqual
(
'
json
'
);
expect
(
request
.
type
).
toEqual
(
'
POST
'
);
expect
(
request
.
data
).
toEqual
(
expectedData
);
return
sendDummyResponse
();
});
Api
.
newLabel
(
namespace
,
null
,
labelData
,
(
response
)
=>
{
expect
(
response
).
toBe
(
dummyResponse
);
done
();
});
});
});
});
describe
(
'
groupProjects
'
,
()
=>
{
describe
(
'
groupProjects
'
,
()
=>
{
...
...
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