-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slugify selector: Remove leading & trailing dash (#2202)
- Loading branch information
1 parent
6326203
commit 04c1528
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { expect } = require('chai'); | ||
const { slugify } = require('../../utils/slugify'); | ||
|
||
describe('slugify', () => { | ||
it('should return new slug', () => { | ||
const slug = slugify('This is a test slug, and this is fine'); | ||
expect(slug).to.equal('this-is-a-test-slug-and-this-is-fine'); | ||
}); | ||
it('should return new slug without trailing dash', () => { | ||
const slug = slugify('This is a test slug, and this is fine |'); | ||
expect(slug).to.equal('this-is-a-test-slug-and-this-is-fine'); | ||
}); | ||
it('should return new slug without leading dash', () => { | ||
const slug = slugify('| This is a test slug, and this is fine |'); | ||
expect(slug).to.equal('this-is-a-test-slug-and-this-is-fine'); | ||
}); | ||
it('should return new slug without emoji', () => { | ||
const slug = slugify('😀 Test emoji test 😀'); | ||
expect(slug).to.equal('test-emoji-test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters