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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0431657f
Commit
0431657f
authored
May 02, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add karma tests
parent
f2f7ef9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
1 deletion
+55
-1
spec/javascripts/boards/issue_spec.js
spec/javascripts/boards/issue_spec.js
+55
-1
No files found.
spec/javascripts/boards/issue_spec.js
View file @
0431657f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global BoardService */
/* global BoardService */
/* global ListIssue */
/* global ListIssue */
import
Vue
from
'
vue
'
;
import
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/url_utility
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/label
'
;
import
'
~/boards/models/label
'
;
...
@@ -28,7 +29,12 @@ describe('Issue model', () => {
...
@@ -28,7 +29,12 @@ describe('Issue model', () => {
color
:
'
red
'
,
color
:
'
red
'
,
description
:
'
testing
'
description
:
'
testing
'
}],
}],
assignees
:
[],
assignees
:
[{
id
:
1
,
name
:
'
name
'
,
username
:
'
username
'
,
avatar_url
:
'
http://avatar_url
'
,
}],
});
});
});
});
...
@@ -81,6 +87,33 @@ describe('Issue model', () => {
...
@@ -81,6 +87,33 @@ describe('Issue model', () => {
expect
(
issue
.
labels
.
length
).
toBe
(
0
);
expect
(
issue
.
labels
.
length
).
toBe
(
0
);
});
});
it
(
'
adds assignee
'
,
()
=>
{
issue
.
addAssignee
({
id
:
2
,
name
:
'
Bruce Wayne
'
,
username
:
'
batman
'
,
avatar_url
:
'
http://batman
'
,
});
expect
(
issue
.
assignees
.
length
).
toBe
(
2
);
});
it
(
'
finds assignee
'
,
()
=>
{
const
assignee
=
issue
.
findAssignee
(
issue
.
assignees
[
0
]);
expect
(
assignee
).
toBeDefined
();
});
it
(
'
removes assignee
'
,
()
=>
{
const
assignee
=
issue
.
findAssignee
(
issue
.
assignees
[
0
]);
issue
.
removeAssignee
(
assignee
);
expect
(
issue
.
assignees
.
length
).
toBe
(
0
);
});
it
(
'
removes all assignees
'
,
()
=>
{
issue
.
removeAllAssignees
();
expect
(
issue
.
assignees
.
length
).
toBe
(
0
);
});
it
(
'
sets position to infinity if no position is stored
'
,
()
=>
{
it
(
'
sets position to infinity if no position is stored
'
,
()
=>
{
expect
(
issue
.
position
).
toBe
(
Infinity
);
expect
(
issue
.
position
).
toBe
(
Infinity
);
});
});
...
@@ -97,4 +130,25 @@ describe('Issue model', () => {
...
@@ -97,4 +130,25 @@ describe('Issue model', () => {
expect
(
relativePositionIssue
.
position
).
toBe
(
1
);
expect
(
relativePositionIssue
.
position
).
toBe
(
1
);
});
});
describe
(
'
update
'
,
()
=>
{
it
(
'
passes assignee ids when there are assignees
'
,
(
done
)
=>
{
spyOn
(
Vue
.
http
,
'
patch
'
).
and
.
callFake
((
url
,
data
)
=>
{
expect
(
data
.
issue
.
assignee_ids
).
toEqual
([
1
]);
done
();
});
issue
.
update
(
'
url
'
);
});
it
(
'
passes assignee ids of [0] when there are no assignees
'
,
(
done
)
=>
{
spyOn
(
Vue
.
http
,
'
patch
'
).
and
.
callFake
((
url
,
data
)
=>
{
expect
(
data
.
issue
.
assignee_ids
).
toEqual
([
0
]);
done
();
});
issue
.
removeAllAssignees
();
issue
.
update
(
'
url
'
);
});
});
});
});
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