summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2018-03-08 18:13:34 +0530
committerKushal Pandya <kushal@gitlab.com>2018-03-12 10:49:55 +0530
commit338f5e2a76aa0611a96600c67ca67ef391b6c453 (patch)
treedb2a8a6e15d9814edab599b4426687a1ad3eaa94 /spec/javascripts
parent9d572c702a095b39473de3c286b8098563d8b30d (diff)
downloadgitlab-ce-338f5e2a76aa0611a96600c67ca67ef391b6c453.tar.gz
Add `createLabelTitle` & `manageLabelsTitle` props for action string
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js
index 809e0327b1c..0f4fa716f8a 100644
--- a/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js
+++ b/spec/javascripts/vue_shared/components/sidebar/labels_select/dropdown_footer_spec.js
@@ -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();
+ });
});
});