-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update search for colon-syntax emoji to ignore case (#3443)
* Add tests for existing replaceColons functionality * Update to lowercase before matching short names * Update lib_test.ts
- Loading branch information
1 parent
cb27211
commit f2dd10c
Showing
2 changed files
with
31 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
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,30 @@ | ||
import { assert } from 'chai'; | ||
|
||
import { replaceColons } from '../../../components/emoji/lib'; | ||
|
||
describe('replaceColons', () => { | ||
it('replaces known emoji short names between colons', () => { | ||
const anEmoji = replaceColons('hello :grinning:'); | ||
assert.equal(anEmoji, 'hello 😀'); | ||
}); | ||
|
||
it('understands skin tone modifiers', () => { | ||
const skinToneModifierEmoji = replaceColons('hello :wave::skin-tone-5:!'); | ||
assert.equal(skinToneModifierEmoji, 'hello 👋🏿!'); | ||
}); | ||
|
||
it('passes through strings with no colons', () => { | ||
const noEmoji = replaceColons('hello'); | ||
assert.equal(noEmoji, 'hello'); | ||
}); | ||
|
||
it('ignores unknown emoji', () => { | ||
const unknownEmoji = replaceColons(':Unknown: :unknown:'); | ||
assert.equal(unknownEmoji, ':Unknown: :unknown:'); | ||
}); | ||
|
||
it('converts short names to lowercase before matching them', () => { | ||
const emojiWithCaps = replaceColons('hello :Grinning:'); | ||
assert.equal(emojiWithCaps, 'hello 😀'); | ||
}); | ||
}); |