diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 06:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 06:08:49 +0300 |
commit | 996c6bf06f602ada62e3f754c121c17051072892 (patch) | |
tree | c7568793468de0faef693795e00f34c07da8e793 /spec/frontend | |
parent | 0a0e82d1440b06650e5fc524168b1f50a8feec68 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/lib/utils/text_utility_spec.js | 23 | ||||
-rw-r--r-- | spec/frontend/releases/components/release_block_header_spec.js | 4 | ||||
-rw-r--r-- | spec/frontend/releases/components/release_block_spec.js | 6 |
3 files changed, 26 insertions, 7 deletions
diff --git a/spec/frontend/lib/utils/text_utility_spec.js b/spec/frontend/lib/utils/text_utility_spec.js index 803b3629524..dc8f6c64136 100644 --- a/spec/frontend/lib/utils/text_utility_spec.js +++ b/spec/frontend/lib/utils/text_utility_spec.js @@ -94,8 +94,27 @@ describe('text_utility', () => { }); describe('convertToCamelCase', () => { - it('converts snake_case string to camelCase string', () => { - expect(textUtils.convertToCamelCase('snake_case')).toBe('snakeCase'); + it.each` + txt | result + ${'a_snake_cased_string'} | ${'aSnakeCasedString'} + ${'_leading_underscore'} | ${'_leadingUnderscore'} + ${'__leading_underscores'} | ${'__leadingUnderscores'} + ${'trailing_underscore_'} | ${'trailingUnderscore_'} + ${'trailing_underscores__'} | ${'trailingUnderscores__'} + `('converts string "$txt" to "$result"', ({ txt, result }) => { + expect(textUtils.convertToCamelCase(txt)).toBe(result); + }); + + it.each` + txt + ${'__withoutMiddleUnderscores__'} + ${''} + ${'with spaces'} + ${'with\nnew\r\nlines'} + ${'_'} + ${'___'} + `('does not modify string "$txt"', ({ txt }) => { + expect(textUtils.convertToCamelCase(txt)).toBe(txt); }); }); diff --git a/spec/frontend/releases/components/release_block_header_spec.js b/spec/frontend/releases/components/release_block_header_spec.js index 78adad13f69..44f6f63fa79 100644 --- a/spec/frontend/releases/components/release_block_header_spec.js +++ b/spec/frontend/releases/components/release_block_header_spec.js @@ -37,13 +37,13 @@ describe('Release block header', () => { const link = findHeaderLink(); expect(link.text()).toBe(release.name); - expect(link.attributes('href')).toBe(release.Links.self); + expect(link.attributes('href')).toBe(release._links.self); }); }); describe('when _links.self is missing', () => { beforeEach(() => { - factory({ Links: { self: null } }); + factory({ _links: { self: null } }); }); it('renders the title as text', () => { diff --git a/spec/frontend/releases/components/release_block_spec.js b/spec/frontend/releases/components/release_block_spec.js index 5d365b77560..ff88e3193bc 100644 --- a/spec/frontend/releases/components/release_block_spec.js +++ b/spec/frontend/releases/components/release_block_spec.js @@ -63,7 +63,7 @@ describe('Release block', () => { it('renders an edit button that links to the "Edit release" page', () => { expect(editButton().exists()).toBe(true); - expect(editButton().attributes('href')).toBe(release.Links.editUrl); + expect(editButton().attributes('href')).toBe(release._links.editUrl); }); it('renders release name', () => { @@ -150,8 +150,8 @@ describe('Release block', () => { }); }); - it("does not render an edit button if release.Links.editUrl isn't a string", () => { - delete release.Links; + it("does not render an edit button if release._links.editUrl isn't a string", () => { + delete release._links; return factory(release).then(() => { expect(editButton().exists()).toBe(false); |