diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 12:09:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 12:09:29 +0300 |
commit | 3fd97b4bba24ca412112aad025a38a32c7a6cf8c (patch) | |
tree | 4aacc8a184522bcbc3db68df47620bc3d2cfcfd9 /spec/frontend/labels_select_spec.js | |
parent | c52239391bf29f640e1e0af98edbd337c0293940 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/labels_select_spec.js')
-rw-r--r-- | spec/frontend/labels_select_spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/frontend/labels_select_spec.js b/spec/frontend/labels_select_spec.js index 59116b64298..5f48bad4970 100644 --- a/spec/frontend/labels_select_spec.js +++ b/spec/frontend/labels_select_spec.js @@ -23,6 +23,16 @@ const mockScopedLabels = [ }, ]; +const mockScopedLabels2 = [ + { + id: 28, + title: 'Foo::Bar2', + description: 'Foobar2', + color: '#FFFFFF', + text_color: '#000000', + }, +]; + describe('LabelsSelect', () => { describe('getLabelTemplate', () => { describe('when normal label is present', () => { @@ -108,11 +118,45 @@ describe('LabelsSelect', () => { expect($labelEl.find('span.gl-label-text').attr('style')).toBe( `background-color: ${label.color}; color: ${label.text_color};`, ); + expect( + $labelEl + .find('span.gl-label-text') + .last() + .attr('style'), + ).toBe(`color: ${label.color};`); }); it('generated label item has a badge class', () => { expect($labelEl.find('span').hasClass('gl-label-text')).toEqual(true); }); }); + + describe('when scoped label is present, with text color not white', () => { + const label = mockScopedLabels2[0]; + let $labelEl; + + beforeEach(() => { + $labelEl = $( + LabelsSelect.getLabelTemplate({ + labels: mockScopedLabels2, + issueUpdateURL: mockUrl, + enableScopedLabels: true, + scopedLabelsDocumentationLink: 'docs-link', + }), + ); + }); + + it('generated label item template has correct label styles', () => { + expect($labelEl.find('span.gl-label-text').attr('style')).toBe( + `background-color: ${label.color}; color: ${label.text_color};`, + ); + expect( + $labelEl + .find('span.gl-label-text') + .last() + .attr('style'), + ).toBe(`color: ${label.text_color};`); + }); + }); }); }); |