diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-02-28 18:01:08 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-02-28 18:01:08 +0300 |
commit | 2e48bf116c4e307f125b3bbaf0c754574c4eb22c (patch) | |
tree | 852c7f0660e1a5c4f8a299e28ff1adc1eabc4f04 /spec | |
parent | 65348cf07bafef5efc1c9665d3efdb5a1bdd7128 (diff) | |
parent | 90baab96e0c3a788e68a48a1adff7954cd88c263 (diff) |
Merge branch '43643-fix-mr-label-filtering' into 'master'
Enable filtering MR list based on clicked label in MR sidebar
Closes #43643
See merge request gitlab-org/gitlab-ce!17390
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/labels_select_spec.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/javascripts/labels_select_spec.js b/spec/javascripts/labels_select_spec.js new file mode 100644 index 00000000000..b8f7b1dc855 --- /dev/null +++ b/spec/javascripts/labels_select_spec.js @@ -0,0 +1,43 @@ +import LabelsSelect from '~/labels_select'; + +const mockUrl = '/foo/bar/url'; + +const mockLabels = [ + { + id: 26, + title: 'Foo Label', + description: 'Foobar', + color: '#BADA55', + text_color: '#FFFFFF', + }, +]; + +describe('LabelsSelect', () => { + describe('getLabelTemplate', () => { + const label = mockLabels[0]; + let $labelEl; + + beforeEach(() => { + $labelEl = $(LabelsSelect.getLabelTemplate({ + labels: mockLabels, + issueUpdateURL: mockUrl, + })); + }); + + it('generated label item template has correct label URL', () => { + expect($labelEl.attr('href')).toBe('/foo/bar?label_name[]=Foo%20Label'); + }); + + it('generated label item template has correct label title', () => { + expect($labelEl.find('span.label').text()).toBe(label.title); + }); + + it('generated label item template has label description as title attribute', () => { + expect($labelEl.find('span.label').attr('title')).toBe(label.description); + }); + + it('generated label item template has correct label styles', () => { + expect($labelEl.find('span.label').attr('style')).toBe(`background-color: ${label.color}; color: ${label.text_color};`); + }); + }); +}); |