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
47e875ea
Commit
47e875ea
authored
May 16, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added spec for rendering the selector
[ci skip]
parent
0820aab4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+2
-1
app/assets/javascripts/issue_show/components/fields/title.vue
...assets/javascripts/issue_show/components/fields/title.vue
+13
-2
spec/javascripts/issue_show/components/fields/title_spec.js
spec/javascripts/issue_show/components/fields/title_spec.js
+20
-0
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
47e875ea
...
...
@@ -149,7 +149,8 @@ export default {
<form-component
v-if=
"canUpdate && showForm"
:form-state=
"formState"
:can-destroy=
"canDestroy"
/>
:can-destroy=
"canDestroy"
:issuable-templates=
"issuableTemplates"
/>
<div
v-else
>
<title-component
:issuable-ref=
"issuableRef"
...
...
app/assets/javascripts/issue_show/components/fields/title.vue
View file @
47e875ea
...
...
@@ -16,16 +16,27 @@
components
:
{
descriptionTemplate
,
},
computed
:
{
hasIssuableTemplates
()
{
return
this
.
issuableTemplates
.
length
!==
0
;
},
},
};
</
script
>
<
template
>
<fieldset
class=
"row"
>
<div
class=
"col-sm-4 col-lg-3"
>
<div
class=
"col-sm-4 col-lg-3"
v-if=
"hasIssuableTemplates"
>
<description-template
:issuable-templates=
"issuableTemplates"
/>
</div>
<div
class=
"col-sm-8 col-lg-9"
>
<div
:class=
"
{
'col-sm-8 col-lg-9': hasIssuableTemplates,
'col-xs-12': !hasIssuableTemplates,
}">
<label
class=
"sr-only"
for=
"issue-title"
>
...
...
spec/javascripts/issue_show/components/fields/title_spec.js
View file @
47e875ea
import
Vue
from
'
vue
'
;
import
Store
from
'
~/issue_show/stores
'
;
import
titleField
from
'
~/issue_show/components/fields/title.vue
'
;
import
'
~/templates/issuable_template_selectors
'
;
describe
(
'
Title field component
'
,
()
=>
{
let
vm
;
...
...
@@ -27,4 +28,23 @@ describe('Title field component', () => {
vm
.
$el
.
querySelector
(
'
.form-control
'
).
value
,
).
toBe
(
'
test
'
);
});
it
(
'
does not render template selector if no templates exist
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-issuable-selector-wrap
'
),
).
toBeNull
();
});
it
(
'
renders template selector when templates exists
'
,
(
done
)
=>
{
spyOn
(
gl
,
'
IssuableTemplateSelectors
'
);
vm
.
issuableTemplates
=
[
'
test
'
];
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-issuable-selector-wrap
'
),
).
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