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
67d01c10
Commit
67d01c10
authored
Oct 12, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add assignee select spec
parent
33318a56
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
8 deletions
+118
-8
app/assets/javascripts/boards/components/assignee_select.vue
app/assets/javascripts/boards/components/assignee_select.vue
+0
-0
app/assets/javascripts/boards/components/board_form.vue
app/assets/javascripts/boards/components/board_form.vue
+3
-3
spec/javascripts/boards/components/assignee_select_spec.js
spec/javascripts/boards/components/assignee_select_spec.js
+115
-0
spec/javascripts/boards/milestone_select_spec.js
spec/javascripts/boards/milestone_select_spec.js
+0
-5
No files found.
app/assets/javascripts/boards/components/
user
_select.vue
→
app/assets/javascripts/boards/components/
assignee
_select.vue
View file @
67d01c10
File moved
app/assets/javascripts/boards/components/board_form.vue
View file @
67d01c10
...
@@ -6,7 +6,7 @@ import PopupDialog from '~/vue_shared/components/popup_dialog.vue';
...
@@ -6,7 +6,7 @@ import PopupDialog from '~/vue_shared/components/popup_dialog.vue';
import
BoardMilestoneSelect
from
'
./milestone_select.vue
'
;
import
BoardMilestoneSelect
from
'
./milestone_select.vue
'
;
import
BoardWeightSelect
from
'
./weight_select.vue
'
;
import
BoardWeightSelect
from
'
./weight_select.vue
'
;
import
BoardLabelsSelect
from
'
./labels_select.vue
'
;
import
BoardLabelsSelect
from
'
./labels_select.vue
'
;
import
UserSelect
from
'
./user
_select.vue
'
;
import
AssigneeSelect
from
'
./assignee
_select.vue
'
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
...
@@ -69,11 +69,11 @@ export default {
...
@@ -69,11 +69,11 @@ export default {
};
};
},
},
components
:
{
components
:
{
AssigneeSelect
,
BoardLabelsSelect
,
BoardLabelsSelect
,
BoardMilestoneSelect
,
BoardMilestoneSelect
,
BoardWeightSelect
,
BoardWeightSelect
,
PopupDialog
,
PopupDialog
,
UserSelect
,
},
},
computed
:
{
computed
:
{
isNewForm
()
{
isNewForm
()
{
...
@@ -247,7 +247,7 @@ export default {
...
@@ -247,7 +247,7 @@ export default {
:labels-path=
"labelsPath"
:labels-path=
"labelsPath"
/>
/>
<
user
-select
<
assignee
-select
any-user-text=
"Any assignee"
any-user-text=
"Any assignee"
:board=
"board"
:board=
"board"
field-name=
"assignee_id"
field-name=
"assignee_id"
...
...
spec/javascripts/boards/components/assignee_select_spec.js
0 → 100644
View file @
67d01c10
/* global boardsMockInterceptor */
/* global boardObj */
/* global BoardService */
/* global mockBoardService */
/* global IssuableContext */
import
Vue
from
'
vue
'
;
import
AssigneeSelect
from
'
~/boards/components/assignee_select.vue
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/stores/boards_store
'
;
import
'
~/issuable_context
'
;
let
vm
;
function
selectedText
()
{
return
vm
.
$el
.
querySelector
(
'
.value
'
).
innerText
.
trim
();
}
function
activeDropdownItem
(
index
)
{
const
items
=
document
.
querySelectorAll
(
'
.is-active
'
);
if
(
!
items
[
index
])
return
''
;
return
items
[
index
].
innerText
.
trim
();
}
const
assignee
=
{
id
:
1
,
name
:
'
first assignee
'
,
};
const
assignee2
=
{
id
:
2
,
name
:
'
second assignee
'
,
};
describe
(
'
Assignee select component
'
,
()
=>
{
beforeEach
((
done
)
=>
{
setFixtures
(
'
<div class="test-container"></div>
'
);
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
BoardsStore
.
create
();
// eslint-disable-next-line no-new
new
IssuableContext
();
const
Component
=
Vue
.
extend
(
AssigneeSelect
);
vm
=
new
Component
({
propsData
:
{
board
:
boardObj
,
assigneePath
:
'
/test/issue-boards/assignees.json
'
,
canEdit
:
true
,
label
:
'
Assignee
'
,
selected
:
{},
fieldName
:
'
assignee_id
'
,
anyUserText
:
'
Any assignee
'
,
},
}).
$mount
(
'
.test-container
'
);
setTimeout
(
done
);
});
describe
(
'
canEdit
'
,
()
=>
{
it
(
'
hides Edit button
'
,
(
done
)
=>
{
vm
.
canEdit
=
false
;
Vue
.
nextTick
(()
=>
{
expect
(
document
.
querySelector
(
'
.edit-link
'
)).
toBeFalsy
();
done
();
});
});
it
(
'
shows Edit button if true
'
,
(
done
)
=>
{
vm
.
canEdit
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
document
.
querySelector
(
'
.edit-link
'
)).
toBeTruthy
();
done
();
});
});
});
describe
(
'
selected value
'
,
()
=>
{
it
(
'
defaults to Any Assignee
'
,
()
=>
{
expect
(
selectedText
()).
toContain
(
'
Any assignee
'
);
});
it
(
'
shows selected assignee
'
,
(
done
)
=>
{
vm
.
selected
=
assignee
;
Vue
.
nextTick
(()
=>
{
expect
(
selectedText
()).
toContain
(
'
first assignee
'
);
done
();
});
});
describe
(
'
clicking dropdown items
'
,
()
=>
{
beforeEach
(()
=>
{
const
deferred
=
new
jQuery
.
Deferred
();
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
resolve
([
assignee
,
assignee2
,
]));
});
it
(
'
sets assignee
'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'
.edit-link
'
).
click
();
setTimeout
(()
=>
{
vm
.
$el
.
querySelectorAll
(
'
li a
'
)[
2
].
click
();
});
setTimeout
(()
=>
{
expect
(
activeDropdownItem
(
0
)).
toEqual
(
'
second assignee
'
);
expect
(
vm
.
board
.
assignee
).
toEqual
(
assignee2
);
done
();
});
});
});
});
});
spec/javascripts/boards/milestone_select_spec.js
View file @
67d01c10
...
@@ -6,10 +6,7 @@
...
@@ -6,10 +6,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
MilestoneSelect
from
'
~/boards/components/milestone_select.vue
'
;
import
MilestoneSelect
from
'
~/boards/components/milestone_select.vue
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/stores/boards_store
'
;
import
'
~/issuable_context
'
;
import
'
~/issuable_context
'
;
import
'
./mock_data
'
;
let
vm
;
let
vm
;
...
@@ -38,8 +35,6 @@ const milestone2 = {
...
@@ -38,8 +35,6 @@ const milestone2 = {
describe
(
'
Milestone select component
'
,
()
=>
{
describe
(
'
Milestone select component
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
setFixtures
(
'
<div class="test-container"></div>
'
);
setFixtures
(
'
<div class="test-container"></div>
'
);
gl
.
boardService
=
mockBoardService
();
gl
.
issueBoards
.
BoardsStore
.
create
();
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
IssuableContext
();
new
IssuableContext
();
...
...
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