diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 21:08:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 21:08:29 +0000 |
commit | 40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9 (patch) | |
tree | 9b735ef933178be36d35088f3acab2d9b75dbbad /spec/frontend | |
parent | 22a0d312ae82e7dda3073d5d1a5a766d7641738d (diff) | |
download | gitlab-ce-40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
4 files changed, 56 insertions, 10 deletions
diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js index 10b24cf04d3..310cd676ca1 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -143,10 +143,14 @@ describe('ErrorTrackingList', () => { }); it('each error in the list should have an ignore button', () => { - const error = wrapper.findAll('tbody tr'); + findErrorListRows().wrappers.forEach(row => { + expect(row.contains('glicon-stub[name="eye-slash"]')).toBe(true); + }); + }); - error.wrappers.forEach((_, index) => { - expect(error.at(index).exists('glicon-stub[name="eye-slash"]')).toBe(true); + it('each error in the list should have a resolve button', () => { + findErrorListRows().wrappers.forEach(row => { + expect(row.contains('glicon-stub[name="check-circle"]')).toBe(true); }); }); @@ -231,8 +235,7 @@ describe('ErrorTrackingList', () => { }); it('sends the "ignored" status and error ID', () => { - const ignoreButton = wrapper.find({ ref: 'ignoreError' }); - ignoreButton.trigger('click'); + wrapper.find({ ref: 'ignoreError' }).trigger('click'); expect(actions.updateStatus).toHaveBeenCalledWith( expect.anything(), { @@ -245,6 +248,34 @@ describe('ErrorTrackingList', () => { }); }); + describe('When the resolve button on an error is clicked', () => { + beforeEach(() => { + store.state.list.loading = false; + store.state.list.errors = errorsList; + + mountComponent({ + stubs: { + GlTable: false, + GlLink: false, + GlButton: false, + }, + }); + }); + + it('sends "resolved" status and error ID', () => { + wrapper.find({ ref: 'resolveError' }).trigger('click'); + expect(actions.updateStatus).toHaveBeenCalledWith( + expect.anything(), + { + endpoint: '/project/test/-/error_tracking/3.json', + redirectUrl: '/error_tracking', + status: 'resolved', + }, + undefined, + ); + }); + }); + describe('When error tracking is disabled and user is not allowed to enable it', () => { beforeEach(() => { mountComponent({ diff --git a/spec/frontend/lib/utils/text_utility_spec.js b/spec/frontend/lib/utils/text_utility_spec.js index deb6dab772e..803b3629524 100644 --- a/spec/frontend/lib/utils/text_utility_spec.js +++ b/spec/frontend/lib/utils/text_utility_spec.js @@ -27,6 +27,9 @@ describe('text_utility', () => { it('should remove underscores and uppercase the first letter', () => { expect(textUtils.humanize('foo_bar')).toEqual('Foo bar'); }); + it('should remove underscores and dashes and uppercase the first letter', () => { + expect(textUtils.humanize('foo_bar-foo', '[_-]')).toEqual('Foo bar foo'); + }); }); describe('dasherize', () => { @@ -52,14 +55,20 @@ describe('text_utility', () => { expect(textUtils.slugify(' a new project ')).toEqual('a-new-project'); }); it('should only remove non-allowed special characters', () => { - expect(textUtils.slugify('test!_pro-ject~')).toEqual('test-_pro-ject-'); + expect(textUtils.slugify('test!_pro-ject~')).toEqual('test-_pro-ject'); }); it('should squash multiple hypens', () => { - expect(textUtils.slugify('test!!!!_pro-ject~')).toEqual('test-_pro-ject-'); + expect(textUtils.slugify('test!!!!_pro-ject~')).toEqual('test-_pro-ject'); }); it('should return empty string if only non-allowed characters', () => { expect(textUtils.slugify('здрасти')).toEqual(''); }); + it('should squash multiple separators', () => { + expect(textUtils.slugify('Test:-)')).toEqual('test'); + }); + it('should trim any separators from the beginning and end of the slug', () => { + expect(textUtils.slugify('-Test:-)-')).toEqual('test'); + }); }); describe('stripHtml', () => { @@ -109,6 +118,12 @@ describe('text_utility', () => { }); }); + describe('convertToTitleCase', () => { + it('converts sentence case to Sentence Case', () => { + expect(textUtils.convertToTitleCase('hello world')).toBe('Hello World'); + }); + }); + describe('truncateSha', () => { it('shortens SHAs to 8 characters', () => { expect(textUtils.truncateSha('verylongsha')).toBe('verylong'); diff --git a/spec/frontend/monitoring/store/mutations_spec.js b/spec/frontend/monitoring/store/mutations_spec.js index e89c22268d4..cb53ab60bdb 100644 --- a/spec/frontend/monitoring/store/mutations_spec.js +++ b/spec/frontend/monitoring/store/mutations_spec.js @@ -29,8 +29,8 @@ describe('Monitoring mutations', () => { mutations[types.RECEIVE_METRICS_DATA_SUCCESS](stateCopy, payload); const groups = getGroups(); - expect(groups[0].key).toBe('response-metrics-nginx-ingress-vts--0'); - expect(groups[1].key).toBe('system-metrics-kubernetes--1'); + expect(groups[0].key).toBe('response-metrics-nginx-ingress-vts-0'); + expect(groups[1].key).toBe('system-metrics-kubernetes-1'); }); it('normalizes values', () => { mutations[types.RECEIVE_METRICS_DATA_SUCCESS](stateCopy, payload); diff --git a/spec/frontend/releases/list/components/release_block_spec.js b/spec/frontend/releases/list/components/release_block_spec.js index e3d6af13417..20c25a4aac2 100644 --- a/spec/frontend/releases/list/components/release_block_spec.js +++ b/spec/frontend/releases/list/components/release_block_spec.js @@ -169,7 +169,7 @@ describe('Release block', () => { releaseClone.tag_name = 'a dangerous tag name <script>alert("hello")</script>'; return factory(releaseClone).then(() => { - expect(wrapper.attributes().id).toBe('a-dangerous-tag-name-script-alert-hello-script-'); + expect(wrapper.attributes().id).toBe('a-dangerous-tag-name-script-alert-hello-script'); }); }); |