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
3c8dfccc
Commit
3c8dfccc
authored
Dec 20, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issue item spec
parent
fcdb5a72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
0 deletions
+117
-0
app/assets/javascripts/issuable/related_issues/components/related_issues_root.vue
...ssuable/related_issues/components/related_issues_root.vue
+2
-0
spec/javascripts/issuable/related_issues/components/issue_item_spec.js
...pts/issuable/related_issues/components/issue_item_spec.js
+115
-0
No files found.
app/assets/javascripts/issuable/related_issues/components/related_issues_root.vue
View file @
3c8dfccc
...
...
@@ -162,6 +162,8 @@ export default {
RelatedIssuesService
.
saveOrder
({
endpoint
:
issueToReorder
.
relation_path
,
position
:
newOrder
,
}).
catch
(()
=>
{
Flash
(
'
An error occurred while reordering issues.
'
);
});
}
},
...
...
spec/javascripts/issuable/related_issues/components/issue_item_spec.js
0 → 100644
View file @
3c8dfccc
import
Vue
from
'
vue
'
;
import
issueItem
from
'
~/issuable/related_issues/components/issue_item.vue
'
;
import
eventHub
from
'
~/issuable/related_issues/event_hub
'
;
import
mountComponent
from
'
../../../helpers/vue_mount_component_helper
'
;
describe
(
'
issueItem
'
,
()
=>
{
let
vm
;
const
props
=
{
idKey
:
1
,
displayReference
:
'
#1
'
,
path
:
`
${
gl
.
TEST_HOST
}
/path`
,
title
:
'
title
'
,
};
beforeEach
(()
=>
{
const
IssueItem
=
Vue
.
extend
(
issueItem
);
vm
=
mountComponent
(
IssueItem
,
props
);
});
it
(
'
contains issue-info-container class when canReorder is false
'
,
()
=>
{
expect
(
vm
.
canReorder
).
toEqual
(
false
);
expect
(
vm
.
$el
.
querySelector
(
'
.issue-info-container
'
)).
toBeNull
();
});
it
(
'
renders displayReference
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.text-secondary
'
).
innerText
.
trim
()).
toEqual
(
props
.
displayReference
);
});
it
(
'
does not render token state
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.text-secondary i
'
)).
toBeNull
();
});
it
(
'
does not render remove button
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-issue-token-remove-button
'
)).
toBeNull
();
});
describe
(
'
token title
'
,
()
=>
{
it
(
'
links to computedPath
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
href
).
toEqual
(
props
.
path
);
});
it
(
'
renders title
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
innerText
.
trim
()).
toEqual
(
props
.
title
);
});
});
describe
(
'
token state
'
,
()
=>
{
let
tokenState
;
beforeEach
((
done
)
=>
{
vm
.
state
=
'
opened
'
;
Vue
.
nextTick
(()
=>
{
tokenState
=
vm
.
$el
.
querySelector
(
'
.text-secondary i
'
);
done
();
});
});
it
(
'
renders if hasState
'
,
()
=>
{
expect
(
tokenState
).
not
.
toBeNull
();
});
it
(
'
renders state title
'
,
()
=>
{
expect
(
tokenState
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
Open
'
);
});
it
(
'
renders aria label
'
,
()
=>
{
expect
(
tokenState
.
getAttribute
(
'
aria-label
'
)).
toEqual
(
'
opened
'
);
});
it
(
'
renders open icon when open state
'
,
()
=>
{
expect
(
tokenState
.
classList
.
contains
(
'
fa-circle-o
'
)).
toEqual
(
true
);
});
it
(
'
renders close icon when close state
'
,
(
done
)
=>
{
vm
.
state
=
'
closed
'
;
Vue
.
nextTick
(()
=>
{
expect
(
tokenState
.
classList
.
contains
(
'
fa-minus
'
)).
toEqual
(
true
);
done
();
});
});
});
describe
(
'
remove button
'
,
()
=>
{
let
removeBtn
;
beforeEach
((
done
)
=>
{
vm
.
canRemove
=
true
;
Vue
.
nextTick
(()
=>
{
removeBtn
=
vm
.
$el
.
querySelector
(
'
.js-issue-token-remove-button
'
);
done
();
});
});
it
(
'
renders if canRemove
'
,
()
=>
{
expect
(
removeBtn
).
not
.
toBeNull
();
});
it
(
'
renders disabled button when removeDisabled
'
,
(
done
)
=>
{
vm
.
removeDisabled
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
removeBtn
.
hasAttribute
(
'
disabled
'
)).
toEqual
(
true
);
done
();
});
});
it
(
'
triggers onRemoveRequest when clicked
'
,
()
=>
{
const
spy
=
jasmine
.
createSpy
(
'
spy
'
);
eventHub
.
$on
(
'
removeRequest
'
,
spy
);
removeBtn
.
click
();
expect
(
spy
).
toHaveBeenCalled
();
});
});
});
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