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
9d572c70
Commit
9d572c70
authored
Mar 08, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `headerTitle` prop for container header string
parent
eeb957ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue
...omponents/sidebar/labels_select/dropdown_create_label.vue
+10
-1
spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
...nents/sidebar/labels_select/dropdown_create_label_spec.js
+13
-3
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue
View file @
9d572c70
<
script
>
import
{
__
}
from
'
~/locale
'
;
export
default
{
props
:
{
headerTitle
:
{
type
:
String
,
required
:
false
,
default
:
()
=>
__
(
'
Create new label
'
),
},
},
created
()
{
this
.
suggestedColors
=
gon
.
suggested_label_colors
;
},
...
...
@@ -21,7 +30,7 @@ export default {
>
</i>
</button>
{{
__
(
'
Create new label
'
)
}}
{{
headerTitle
}}
<button
type=
"button"
class=
"dropdown-title-button dropdown-menu-close"
...
...
spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
View file @
9d572c70
...
...
@@ -6,10 +6,12 @@ import { mockSuggestedColors } from './mock_data';
import
mountComponent
from
'
../../../../helpers/vue_mount_component_helper
'
;
const
createComponent
=
()
=>
{
const
createComponent
=
(
headerTitle
)
=>
{
const
Component
=
Vue
.
extend
(
dropdownCreateLabelComponent
);
return
mountComponent
(
Component
);
return
mountComponent
(
Component
,
{
headerTitle
,
});
};
describe
(
'
DropdownCreateLabelComponent
'
,
()
=>
{
...
...
@@ -41,11 +43,19 @@ describe('DropdownCreateLabelComponent', () => {
expect
(
backButtonEl
.
querySelector
(
'
.fa-arrow-left
'
)).
not
.
toBe
(
null
);
});
it
(
'
renders component header element
'
,
()
=>
{
it
(
'
renders component header element
as `Create new label` when `headerTitle` prop is not provided
'
,
()
=>
{
const
headerEl
=
vm
.
$el
.
querySelector
(
'
.dropdown-title
'
);
expect
(
headerEl
.
innerText
.
trim
()).
toContain
(
'
Create new label
'
);
});
it
(
'
renders component header element with value of `headerTitle` prop
'
,
()
=>
{
const
headerTitle
=
'
Create project label
'
;
const
vmWithHeaderTitle
=
createComponent
(
headerTitle
);
const
headerEl
=
vmWithHeaderTitle
.
$el
.
querySelector
(
'
.dropdown-title
'
);
expect
(
headerEl
.
innerText
.
trim
()).
toContain
(
headerTitle
);
vmWithHeaderTitle
.
$destroy
();
});
it
(
'
renders `Close` button on component header
'
,
()
=>
{
const
closeButtonEl
=
vm
.
$el
.
querySelector
(
'
.dropdown-title button.dropdown-title-button.dropdown-menu-close
'
);
expect
(
closeButtonEl
).
not
.
toBe
(
null
);
...
...
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