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
338f5e2a
Commit
338f5e2a
authored
Mar 08, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `createLabelTitle` & `manageLabelsTitle` props for action string
parent
9d572c70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer.vue
...ared/components/sidebar/labels_select/dropdown_footer.vue
+14
-2
spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js
.../components/sidebar/labels_select/dropdown_footer_spec.js
+29
-3
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer.vue
View file @
338f5e2a
<
script
>
import
{
__
}
from
'
~/locale
'
;
export
default
{
props
:
{
labelsWebUrl
:
{
type
:
String
,
required
:
true
,
},
createLabelTitle
:
{
type
:
String
,
required
:
false
,
default
:
()
=>
__
(
'
Create new label
'
),
},
manageLabelsTitle
:
{
type
:
String
,
required
:
false
,
default
:
()
=>
__
(
'
Manage labels
'
),
},
},
};
</
script
>
...
...
@@ -17,7 +29,7 @@ export default {
href=
"#"
class=
"dropdown-toggle-page"
>
{{
__
(
'
Create new label
'
)
}}
{{
createLabelTitle
}}
</a>
</li>
<li>
...
...
@@ -26,7 +38,7 @@ export default {
class=
"dropdown-external-link"
:href=
"labelsWebUrl"
>
{{
__
(
'
Manage labels
'
)
}}
{{
manageLabelsTitle
}}
</a>
</li>
</ul>
...
...
spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js
View file @
338f5e2a
...
...
@@ -6,15 +6,23 @@ import { mockConfig } from './mock_data';
import
mountComponent
from
'
../../../../helpers/vue_mount_component_helper
'
;
const
createComponent
=
(
labelsWebUrl
=
mockConfig
.
labelsWebUrl
)
=>
{
const
createComponent
=
(
labelsWebUrl
=
mockConfig
.
labelsWebUrl
,
createLabelTitle
,
manageLabelsTitle
,
)
=>
{
const
Component
=
Vue
.
extend
(
dropdownFooterComponent
);
return
mountComponent
(
Component
,
{
labelsWebUrl
,
createLabelTitle
,
manageLabelsTitle
,
});
};
describe
(
'
DropdownFooterComponent
'
,
()
=>
{
const
createLabelTitle
=
'
Create project label
'
;
const
manageLabelsTitle
=
'
Manage project labels
'
;
let
vm
;
beforeEach
(()
=>
{
...
...
@@ -26,17 +34,35 @@ describe('DropdownFooterComponent', () => {
});
describe
(
'
template
'
,
()
=>
{
it
(
'
renders
`Create new label` link element
'
,
()
=>
{
it
(
'
renders
link element with `Create new label` when `createLabelTitle` prop is not provided
'
,
()
=>
{
const
createLabelEl
=
vm
.
$el
.
querySelector
(
'
.dropdown-footer-list .dropdown-toggle-page
'
);
expect
(
createLabelEl
).
not
.
toBeNull
();
expect
(
createLabelEl
.
innerText
.
trim
()).
toBe
(
'
Create new label
'
);
});
it
(
'
renders `Manage labels` link element
'
,
()
=>
{
it
(
'
renders link element with value of `createLabelTitle` prop
'
,
()
=>
{
const
vmWithCreateLabelTitle
=
createComponent
(
mockConfig
.
labelsWebUrl
,
createLabelTitle
);
const
createLabelEl
=
vmWithCreateLabelTitle
.
$el
.
querySelector
(
'
.dropdown-footer-list .dropdown-toggle-page
'
);
expect
(
createLabelEl
.
innerText
.
trim
()).
toBe
(
createLabelTitle
);
vmWithCreateLabelTitle
.
$destroy
();
});
it
(
'
renders link element with `Manage labels` when `manageLabelsTitle` prop is not provided
'
,
()
=>
{
const
manageLabelsEl
=
vm
.
$el
.
querySelector
(
'
.dropdown-footer-list .dropdown-external-link
'
);
expect
(
manageLabelsEl
).
not
.
toBeNull
();
expect
(
manageLabelsEl
.
getAttribute
(
'
href
'
)).
toBe
(
vm
.
labelsWebUrl
);
expect
(
manageLabelsEl
.
innerText
.
trim
()).
toBe
(
'
Manage labels
'
);
});
it
(
'
renders link element with value of `manageLabelsTitle` prop
'
,
()
=>
{
const
vmWithManageLabelsTitle
=
createComponent
(
mockConfig
.
labelsWebUrl
,
createLabelTitle
,
manageLabelsTitle
,
);
const
manageLabelsEl
=
vmWithManageLabelsTitle
.
$el
.
querySelector
(
'
.dropdown-footer-list .dropdown-external-link
'
);
expect
(
manageLabelsEl
.
innerText
.
trim
()).
toBe
(
manageLabelsTitle
);
vmWithManageLabelsTitle
.
$destroy
();
});
});
});
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