Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
c88d9cf3
Commit
c88d9cf3
authored
Jun 02, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NPE with horse racing emoji check
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/32587
parent
256a8601
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
app/assets/javascripts/behaviors/gl_emoji.js
app/assets/javascripts/behaviors/gl_emoji.js
+1
-0
app/assets/javascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js
...ascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js
+2
-1
spec/javascripts/gl_emoji_spec.js
spec/javascripts/gl_emoji_spec.js
+31
-0
No files found.
app/assets/javascripts/behaviors/gl_emoji.js
View file @
c88d9cf3
...
@@ -88,6 +88,7 @@ function installGlEmojiElement() {
...
@@ -88,6 +88,7 @@ function installGlEmojiElement() {
const
hasCssSpriteFalback
=
fallbackSpriteClass
&&
fallbackSpriteClass
.
length
>
0
;
const
hasCssSpriteFalback
=
fallbackSpriteClass
&&
fallbackSpriteClass
.
length
>
0
;
if
(
if
(
emojiUnicode
&&
isEmojiUnicode
&&
isEmojiUnicode
&&
!
isEmojiUnicodeSupported
(
generatedUnicodeSupportMap
,
emojiUnicode
,
unicodeVersion
)
!
isEmojiUnicodeSupported
(
generatedUnicodeSupportMap
,
emojiUnicode
,
unicodeVersion
)
)
{
)
{
...
...
app/assets/javascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js
View file @
c88d9cf3
...
@@ -28,7 +28,8 @@ function isSkinToneComboEmoji(emojiUnicode) {
...
@@ -28,7 +28,8 @@ function isSkinToneComboEmoji(emojiUnicode) {
// doesn't support the skin tone versions of horse racing
// doesn't support the skin tone versions of horse racing
const
horseRacingCodePoint
=
127943
;
// parseInt('1F3C7', 16)
const
horseRacingCodePoint
=
127943
;
// parseInt('1F3C7', 16)
function
isHorceRacingSkinToneComboEmoji
(
emojiUnicode
)
{
function
isHorceRacingSkinToneComboEmoji
(
emojiUnicode
)
{
return
Array
.
from
(
emojiUnicode
)[
0
].
codePointAt
(
0
)
===
horseRacingCodePoint
&&
const
firstCharacter
=
Array
.
from
(
emojiUnicode
)[
0
];
return
firstCharacter
&&
firstCharacter
.
codePointAt
(
0
)
===
horseRacingCodePoint
&&
isSkinToneComboEmoji
(
emojiUnicode
);
isSkinToneComboEmoji
(
emojiUnicode
);
}
}
...
...
spec/javascripts/gl_emoji_spec.js
View file @
c88d9cf3
...
@@ -192,6 +192,9 @@ describe('gl_emoji', () => {
...
@@ -192,6 +192,9 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isFlagEmoji
'
,
()
=>
{
describe
(
'
isFlagEmoji
'
,
()
=>
{
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isFlagEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect flag_ac
'
,
()
=>
{
it
(
'
should detect flag_ac
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇦🇨
'
)).
toBeTruthy
();
expect
(
isFlagEmoji
(
'
🇦🇨
'
)).
toBeTruthy
();
});
});
...
@@ -216,6 +219,9 @@ describe('gl_emoji', () => {
...
@@ -216,6 +219,9 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isKeycapEmoji
'
,
()
=>
{
describe
(
'
isKeycapEmoji
'
,
()
=>
{
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isKeycapEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect one(keycap)
'
,
()
=>
{
it
(
'
should detect one(keycap)
'
,
()
=>
{
expect
(
isKeycapEmoji
(
'
1️⃣
'
)).
toBeTruthy
();
expect
(
isKeycapEmoji
(
'
1️⃣
'
)).
toBeTruthy
();
});
});
...
@@ -231,6 +237,9 @@ describe('gl_emoji', () => {
...
@@ -231,6 +237,9 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isSkinToneComboEmoji
'
,
()
=>
{
describe
(
'
isSkinToneComboEmoji
'
,
()
=>
{
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect hand_splayed_tone5
'
,
()
=>
{
it
(
'
should detect hand_splayed_tone5
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🖐🏿
'
)).
toBeTruthy
();
expect
(
isSkinToneComboEmoji
(
'
🖐🏿
'
)).
toBeTruthy
();
});
});
...
@@ -255,6 +264,9 @@ describe('gl_emoji', () => {
...
@@ -255,6 +264,9 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isHorceRacingSkinToneComboEmoji
'
,
()
=>
{
describe
(
'
isHorceRacingSkinToneComboEmoji
'
,
()
=>
{
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isHorceRacingSkinToneComboEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect horse_racing_tone2
'
,
()
=>
{
it
(
'
should detect horse_racing_tone2
'
,
()
=>
{
expect
(
isHorceRacingSkinToneComboEmoji
(
'
🏇🏼
'
)).
toBeTruthy
();
expect
(
isHorceRacingSkinToneComboEmoji
(
'
🏇🏼
'
)).
toBeTruthy
();
});
});
...
@@ -264,6 +276,9 @@ describe('gl_emoji', () => {
...
@@ -264,6 +276,9 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isPersonZwjEmoji
'
,
()
=>
{
describe
(
'
isPersonZwjEmoji
'
,
()
=>
{
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect couple_mm
'
,
()
=>
{
it
(
'
should detect couple_mm
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👨❤️👨
'
)).
toBeTruthy
();
expect
(
isPersonZwjEmoji
(
'
👨❤️👨
'
)).
toBeTruthy
();
});
});
...
@@ -300,6 +315,22 @@ describe('gl_emoji', () => {
...
@@ -300,6 +315,22 @@ describe('gl_emoji', () => {
});
});
describe
(
'
isEmojiUnicodeSupported
'
,
()
=>
{
describe
(
'
isEmojiUnicodeSupported
'
,
()
=>
{
it
(
'
should gracefully handle empty string with unicode support
'
,
()
=>
{
const
isSupported
=
isEmojiUnicodeSupported
(
{
'
1.0
'
:
true
},
''
,
'
1.0
'
,
);
expect
(
isSupported
).
toBeTruthy
();
});
it
(
'
should gracefully handle empty string without unicode support
'
,
()
=>
{
const
isSupported
=
isEmojiUnicodeSupported
(
{},
''
,
'
1.0
'
,
);
expect
(
isSupported
).
toBeFalsy
();
});
it
(
'
bomb(6.0) with 6.0 support
'
,
()
=>
{
it
(
'
bomb(6.0) with 6.0 support
'
,
()
=>
{
const
emojiKey
=
'
bomb
'
;
const
emojiKey
=
'
bomb
'
;
const
unicodeSupportMap
=
Object
.
assign
({},
emptySupportMap
,
{
const
unicodeSupportMap
=
Object
.
assign
({},
emptySupportMap
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment