summaryrefslogtreecommitdiff
path: root/spec/frontend/lib/utils/text_utility_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 21:12:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 21:12:27 +0000
commitd657831613232fb95226c076343cd320c6573886 (patch)
tree0c33f1bd5a4f11bb8a33d2a8dc4fe6c3d6c303a9 /spec/frontend/lib/utils/text_utility_spec.js
parent99aa31992d4398d35c9df4854f5fb494984a9e0b (diff)
downloadgitlab-ce-d657831613232fb95226c076343cd320c6573886.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/utils/text_utility_spec.js')
-rw-r--r--spec/frontend/lib/utils/text_utility_spec.js35
1 files changed, 12 insertions, 23 deletions
diff --git a/spec/frontend/lib/utils/text_utility_spec.js b/spec/frontend/lib/utils/text_utility_spec.js
index 8e31fc792c5..49a160c9f23 100644
--- a/spec/frontend/lib/utils/text_utility_spec.js
+++ b/spec/frontend/lib/utils/text_utility_spec.js
@@ -45,29 +45,18 @@ describe('text_utility', () => {
});
describe('slugify', () => {
- it('should remove accents and convert to lower case', () => {
- expect(textUtils.slugify('João')).toEqual('jo-o');
- });
- it('should replaces whitespaces with hyphens and convert to lower case', () => {
- expect(textUtils.slugify('My Input String')).toEqual('my-input-string');
- });
- it('should remove trailing whitespace and replace whitespaces within string with a hyphen', () => {
- 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');
- });
- it('should squash multiple hypens', () => {
- 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');
+ it.each`
+ title | input | output
+ ${'should remove accents and convert to lower case'} | ${'João'} | ${'jo-o'}
+ ${'should replaces whitespaces with hyphens and convert to lower case'} | ${'My Input String'} | ${'my-input-string'}
+ ${'should remove trailing whitespace and replace whitespaces within string with a hyphen'} | ${' a new project '} | ${'a-new-project'}
+ ${'should only remove non-allowed special characters'} | ${'test!_pro-ject~'} | ${'test-_pro-ject'}
+ ${'should squash to multiple non-allowed special characters'} | ${'test!!!!_pro-ject~'} | ${'test-_pro-ject'}
+ ${'should return empty string if only non-allowed characters'} | ${'дружба'} | ${''}
+ ${'should squash multiple separators'} | ${'Test:-)'} | ${'test'}
+ ${'should trim any separators from the beginning and end of the slug'} | ${'-Test:-)-'} | ${'test'}
+ `('$title', ({ input, output }) => {
+ expect(textUtils.slugify(input)).toBe(output);
});
});