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
Tatuya Kamada
gitlab-ce
Commits
3369232c
Commit
3369232c
authored
Mar 28, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for board list component
parent
4917df5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
210 additions
and
6 deletions
+210
-6
app/assets/javascripts/boards/components/board.js
app/assets/javascripts/boards/components/board.js
+1
-2
app/assets/javascripts/boards/components/board_list.js
app/assets/javascripts/boards/components/board_list.js
+8
-4
spec/javascripts/boards/board_list_spec.js
spec/javascripts/boards/board_list_spec.js
+201
-0
No files found.
app/assets/javascripts/boards/components/board.js
View file @
3369232c
/* eslint-disable comma-dangle, space-before-function-paren, one-var */
/* eslint-disable comma-dangle, space-before-function-paren, one-var */
/* global Sortable */
/* global Sortable */
import
boardList
from
'
./board_list
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
boardList
from
'
./board_list
'
;
import
boardBlankState
from
'
./board_blank_state
'
;
import
boardBlankState
from
'
./board_blank_state
'
;
require
(
'
./board_delete
'
);
require
(
'
./board_delete
'
);
...
...
app/assets/javascripts/boards/components/board_list.js
View file @
3369232c
/* global Sortable */
/* global Sortable */
import
Vue
from
'
vue
'
;
import
boardNewIssue
from
'
./board_new_issue
'
;
import
boardNewIssue
from
'
./board_new_issue
'
;
import
boardCard
from
'
./board_card
'
;
import
boardCard
from
'
./board_card
'
;
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
...
@@ -12,8 +10,12 @@ export default {
...
@@ -12,8 +10,12 @@ export default {
<div class="board-list-component">
<div class="board-list-component">
<div
<div
class="board-list-loading text-center"
class="board-list-loading text-center"
aria-label="Loading issues"
v-if="loading">
v-if="loading">
<i class="fa fa-spinner fa-spin"></i>
<i
class="fa fa-spinner fa-spin"
aria-hidden="true">
</i>
</div>
</div>
<board-new-issue
<board-new-issue
:list="list"
:list="list"
...
@@ -40,10 +42,12 @@ export default {
...
@@ -40,10 +42,12 @@ export default {
data-id="-1">
data-id="-1">
<i
<i
class="fa fa-spinner fa-spin"
class="fa fa-spinner fa-spin"
aria-label="Loading more issues"
aria-hidden="true"
v-show="list.loadingMore">
v-show="list.loadingMore">
</i>
</i>
<span v-if="list.issues.length === list.issuesSize">
<span v-if="list.issues.length === list.issuesSize">
Show all issues
Show
ing
all issues
</span>
</span>
<span v-else>
<span v-else>
Showing {{ list.issues.length }} of {{ list.issuesSize }} issues
Showing {{ list.issues.length }} of {{ list.issuesSize }} issues
...
...
spec/javascripts/boards/board_list_spec.js
0 → 100644
View file @
3369232c
/* global BoardService */
/* global boardsMockInterceptor */
/* global List */
/* global listObj */
/* global ListIssue */
import
Vue
from
'
vue
'
;
import
_
from
'
underscore
'
;
import
Sortable
from
'
vendor/Sortable
'
;
import
BoardList
from
'
~/boards/components/board_list
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
'
~/boards/mixins/sortable_default_options
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/stores/boards_store
'
;
import
'
./mock_data
'
;
window
.
Sortable
=
Sortable
;
describe
(
'
Board list component
'
,
()
=>
{
let
component
;
beforeEach
((
done
)
=>
{
const
el
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
el
);
Vue
.
http
.
interceptors
.
push
(
boardsMockInterceptor
);
gl
.
boardService
=
new
BoardService
(
'
/test/issue-boards/board
'
,
''
,
'
1
'
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
IssueBoardsApp
=
new
Vue
();
const
BoardListComp
=
Vue
.
extend
(
BoardList
);
const
list
=
new
List
(
listObj
);
const
issue
=
new
ListIssue
({
title
:
'
Testing
'
,
iid
:
1
,
confidential
:
false
,
labels
:
[],
});
list
.
issuesSize
=
1
;
list
.
issues
.
push
(
issue
);
component
=
new
BoardListComp
({
el
,
propsData
:
{
disabled
:
false
,
list
,
issues
:
list
.
issues
,
loading
:
false
,
issueLinkBase
:
'
/issues
'
,
rootPath
:
'
/
'
,
},
}).
$mount
();
Vue
.
nextTick
(()
=>
{
done
();
});
});
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
boardsMockInterceptor
);
});
it
(
'
renders component
'
,
()
=>
{
expect
(
component
.
$el
.
classList
.
contains
(
'
board-list-component
'
),
).
toBe
(
true
);
});
it
(
'
renders loading icon
'
,
(
done
)
=>
{
component
.
loading
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-list-loading
'
),
).
not
.
toBeNull
();
done
();
});
});
it
(
'
renders issues
'
,
()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.card
'
).
length
,
).
toBe
(
1
);
});
it
(
'
sets data attribute with issue id
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.card
'
).
getAttribute
(
'
data-issue-id
'
),
).
toBe
(
'
1
'
);
});
it
(
'
shows new issue form
'
,
(
done
)
=>
{
component
.
toggleForm
();
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-new-issue-form
'
),
).
not
.
toBeNull
();
expect
(
component
.
$el
.
querySelector
(
'
.is-smaller
'
),
).
not
.
toBeNull
();
done
();
});
});
it
(
'
shows new issue form after eventhub event
'
,
(
done
)
=>
{
eventHub
.
$emit
(
`hide-issue-form-
${
component
.
list
.
id
}
`
);
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-new-issue-form
'
),
).
not
.
toBeNull
();
expect
(
component
.
$el
.
querySelector
(
'
.is-smaller
'
),
).
not
.
toBeNull
();
done
();
});
});
it
(
'
does not show new issue form for closed list
'
,
(
done
)
=>
{
component
.
list
.
type
=
'
closed
'
;
component
.
toggleForm
();
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-new-issue-form
'
),
).
toBeNull
();
done
();
});
});
it
(
'
shows count list item
'
,
(
done
)
=>
{
component
.
showCount
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-list-count
'
),
).
not
.
toBeNull
();
expect
(
component
.
$el
.
querySelector
(
'
.board-list-count
'
).
textContent
.
trim
(),
).
toBe
(
'
Showing all issues
'
);
done
();
});
});
it
(
'
shows how many more issues to load
'
,
(
done
)
=>
{
component
.
showCount
=
true
;
component
.
list
.
issuesSize
=
20
;
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-list-count
'
).
textContent
.
trim
(),
).
toBe
(
'
Showing 1 of 20 issues
'
);
done
();
});
});
it
(
'
loads more issues after scrolling
'
,
(
done
)
=>
{
spyOn
(
component
.
list
,
'
nextPage
'
);
component
.
$refs
.
list
.
style
.
height
=
'
100px
'
;
component
.
$refs
.
list
.
style
.
overflow
=
'
scroll
'
;
for
(
let
i
=
0
;
i
<
19
;
i
+=
1
)
{
const
issue
=
component
.
list
.
issues
[
0
];
issue
.
id
+=
1
;
component
.
list
.
issues
.
push
(
issue
);
}
Vue
.
nextTick
(()
=>
{
component
.
$refs
.
list
.
scrollTop
=
20000
;
setTimeout
(()
=>
{
expect
(
component
.
list
.
nextPage
).
toHaveBeenCalled
();
done
();
});
});
});
it
(
'
shows loading more spinner
'
,
(
done
)
=>
{
component
.
showCount
=
true
;
component
.
list
.
loadingMore
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.board-list-count .fa-spinner
'
),
).
not
.
toBeNull
();
done
();
});
});
});
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