BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8135ea99
Commit
8135ea99
authored
Mar 16, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catches errors when generating lists
parent
49c920fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
0 deletions
+99
-0
board_blank_state.js
...assets/javascripts/boards/components/board_blank_state.js
+7
-0
board_blank_state_spec.js
spec/javascripts/boards/board_blank_state_spec.js
+92
-0
No files found.
app/assets/javascripts/boards/components/board_blank_state.js
View file @
8135ea99
...
@@ -69,6 +69,13 @@ export default {
...
@@ -69,6 +69,13 @@ export default {
list
.
label
.
id
=
listObj
.
label
.
id
;
list
.
label
.
id
=
listObj
.
label
.
id
;
list
.
getIssues
();
list
.
getIssues
();
});
});
})
.
catch
(()
=>
{
Store
.
removeList
(
undefined
,
'label'
);
Cookies
.
remove
(
'issue_board_welcome_hidden'
,
{
path
:
''
,
});
Store
.
addBlankState
();
});
});
},
},
clearBlankState
:
Store
.
removeBlankState
.
bind
(
Store
),
clearBlankState
:
Store
.
removeBlankState
.
bind
(
Store
),
...
...
spec/javascripts/boards/board_blank_state_spec.js
0 → 100644
View file @
8135ea99
import
Vue
from
'vue'
;
import
store
from
'~/boards/stores/boards_store'
;
import
boardBlankState
from
'~/boards/components/board_blank_state'
;
import
mockData
from
'./mock_data'
;
describe
(
'Boards blank state'
,
()
=>
{
let
vm
;
let
fail
=
false
;
beforeEach
((
done
)
=>
{
const
Comp
=
Vue
.
extend
(
boardBlankState
);
gl
.
issueBoards
.
BoardsStore
.
create
();
gl
.
boardService
=
new
BoardService
(
'/test/issue-boards/board'
,
''
,
'1'
);
spyOn
(
gl
.
boardService
,
'generateDefaultLists'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
if
(
fail
)
{
reject
();
}
else
{
resolve
({
json
()
{
return
[{
id
:
1
,
title
:
'To Do'
,
label
:
{
id
:
1
},
},
{
id
:
2
,
title
:
'Doing'
,
label
:
{
id
:
2
},
}]
},
});
}
}));
vm
=
new
Comp
();
setTimeout
(()
=>
{
vm
.
$mount
();
done
();
});
});
it
(
'renders pre-defined labels'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'.board-blank-state-list li'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
querySelectorAll
(
'.board-blank-state-list li'
)[
0
].
textContent
.
trim
()
).
toEqual
(
'To Do'
);
expect
(
vm
.
$el
.
querySelectorAll
(
'.board-blank-state-list li'
)[
1
].
textContent
.
trim
()
).
toEqual
(
'Doing'
);
});
it
(
'clears blank state'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'.btn-default'
).
click
();
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
BoardsStore
.
welcomeIsHidden
()).
toBeTruthy
();
done
();
});
});
it
(
'creates pre-defined labels'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'.btn-create'
).
click
();
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
BoardsStore
.
state
.
lists
.
length
).
toBe
(
2
);
expect
(
gl
.
issueBoards
.
BoardsStore
.
state
.
lists
[
0
].
title
).
toEqual
(
'To Do'
);
expect
(
gl
.
issueBoards
.
BoardsStore
.
state
.
lists
[
1
].
title
).
toEqual
(
'Doing'
);
done
();
});
});
it
(
'resets the store if request fails'
,
(
done
)
=>
{
fail
=
true
;
vm
.
$el
.
querySelector
(
'.btn-create'
).
click
();
setTimeout
(()
=>
{
expect
(
gl
.
issueBoards
.
BoardsStore
.
welcomeIsHidden
()).
toBeFalsy
();
expect
(
gl
.
issueBoards
.
BoardsStore
.
state
.
lists
.
length
).
toBe
(
1
);
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