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
eff1c121
Commit
eff1c121
authored
Sep 06, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backport boards specs
parent
ff73a4ea
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
104 additions
and
67 deletions
+104
-67
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+1
-1
spec/javascripts/boards/board_blank_state_spec.js
spec/javascripts/boards/board_blank_state_spec.js
+2
-1
spec/javascripts/boards/board_card_spec.js
spec/javascripts/boards/board_card_spec.js
+3
-2
spec/javascripts/boards/board_list_spec.js
spec/javascripts/boards/board_list_spec.js
+3
-1
spec/javascripts/boards/board_new_issue_spec.js
spec/javascripts/boards/board_new_issue_spec.js
+2
-1
spec/javascripts/boards/boards_store_spec.js
spec/javascripts/boards/boards_store_spec.js
+4
-2
spec/javascripts/boards/components/board_spec.js
spec/javascripts/boards/components/board_spec.js
+8
-2
spec/javascripts/boards/issue_card_spec.js
spec/javascripts/boards/issue_card_spec.js
+47
-48
spec/javascripts/boards/issue_spec.js
spec/javascripts/boards/issue_spec.js
+3
-1
spec/javascripts/boards/list_spec.js
spec/javascripts/boards/list_spec.js
+10
-5
spec/javascripts/boards/mock_data.js
spec/javascripts/boards/mock_data.js
+19
-3
spec/javascripts/boards/modal_store_spec.js
spec/javascripts/boards/modal_store_spec.js
+2
-0
No files found.
spec/javascripts/api_spec.js
View file @
eff1c121
...
...
@@ -145,7 +145,7 @@ describe('Api', () => {
});
});
f
describe
(
'
newLabel
'
,
()
=>
{
describe
(
'
newLabel
'
,
()
=>
{
it
(
'
creates a new label
'
,
(
done
)
=>
{
const
namespace
=
'
some namespace
'
;
const
project
=
'
some project
'
;
...
...
spec/javascripts/boards/board_blank_state_spec.js
View file @
eff1c121
/* global BoardService */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
'
~/boards/stores/boards_store
'
;
import
boardBlankState
from
'
~/boards/components/board_blank_state
'
;
...
...
@@ -12,7 +13,7 @@ describe('Boards blank state', () => {
const
Comp
=
Vue
.
extend
(
boardBlankState
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
spyOn
(
gl
.
boardService
,
'
generateDefaultLists
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
if
(
fail
)
{
...
...
spec/javascripts/boards/board_card_spec.js
View file @
eff1c121
...
...
@@ -4,6 +4,7 @@
/* global listObj */
/* global boardsMockInterceptor */
/* global BoardService */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
'
~/boards/models/assignee
'
;
...
...
@@ -14,13 +15,13 @@ import '~/boards/stores/boards_store';
import
boardCard
from
'
~/boards/components/board_card
'
;
import
'
./mock_data
'
;
describe
(
'
Issue
card
'
,
()
=>
{
describe
(
'
Board
card
'
,
()
=>
{
let
vm
;
beforeEach
((
done
)
=>
{
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
=
{};
...
...
spec/javascripts/boards/board_list_spec.js
View file @
eff1c121
...
...
@@ -3,6 +3,7 @@
/* global List */
/* global listObj */
/* global ListIssue */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
_
from
'
underscore
'
;
import
Sortable
from
'
vendor/Sortable
'
;
...
...
@@ -24,7 +25,7 @@ describe('Board list component', () => {
document
.
body
.
appendChild
(
el
);
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
IssueBoardsApp
=
new
Vue
();
...
...
@@ -32,6 +33,7 @@ describe('Board list component', () => {
const
list
=
new
List
(
listObj
);
const
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[],
...
...
spec/javascripts/boards/board_new_issue_spec.js
View file @
eff1c121
...
...
@@ -2,6 +2,7 @@
/* global BoardService */
/* global List */
/* global listObj */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
boardNewIssue
from
'
~/boards/components/board_new_issue
'
;
...
...
@@ -35,7 +36,7 @@ describe('Issue boards new issue form', () => {
const
BoardNewIssueComp
=
Vue
.
extend
(
boardNewIssue
);
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
IssueBoardsApp
=
new
Vue
();
...
...
spec/javascripts/boards/boards_store_spec.js
View file @
eff1c121
...
...
@@ -4,6 +4,7 @@
/* global listObj */
/* global listObjDuplicate */
/* global ListIssue */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
Cookies
from
'
js-cookie
'
;
...
...
@@ -20,7 +21,7 @@ import './mock_data';
describe
(
'
Store
'
,
()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
gl
.
issueBoards
.
BoardsStore
.
create
();
spyOn
(
gl
.
boardService
,
'
moveIssue
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
...
...
@@ -78,7 +79,7 @@ describe('Store', () => {
it
(
'
persists new list
'
,
(
done
)
=>
{
gl
.
issueBoards
.
BoardsStore
.
new
({
title
:
'
Test
'
,
type
:
'
label
'
,
list_
type
:
'
label
'
,
label
:
{
id
:
1
,
title
:
'
Testing
'
,
...
...
@@ -210,6 +211,7 @@ describe('Store', () => {
it
(
'
moves issue in list
'
,
(
done
)
=>
{
const
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
2
,
iid
:
2
,
confidential
:
false
,
labels
:
[],
...
...
spec/javascripts/boards/components/board_spec.js
View file @
eff1c121
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/components/board
'
;
import
'
~/boards/models/list
'
;
import
'
../mock_data
'
;
describe
(
'
Board component
'
,
()
=>
{
let
vm
;
...
...
@@ -13,8 +15,12 @@ describe('Board component', () => {
el
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
el
);
// eslint-disable-next-line no-undef
gl
.
boardService
=
new
BoardService
(
'
/
'
,
'
/
'
,
1
);
gl
.
boardService
=
mockBoardService
({
boardsEndpoint
:
'
/
'
,
listsEndpoint
:
'
/
'
,
bulkUpdatePath
:
'
/
'
,
boardId
:
1
,
});
vm
=
new
gl
.
issueBoards
.
Board
({
propsData
:
{
...
...
spec/javascripts/boards/issue_card_spec.js
View file @
eff1c121
...
...
@@ -37,6 +37,7 @@ describe('Issue card component', () => {
list
=
listObj
;
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[
list
.
label
],
...
...
@@ -238,65 +239,63 @@ describe('Issue card component', () => {
});
describe
(
'
labels
'
,
()
=>
{
describe
(
'
exists
'
,
()
=>
{
beforeEach
((
done
)
=>
{
component
.
issue
.
addLabel
(
label1
);
beforeEach
((
done
)
=>
{
component
.
issue
.
addLabel
(
label1
);
Vue
.
nextTick
(()
=>
done
());
});
Vue
.
nextTick
(()
=>
done
());
});
it
(
'
renders list label
'
,
()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
it
(
'
renders list label
'
,
()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
});
it
(
'
renders label
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
title
);
});
it
(
'
renders label
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
title
);
});
expect
(
nodes
.
includes
(
label1
.
description
),
).
toBe
(
true
);
});
expect
(
nodes
.
includes
(
label1
.
description
),
).
toBe
(
true
);
});
it
(
'
sets label description as title
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.label
'
).
getAttribute
(
'
title
'
),
).
toContain
(
label1
.
description
);
});
it
(
'
sets label description as title
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.label
'
).
getAttribute
(
'
title
'
),
).
toContain
(
label1
.
description
);
it
(
'
sets background color of button
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
style
.
backgroundColor
);
});
it
(
'
sets background color of button
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
style
.
backgroundColor
);
});
expect
(
nodes
.
includes
(
label1
.
color
),
).
toBe
(
true
);
});
expect
(
nodes
.
includes
(
label1
.
color
),
).
toBe
(
true
);
});
it
(
'
does not render label if label does not have an ID
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
title
:
'
closed
'
,
})
)
;
it
(
'
does not render label if label does not have an ID
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
title
:
'
closed
'
,
}));
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
expect
(
component
.
$el
.
textContent
,
).
not
.
toContain
(
'
closed
'
);
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
expect
(
component
.
$el
.
textContent
,
).
not
.
toContain
(
'
closed
'
);
done
();
})
.
catch
(
done
.
fail
);
});
done
();
})
.
catch
(
done
.
fail
);
});
});
});
spec/javascripts/boards/issue_spec.js
View file @
eff1c121
/* eslint-disable comma-dangle */
/* global BoardService */
/* global ListIssue */
/* global mockBoardService */
import
Vue
from
'
vue
'
;
import
'
~/lib/utils/url_utility
'
;
...
...
@@ -16,11 +17,12 @@ describe('Issue model', () => {
let
issue
;
beforeEach
(()
=>
{
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
(
);
gl
.
issueBoards
.
BoardsStore
.
create
();
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[{
...
...
spec/javascripts/boards/list_spec.js
View file @
eff1c121
/* eslint-disable comma-dangle */
/* global boardsMockInterceptor */
/* global BoardService */
/* global mockBoardService */
/* global List */
/* global ListIssue */
/* global listObj */
...
...
@@ -22,7 +23,9 @@ describe('List model', () => {
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
boardService
=
mockBoardService
({
bulkUpdatePath
:
'
/test/issue-boards/board/1/lists
'
,
});
gl
.
issueBoards
.
BoardsStore
.
create
();
list
=
new
List
(
listObj
);
...
...
@@ -92,6 +95,7 @@ describe('List model', () => {
const
listDup
=
new
List
(
listObjDuplicate
);
const
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
_
.
random
(
10000
),
iid
:
_
.
random
(
10000
),
confidential
:
false
,
labels
:
[
list
.
label
,
listDup
.
label
],
...
...
@@ -118,6 +122,7 @@ describe('List model', () => {
for
(
let
i
=
0
;
i
<
30
;
i
+=
1
)
{
list
.
issues
.
push
(
new
ListIssue
({
title
:
'
Testing
'
,
id
:
_
.
random
(
10000
)
+
i
,
iid
:
_
.
random
(
10000
)
+
i
,
confidential
:
false
,
labels
:
[
list
.
label
],
...
...
@@ -137,7 +142,7 @@ describe('List model', () => {
it
(
'
does not increase page number if issue count is less than the page size
'
,
()
=>
{
list
.
issues
.
push
(
new
ListIssue
({
title
:
'
Testing
'
,
i
i
d
:
_
.
random
(
10000
),
id
:
_
.
random
(
10000
),
confidential
:
false
,
labels
:
[
list
.
label
],
assignees
:
[],
...
...
@@ -156,7 +161,7 @@ describe('List model', () => {
spyOn
(
gl
.
boardService
,
'
newIssue
'
).
and
.
returnValue
(
Promise
.
resolve
({
json
()
{
return
{
i
i
d
:
42
,
id
:
42
,
};
},
}));
...
...
@@ -165,14 +170,14 @@ describe('List model', () => {
it
(
'
adds new issue to top of list
'
,
(
done
)
=>
{
list
.
issues
.
push
(
new
ListIssue
({
title
:
'
Testing
'
,
i
i
d
:
_
.
random
(
10000
),
id
:
_
.
random
(
10000
),
confidential
:
false
,
labels
:
[
list
.
label
],
assignees
:
[],
}));
const
dummyIssue
=
new
ListIssue
({
title
:
'
new issue
'
,
i
i
d
:
_
.
random
(
10000
),
id
:
_
.
random
(
10000
),
confidential
:
false
,
labels
:
[
list
.
label
],
assignees
:
[],
...
...
spec/javascripts/boards/mock_data.js
View file @
eff1c121
/* global BoardService */
/* eslint-disable comma-dangle, no-unused-vars, quote-props */
const
listObj
=
{
...
...
@@ -28,19 +29,19 @@ const listObjDuplicate = {
const
BoardsMockData
=
{
'
GET
'
:
{
'
/test/
issue-boards/board/1/lists
{/id}/issues
'
:
{
'
/test/
boards/1
{/id}/issues
'
:
{
issues
:
[{
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[],
assignees
:
[],
}],
size
:
1
}
},
'
POST
'
:
{
'
/test/
issue-boards/board/1/lists
{/id}
'
:
listObj
'
/test/
boards/1
{/id}
'
:
listObj
},
'
PUT
'
:
{
'
/test/issue-boards/board/1/lists{/id}
'
:
{}
...
...
@@ -58,7 +59,22 @@ const boardsMockInterceptor = (request, next) => {
}));
};
const
mockBoardService
=
(
opts
=
{})
=>
{
const
boardsEndpoint
=
opts
.
boardsEndpoint
||
'
/test/issue-boards/board
'
;
const
listsEndpoint
=
opts
.
listsEndpoint
||
'
/test/boards/1
'
;
const
bulkUpdatePath
=
opts
.
bulkUpdatePath
||
''
;
const
boardId
=
opts
.
boardId
||
'
1
'
;
return
new
BoardService
({
boardsEndpoint
,
listsEndpoint
,
bulkUpdatePath
,
boardId
,
});
};
window
.
listObj
=
listObj
;
window
.
listObjDuplicate
=
listObjDuplicate
;
window
.
BoardsMockData
=
BoardsMockData
;
window
.
boardsMockInterceptor
=
boardsMockInterceptor
;
window
.
mockBoardService
=
mockBoardService
;
spec/javascripts/boards/modal_store_spec.js
View file @
eff1c121
...
...
@@ -18,6 +18,7 @@ describe('Modal store', () => {
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
1
,
confidential
:
false
,
labels
:
[],
...
...
@@ -25,6 +26,7 @@ describe('Modal store', () => {
});
issue2
=
new
ListIssue
({
title
:
'
Testing
'
,
id
:
1
,
iid
:
2
,
confidential
:
false
,
labels
:
[],
...
...
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