use better emoji removal algorithm (#452)

another follow-up to #450 to fix #449
This commit is contained in:
Nolan Lawson 2018-08-19 20:25:28 -07:00 committed by GitHub
parent af1d4b63d3
commit aea952daf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import { replaceAll } from './strings' import { replaceAll } from './strings'
import emojiRegex from 'emoji-regex' import emojiRegex from 'emoji-regex/es2015/text.js'
let theEmojiRegex let theEmojiRegex

View file

@ -106,3 +106,23 @@ test('Check status aria labels for de-emojified text', async t => {
.click(displayNameInComposeBox) .click(displayNameInComposeBox)
.expect(getNthStatus(0).getAttribute('aria-label')).eql('Status by 🌈 foo :blobpats: 🌈') .expect(getNthStatus(0).getAttribute('aria-label')).eql('Status by 🌈 foo :blobpats: 🌈')
}) })
test('Check some odd emoji', async t => {
await updateUserDisplayNameAs('foobar', 'foo 🕹📺')
await sleep(1000)
await loginAsFoobar(t)
await t
.expect(displayNameInComposeBox.innerText).eql('foo 🕹📺')
.click(settingsNavButton)
.click(generalSettingsButton)
.click(removeEmojiFromDisplayNamesInput)
.expect(removeEmojiFromDisplayNamesInput.checked).ok()
.click(homeNavButton)
.expect(displayNameInComposeBox.innerText).eql('foo')
.click(settingsNavButton)
.click(generalSettingsButton)
.click(removeEmojiFromDisplayNamesInput)
.expect(removeEmojiFromDisplayNamesInput.checked).notOk()
.click(homeNavButton)
.expect(displayNameInComposeBox.innerText).eql('foo 🕹📺')
})