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
Boxiang Sun
gitlab-ce
Commits
aa05b5ed
Commit
aa05b5ed
authored
Aug 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved board store to namespaced gl object
parent
abb55af2
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
88 additions
and
87 deletions
+88
-87
app/assets/javascripts/boards/boards_bundle.js.es6
app/assets/javascripts/boards/boards_bundle.js.es6
+6
-8
app/assets/javascripts/boards/components/board.js.es6
app/assets/javascripts/boards/components/board.js.es6
+2
-2
app/assets/javascripts/boards/components/board_blank_state.js.es6
...ts/javascripts/boards/components/board_blank_state.js.es6
+4
-4
app/assets/javascripts/boards/components/board_card.js.es6
app/assets/javascripts/boards/components/board_card.js.es6
+6
-6
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+2
-2
app/assets/javascripts/boards/components/new_list_dropdown.js.es6
...ts/javascripts/boards/components/new_list_dropdown.js.es6
+4
-4
app/assets/javascripts/boards/models/issue.js.es6
app/assets/javascripts/boards/models/issue.js.es6
+1
-1
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+3
-3
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+6
-3
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+5
-5
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+2
-2
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+2
-2
spec/javascripts/boards/boards_store_spec.js.es6
spec/javascripts/boards/boards_store_spec.js.es6
+39
-39
spec/javascripts/boards/issue_spec.js.es6
spec/javascripts/boards/issue_spec.js.es6
+1
-1
spec/javascripts/boards/list_spec.js.es6
spec/javascripts/boards/list_spec.js.es6
+5
-5
No files found.
app/assets/javascripts/boards/boards_bundle.js.es6
View file @
aa05b5ed
...
@@ -10,9 +10,7 @@
...
@@ -10,9 +10,7 @@
$(() => {
$(() => {
const $boardApp = $('#board-app');
const $boardApp = $('#board-app');
if (!window.gl) {
window.gl = window.gl || {};
window.gl = {};
}
if (gl.IssueBoardsApp) {
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
gl.IssueBoardsApp.$destroy(true);
...
@@ -21,14 +19,14 @@ $(() => {
...
@@ -21,14 +19,14 @@ $(() => {
gl.IssueBoardsApp = new Vue({
gl.IssueBoardsApp = new Vue({
el: $boardApp.get(0),
el: $boardApp.get(0),
data: {
data: {
state: BoardsStore.state,
state:
gl.issueBoards.
BoardsStore.state,
loading: true,
loading: true,
endpoint: $boardApp.data('endpoint'),
endpoint: $boardApp.data('endpoint'),
disabled: $boardApp.data('disabled'),
disabled: $boardApp.data('disabled'),
issueLinkBase: $boardApp.data('issue-link-base')
issueLinkBase: $boardApp.data('issue-link-base')
},
},
init () {
init () {
BoardsStore.create();
gl.issueBoards.
BoardsStore.create();
},
},
created () {
created () {
this.loading = true;
this.loading = true;
...
@@ -40,14 +38,14 @@ $(() => {
...
@@ -40,14 +38,14 @@ $(() => {
.removeAttr('data-issue-link-base');
.removeAttr('data-issue-link-base');
},
},
ready () {
ready () {
BoardsStore.disabled = this.disabled;
gl.issueBoards.
BoardsStore.disabled = this.disabled;
gl.boardService.all()
gl.boardService.all()
.then((resp) => {
.then((resp) => {
const boards = resp.json();
const boards = resp.json();
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
const board = boards[i],
const board = boards[i],
list = BoardsStore.addList(board);
list =
gl.issueBoards.
BoardsStore.addList(board);
if (list.type === 'done') {
if (list.type === 'done') {
list.position = Infinity;
list.position = Infinity;
...
@@ -56,7 +54,7 @@ $(() => {
...
@@ -56,7 +54,7 @@ $(() => {
}
}
}
}
BoardsStore.addBlankState();
gl.issueBoards.
BoardsStore.addBlankState();
this.loading = false;
this.loading = false;
});
});
}
}
...
...
app/assets/javascripts/boards/components/board.js.es6
View file @
aa05b5ed
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
data () {
data () {
return {
return {
query: '',
query: '',
filters: BoardsStore.state.filters
filters:
gl.issueBoards.
BoardsStore.state.filters
};
};
},
},
watch: {
watch: {
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
draggable: '.is-draggable',
draggable: '.is-draggable',
handle: '.js-board-handle',
handle: '.js-board-handle',
onUpdate (e) {
onUpdate (e) {
BoardsStore.moveList(e.oldIndex, e.newIndex);
gl.issueBoards.
BoardsStore.moveList(e.oldIndex, e.newIndex);
}
}
});
});
...
...
app/assets/javascripts/boards/components/board_blank_state.js.es6
View file @
aa05b5ed
...
@@ -12,12 +12,12 @@
...
@@ -12,12 +12,12 @@
},
},
methods: {
methods: {
addDefaultLists () {
addDefaultLists () {
BoardsStore.removeBlankState();
gl.issueBoards.
BoardsStore.removeBlankState();
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
const label = this.predefinedLabels[i];
const label = this.predefinedLabels[i];
BoardsStore.addList({
gl.issueBoards.
BoardsStore.addList({
title: label.title,
title: label.title,
position: i,
position: i,
list_type: 'label',
list_type: 'label',
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
const listObj = data[i],
const listObj = data[i],
list = BoardsStore.findList('title', listObj.title);
list =
gl.issueBoards.
BoardsStore.findList('title', listObj.title);
list.id = listObj.id;
list.id = listObj.id;
list.label.id = listObj.label.id;
list.label.id = listObj.label.id;
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
});
});
},
},
clearBlankState () {
clearBlankState () {
BoardsStore.removeBlankState();
gl.issueBoards.
BoardsStore.removeBlankState();
}
}
}
}
});
});
...
...
app/assets/javascripts/boards/components/board_card.js.es6
View file @
aa05b5ed
...
@@ -9,19 +9,19 @@
...
@@ -9,19 +9,19 @@
methods: {
methods: {
filterByLabel (label, e) {
filterByLabel (label, e) {
let labelToggleText = label.title;
let labelToggleText = label.title;
const labelIndex = BoardsStore.state.filters['label_name'].indexOf(label.title);
const labelIndex =
gl.issueBoards.
BoardsStore.state.filters['label_name'].indexOf(label.title);
$(e.target).tooltip('hide');
$(e.target).tooltip('hide');
if (labelIndex === -1) {
if (labelIndex === -1) {
BoardsStore.state.filters['label_name'].push(label.title);
gl.issueBoards.
BoardsStore.state.filters['label_name'].push(label.title);
$('.labels-filter').prepend(`<input type="hidden" name="label_name[]" value="${label.title}" />`);
$('.labels-filter').prepend(`<input type="hidden" name="label_name[]" value="${label.title}" />`);
} else {
} else {
BoardsStore.state.filters['label_name'].splice(labelIndex, 1);
gl.issueBoards.
BoardsStore.state.filters['label_name'].splice(labelIndex, 1);
labelToggleText = BoardsStore.state.filters['label_name'][0];
labelToggleText =
gl.issueBoards.
BoardsStore.state.filters['label_name'][0];
$(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove();
$(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove();
}
}
const selectedLabels = BoardsStore.state.filters['label_name'];
const selectedLabels =
gl.issueBoards.
BoardsStore.state.filters['label_name'];
if (selectedLabels.length === 0) {
if (selectedLabels.length === 0) {
labelToggleText = 'Label';
labelToggleText = 'Label';
} else if (selectedLabels.length > 1) {
} else if (selectedLabels.length > 1) {
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
$('.labels-filter .dropdown-toggle-text').text(labelToggleText);
$('.labels-filter .dropdown-toggle-text').text(labelToggleText);
BoardsStore.updateFiltersUrl();
gl.issueBoards.
BoardsStore.updateFiltersUrl();
}
}
}
}
});
});
...
...
app/assets/javascripts/boards/components/board_list.js.es6
View file @
aa05b5ed
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
data () {
data () {
return {
return {
scrollOffset: 250,
scrollOffset: 250,
filters: BoardsStore.state.filters
filters:
gl.issueBoards.
BoardsStore.state.filters
};
};
},
},
watch: {
watch: {
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
// Remove the new dom element & let vue add the element
// Remove the new dom element & let vue add the element
card.parentNode.removeChild(card);
card.parentNode.removeChild(card);
BoardsStore.moveCardToList(fromListId, toListId, issueId);
gl.issueBoards.
BoardsStore.moveCardToList(fromListId, toListId, issueId);
}
}
});
});
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js.es6
View file @
aa05b5ed
...
@@ -13,7 +13,7 @@ $(() => {
...
@@ -13,7 +13,7 @@ $(() => {
});
});
},
},
renderRow (label) {
renderRow (label) {
const active = BoardsStore.findList('title', label.title),
const active =
gl.issueBoards.
BoardsStore.findList('title', label.title),
$li = $('<li />',),
$li = $('<li />',),
$a = $('<a />', {
$a = $('<a />', {
class: (active ? `is-active js-board-list-${active.id}` : ''),
class: (active ? `is-active js-board-list-${active.id}` : ''),
...
@@ -35,10 +35,10 @@ $(() => {
...
@@ -35,10 +35,10 @@ $(() => {
clicked (label, $el, e) {
clicked (label, $el, e) {
e.preventDefault();
e.preventDefault();
if (!BoardsStore.findList('title', label.title)) {
if (!
gl.issueBoards.
BoardsStore.findList('title', label.title)) {
BoardsStore.new({
gl.issueBoards.
BoardsStore.new({
title: label.title,
title: label.title,
position: BoardsStore.state.lists.length - 1,
position:
gl.issueBoards.
BoardsStore.state.lists.length - 1,
list_type: 'label',
list_type: 'label',
label: {
label: {
id: label.id,
id: label.id,
...
...
app/assets/javascripts/boards/models/issue.js.es6
View file @
aa05b5ed
...
@@ -52,7 +52,7 @@ class ListIssue {
...
@@ -52,7 +52,7 @@ class ListIssue {
}
}
getLists () {
getLists () {
return BoardsStore.state.lists.filter((list) => {
return
gl.issueBoards.
BoardsStore.state.lists.filter((list) => {
return list.findIssue(this.id);
return list.findIssue(this.id);
});
});
}
}
...
...
app/assets/javascripts/boards/models/list.js.es6
View file @
aa05b5ed
...
@@ -4,7 +4,7 @@ class List {
...
@@ -4,7 +4,7 @@ class List {
this.position = obj.position;
this.position = obj.position;
this.title = obj.title;
this.title = obj.title;
this.type = obj.list_type;
this.type = obj.list_type;
this.filters = BoardsStore.state.filters;
this.filters =
gl.issueBoards.
BoardsStore.state.filters;
this.page = 1;
this.page = 1;
this.loading = true;
this.loading = true;
this.loadingMore = false;
this.loadingMore = false;
...
@@ -34,10 +34,10 @@ class List {
...
@@ -34,10 +34,10 @@ class List {
destroy () {
destroy () {
if (this.type !== 'blank') {
if (this.type !== 'blank') {
BoardsStore.state.lists =
BoardsStore.state.lists.filter((list) => {
gl.issueBoards.BoardsStore.state.lists = gl.issueBoards.
BoardsStore.state.lists.filter((list) => {
return list.id !== this.id;
return list.id !== this.id;
});
});
BoardsStore.updateNewListDropdown(this.id);
gl.issueBoards.
BoardsStore.updateNewListDropdown(this.id);
gl.boardService.destroyList(this.id);
gl.boardService.destroyList(this.id);
}
}
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
aa05b5ed
((w) => {
(() => {
w.BoardsStore = {
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardsStore = {
disabled: false,
disabled: false,
state: {},
state: {},
create () {
create () {
...
@@ -126,4 +129,4 @@
...
@@ -126,4 +129,4 @@
history.pushState(null, null, `?${$.param(this.state.filters)}`);
history.pushState(null, null, `?${$.param(this.state.filters)}`);
}
}
};
};
}
(window)
);
}
)(
);
app/assets/javascripts/labels_select.js
View file @
aa05b5ed
...
@@ -246,18 +246,18 @@
...
@@ -246,18 +246,18 @@
isMRIndex
=
page
===
'
projects:merge_requests:index
'
;
isMRIndex
=
page
===
'
projects:merge_requests:index
'
;
if
(
page
===
'
projects:boards:show
'
)
{
if
(
page
===
'
projects:boards:show
'
)
{
if
(
label
.
isAny
)
{
if
(
label
.
isAny
)
{
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
[];
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
[];
}
else
if
(
label
.
title
)
{
}
else
if
(
label
.
title
)
{
BoardsStore
.
state
.
filters
[
'
label_name
'
].
push
(
label
.
title
);
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
].
push
(
label
.
title
);
}
else
{
}
else
{
var
filters
=
BoardsStore
.
state
.
filters
[
'
label_name
'
];
var
filters
=
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
];
filters
=
filters
.
filter
(
function
(
label
)
{
filters
=
filters
.
filter
(
function
(
label
)
{
return
label
!==
$el
.
text
().
trim
();
return
label
!==
$el
.
text
().
trim
();
});
});
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
filters
;
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
filters
;
}
}
BoardsStore
.
updateFiltersUrl
();
gl
.
issueBoards
.
BoardsStore
.
updateFiltersUrl
();
e
.
preventDefault
();
e
.
preventDefault
();
return
;
return
;
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
...
...
app/assets/javascripts/milestone_select.js
View file @
aa05b5ed
...
@@ -103,8 +103,8 @@
...
@@ -103,8 +103,8 @@
return
;
return
;
}
}
if
(
page
===
'
projects:boards:show
'
)
{
if
(
page
===
'
projects:boards:show
'
)
{
BoardsStore
.
state
.
filters
[
$dropdown
.
data
(
'
field-name
'
)]
=
selected
.
name
;
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
$dropdown
.
data
(
'
field-name
'
)]
=
selected
.
name
;
BoardsStore
.
updateFiltersUrl
();
gl
.
issueBoards
.
BoardsStore
.
updateFiltersUrl
();
e
.
preventDefault
();
e
.
preventDefault
();
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
if
(
selected
.
name
!=
null
)
{
if
(
selected
.
name
!=
null
)
{
...
...
app/assets/javascripts/users_select.js
View file @
aa05b5ed
...
@@ -151,8 +151,8 @@
...
@@ -151,8 +151,8 @@
}
}
if
(
page
===
'
projects:boards:show
'
)
{
if
(
page
===
'
projects:boards:show
'
)
{
selectedId
=
user
.
id
;
selectedId
=
user
.
id
;
BoardsStore
.
state
.
filters
[
$dropdown
.
data
(
'
field-name
'
)]
=
user
.
id
;
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
$dropdown
.
data
(
'
field-name
'
)]
=
user
.
id
;
BoardsStore
.
updateFiltersUrl
();
gl
.
issueBoards
.
BoardsStore
.
updateFiltersUrl
();
e
.
preventDefault
();
e
.
preventDefault
();
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
selectedId
=
user
.
id
;
selectedId
=
user
.
id
;
...
...
spec/javascripts/boards/boards_store_spec.js.es6
View file @
aa05b5ed
...
@@ -15,54 +15,54 @@
...
@@ -15,54 +15,54 @@
(() => {
(() => {
beforeEach(() => {
beforeEach(() => {
gl.boardService = new BoardService('/test/issue-boards/board');
gl.boardService = new BoardService('/test/issue-boards/board');
BoardsStore.create();
gl.issueBoards.
BoardsStore.create();
$.cookie('issue_board_welcome_hidden', 'false');
$.cookie('issue_board_welcome_hidden', 'false');
});
});
describe('Store', () => {
describe('Store', () => {
it('starts with a blank state', () => {
it('starts with a blank state', () => {
expect(BoardsStore.state.lists.length).toBe(0);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(0);
});
});
describe('lists', () => {
describe('lists', () => {
it('creates new list without persisting to DB', () => {
it('creates new list without persisting to DB', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
expect(BoardsStore.state.lists.length).toBe(1);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(1);
});
});
it('finds list by ID', () => {
it('finds list by ID', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
const list = BoardsStore.findList('id', 1);
const list =
gl.issueBoards.
BoardsStore.findList('id', 1);
expect(list.id).toBe(1);
expect(list.id).toBe(1);
});
});
it('finds list by type', () => {
it('finds list by type', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
const list = BoardsStore.findList('type', 'label');
const list =
gl.issueBoards.
BoardsStore.findList('type', 'label');
expect(list).toBeDefined();
expect(list).toBeDefined();
});
});
it('finds list limited by type', () => {
it('finds list limited by type', () => {
BoardsStore.addList({
gl.issueBoards.
BoardsStore.addList({
id: 1,
id: 1,
position: 0,
position: 0,
title: 'Test',
title: 'Test',
list_type: 'backlog'
list_type: 'backlog'
});
});
const list = BoardsStore.findList('id', 1, 'backlog');
const list =
gl.issueBoards.
BoardsStore.findList('id', 1, 'backlog');
expect(list).toBeDefined();
expect(list).toBeDefined();
});
});
it('gets issue when new list added', (done) => {
it('gets issue when new list added', (done) => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
const list = BoardsStore.findList('id', 1);
const list =
gl.issueBoards.
BoardsStore.findList('id', 1);
expect(BoardsStore.state.lists.length).toBe(1);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(1);
setTimeout(() => {
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(list.issues.length).toBe(1);
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
});
});
it('persists new list', (done) => {
it('persists new list', (done) => {
BoardsStore.new({
gl.issueBoards.
BoardsStore.new({
title: 'Test',
title: 'Test',
type: 'label',
type: 'label',
label: {
label: {
...
@@ -82,10 +82,10 @@
...
@@ -82,10 +82,10 @@
description: 'testing;'
description: 'testing;'
}
}
});
});
expect(BoardsStore.state.lists.length).toBe(1);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(1);
setTimeout(() => {
setTimeout(() => {
const list = BoardsStore.findList('id', 1);
const list =
gl.issueBoards.
BoardsStore.findList('id', 1);
expect(list).toBeDefined();
expect(list).toBeDefined();
expect(list.id).toBe(1);
expect(list.id).toBe(1);
expect(list.position).toBe(0);
expect(list.position).toBe(0);
...
@@ -94,68 +94,68 @@
...
@@ -94,68 +94,68 @@
});
});
it('check for blank state adding', () => {
it('check for blank state adding', () => {
expect(BoardsStore.shouldAddBlankState()).toBe(true);
expect(
gl.issueBoards.
BoardsStore.shouldAddBlankState()).toBe(true);
});
});
it('check for blank state not adding', () => {
it('check for blank state not adding', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
expect(BoardsStore.shouldAddBlankState()).toBe(false);
expect(
gl.issueBoards.
BoardsStore.shouldAddBlankState()).toBe(false);
});
});
it('check for blank state adding when backlog & done list exist', () => {
it('check for blank state adding when backlog & done list exist', () => {
BoardsStore.addList({
gl.issueBoards.
BoardsStore.addList({
list_type: 'backlog'
list_type: 'backlog'
});
});
BoardsStore.addList({
gl.issueBoards.
BoardsStore.addList({
list_type: 'done'
list_type: 'done'
});
});
expect(BoardsStore.shouldAddBlankState()).toBe(true);
expect(
gl.issueBoards.
BoardsStore.shouldAddBlankState()).toBe(true);
});
});
it('adds the blank state', () => {
it('adds the blank state', () => {
BoardsStore.addBlankState();
gl.issueBoards.
BoardsStore.addBlankState();
const list = BoardsStore.findList('type', 'blank', 'blank');
const list =
gl.issueBoards.
BoardsStore.findList('type', 'blank', 'blank');
expect(list).toBeDefined();
expect(list).toBeDefined();
});
});
it('removes list from state', () => {
it('removes list from state', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
expect(BoardsStore.state.lists.length).toBe(1);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(1);
BoardsStore.removeList(1);
gl.issueBoards.
BoardsStore.removeList(1);
expect(BoardsStore.state.lists.length).toBe(0);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(0);
});
});
it('moves the position of lists', () => {
it('moves the position of lists', () => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
BoardsStore.addList(listObjDuplicate);
gl.issueBoards.
BoardsStore.addList(listObjDuplicate);
expect(BoardsStore.state.lists.length).toBe(2);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(2);
BoardsStore.moveList(0, 1);
gl.issueBoards.
BoardsStore.moveList(0, 1);
const list = BoardsStore.findList('id', 1);
const list =
gl.issueBoards.
BoardsStore.findList('id', 1);
expect(list.position).toBe(1);
expect(list.position).toBe(1);
});
});
it('moves an issue from one list to another', (done) => {
it('moves an issue from one list to another', (done) => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
BoardsStore.addList(listObjDuplicate);
gl.issueBoards.
BoardsStore.addList(listObjDuplicate);
expect(BoardsStore.state.lists.length).toBe(2);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(2);
const list = BoardsStore.findList('id', 1),
const list =
gl.issueBoards.
BoardsStore.findList('id', 1),
listTwo = BoardsStore.findList('id', 2);
listTwo =
gl.issueBoards.
BoardsStore.findList('id', 2);
setTimeout(() => {
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(list.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1);
BoardsStore.moveCardToList(1, 2, 1);
gl.issueBoards.
BoardsStore.moveCardToList(1, 2, 1);
expect(list.issues.length).toBe(0);
expect(list.issues.length).toBe(0);
expect(listTwo.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1);
...
...
spec/javascripts/boards/issue_spec.js.es6
View file @
aa05b5ed
...
@@ -17,7 +17,7 @@ describe('Issue model', () => {
...
@@ -17,7 +17,7 @@ describe('Issue model', () => {
beforeEach(() => {
beforeEach(() => {
gl.boardService = new BoardService('/test/issue-boards/board');
gl.boardService = new BoardService('/test/issue-boards/board');
BoardsStore.create();
gl.issueBoards.
BoardsStore.create();
issue = new ListIssue({
issue = new ListIssue({
title: 'Testing',
title: 'Testing',
...
...
spec/javascripts/boards/list_spec.js.es6
View file @
aa05b5ed
...
@@ -17,7 +17,7 @@ describe('List model', () => {
...
@@ -17,7 +17,7 @@ describe('List model', () => {
beforeEach(() => {
beforeEach(() => {
gl.boardService = new BoardService('/test/issue-boards/board');
gl.boardService = new BoardService('/test/issue-boards/board');
BoardsStore.create();
gl.issueBoards.
BoardsStore.create();
list = new List(listObj);
list = new List(listObj);
});
});
...
@@ -49,13 +49,13 @@ describe('List model', () => {
...
@@ -49,13 +49,13 @@ describe('List model', () => {
});
});
it('destroys the list', (done) => {
it('destroys the list', (done) => {
BoardsStore.addList(listObj);
gl.issueBoards.
BoardsStore.addList(listObj);
list = BoardsStore.findList('id', 1);
list =
gl.issueBoards.
BoardsStore.findList('id', 1);
expect(BoardsStore.state.lists.length).toBe(1);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(1);
list.destroy();
list.destroy();
setTimeout(() => {
setTimeout(() => {
expect(BoardsStore.state.lists.length).toBe(0);
expect(
gl.issueBoards.
BoardsStore.state.lists.length).toBe(0);
done();
done();
}, 0);
}, 0);
});
});
...
...
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