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 | |
parent | c52239391bf29f640e1e0af98edbd337c0293940 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/labels_select_spec.js | 44 | ||||
-rw-r--r-- | spec/frontend/registry/settings/components/registry_settings_app_spec.js | 27 |
2 files changed, 61 insertions, 10 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};`); + }); + }); }); }); diff --git a/spec/frontend/registry/settings/components/registry_settings_app_spec.js b/spec/frontend/registry/settings/components/registry_settings_app_spec.js index e9ba65e4387..c83cc0c00dd 100644 --- a/spec/frontend/registry/settings/components/registry_settings_app_spec.js +++ b/spec/frontend/registry/settings/components/registry_settings_app_spec.js @@ -44,15 +44,6 @@ describe('Registry Settings App', () => { expect(store.dispatch).toHaveBeenCalledWith('fetchSettings'); }); - it('show a toast if fetchSettings fails', () => { - mountComponent({ dispatchMock: 'mockRejectedValue' }); - return wrapper.vm.$nextTick().then(() => - expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(FETCH_SETTINGS_ERROR_MESSAGE, { - type: 'error', - }), - ); - }); - it('renders the setting form', () => { mountComponent(); expect(findSettingsComponent().exists()).toBe(true); @@ -68,7 +59,23 @@ describe('Registry Settings App', () => { }); it('shows an alert', () => { - expect(findAlert().exists()).toBe(true); + expect(findAlert().html()).toContain( + 'Currently, the Container Registry tag expiration feature is not available', + ); + }); + }); + + describe('fetchSettingsError', () => { + beforeEach(() => { + mountComponent({ dispatchMock: 'mockRejectedValue' }); + }); + + it('the form is hidden', () => { + expect(findSettingsComponent().exists()).toBe(false); + }); + + it('shows an alert', () => { + expect(findAlert().html()).toContain(FETCH_SETTINGS_ERROR_MESSAGE); }); }); }); |