mirror of https://github.com/status-im/gomoji.git
add support of skin tone emojis (#7)
Co-authored-by: Vlad Gukasov <v.gukasov@space307.com>
This commit is contained in:
parent
7b2d9f4f48
commit
da2f8099da
22
README.md
22
README.md
|
@ -61,16 +61,16 @@ Result:
|
||||||
{
|
{
|
||||||
Slug: "person-in-steamy-room",
|
Slug: "person-in-steamy-room",
|
||||||
Character: "🧖",
|
Character: "🧖",
|
||||||
UnicodeName: "person in steamy room",
|
UnicodeName: "E5.0 person in steamy room",
|
||||||
CodePoint: "U+1F9D6",
|
CodePoint: "1F9D6",
|
||||||
Group: "People & Body",
|
Group: "People & Body",
|
||||||
SubGroup: "person-activity",
|
SubGroup: "person-activity",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Slug: "butterfly",
|
Slug: "butterfly",
|
||||||
Character: "🦋",
|
Character: "🦋",
|
||||||
UnicodeName: "butterfly",
|
UnicodeName: "E3.0 butterfly",
|
||||||
CodePoint: "U+1F98B",
|
CodePoint: "1F98B",
|
||||||
Group: "Animals & Nature",
|
Group: "Animals & Nature",
|
||||||
SubGroup: "animal-bug",
|
SubGroup: "animal-bug",
|
||||||
},
|
},
|
||||||
|
@ -115,10 +115,10 @@ Result:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
gomoji.Entity{
|
gomoji.Entity{
|
||||||
Slug: "keycap:-1",
|
Slug: "keycap-1",
|
||||||
Character: "1️⃣",
|
Character: "1️⃣",
|
||||||
UnicodeName: "keycap: 1",
|
UnicodeName: "E0.6 keycap: 1",
|
||||||
CodePoint: "U+0031 U+FE0F U+20E3",
|
CodePoint: "0031 FE0F 20E3",
|
||||||
Group: "Symbols",
|
Group: "Symbols",
|
||||||
SubGroup: "keycap",
|
SubGroup: "keycap",
|
||||||
}
|
}
|
||||||
|
@ -140,19 +140,19 @@ Example:
|
||||||
```go
|
```go
|
||||||
[]gomoji.Emoji{
|
[]gomoji.Emoji{
|
||||||
{
|
{
|
||||||
Slug: "e3-0-butterfly",
|
Slug: "butterfly",
|
||||||
Character: "🦋",
|
Character: "🦋",
|
||||||
UnicodeName: "E3.0 butterfly",
|
UnicodeName: "E3.0 butterfly",
|
||||||
CodePoint: "1F98B",
|
CodePoint: "1F98B",
|
||||||
Group: "animals-nature",
|
Group: "Animals & Nature",
|
||||||
SubGroup: "animal-bug",
|
SubGroup: "animal-bug",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Slug: "roll-of-paper",
|
Slug: "roll-of-paper",
|
||||||
Character: "🧻",
|
Character: "🧻",
|
||||||
UnicodeName: "roll of paper",
|
UnicodeName: "E11.0 roll of paper",
|
||||||
CodePoint: "1F9FB",
|
CodePoint: "1F9FB",
|
||||||
Group: "objects",
|
Group: "Objects",
|
||||||
SubGroup: "household",
|
SubGroup: "household",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,31 @@ func TestContainsEmoji(t *testing.T) {
|
||||||
inputStr: "I ❤️ you",
|
inputStr: "I ❤️ you",
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "it determines the skintone emojis",
|
||||||
|
inputStr: "I 👍🏿 you",
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "double exclamation mark in text",
|
||||||
|
inputStr: "Hello!!",
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "double exclamation mark emoji in text",
|
||||||
|
inputStr: "Hello‼",
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "emoji keycap # in text",
|
||||||
|
inputStr: "Just type #⃣",
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "text keycap # in text",
|
||||||
|
inputStr: "Just type #",
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
@ -152,10 +177,10 @@ func TestGetInfo(t *testing.T) {
|
||||||
name: "valid emoji number",
|
name: "valid emoji number",
|
||||||
inputEmoji: "1️⃣",
|
inputEmoji: "1️⃣",
|
||||||
want: Emoji{
|
want: Emoji{
|
||||||
Slug: "keycap:-1",
|
Slug: "keycap-1",
|
||||||
Character: "1️⃣",
|
Character: "1️⃣",
|
||||||
UnicodeName: "keycap: 1",
|
UnicodeName: "E0.6 keycap: 1",
|
||||||
CodePoint: "U+0031 U+FE0F U+20E3",
|
CodePoint: "0031 FE0F 20E3",
|
||||||
Group: "Symbols",
|
Group: "Symbols",
|
||||||
SubGroup: "keycap",
|
SubGroup: "keycap",
|
||||||
},
|
},
|
||||||
|
@ -165,10 +190,10 @@ func TestGetInfo(t *testing.T) {
|
||||||
name: "unicode 14",
|
name: "unicode 14",
|
||||||
inputEmoji: "\U0001FAAC",
|
inputEmoji: "\U0001FAAC",
|
||||||
want: Emoji{
|
want: Emoji{
|
||||||
Slug: "⊛-hamsa",
|
Slug: "hamsa",
|
||||||
Character: "🪬",
|
Character: "🪬",
|
||||||
UnicodeName: "⊛ hamsa",
|
UnicodeName: "E14.0 hamsa",
|
||||||
CodePoint: "U+1FAAC",
|
CodePoint: "1FAAC",
|
||||||
Group: "Activities",
|
Group: "Activities",
|
||||||
SubGroup: "game",
|
SubGroup: "game",
|
||||||
},
|
},
|
||||||
|
@ -226,16 +251,16 @@ func TestFindAll(t *testing.T) {
|
||||||
{
|
{
|
||||||
Slug: "butterfly",
|
Slug: "butterfly",
|
||||||
Character: "🦋",
|
Character: "🦋",
|
||||||
UnicodeName: "butterfly",
|
UnicodeName: "E3.0 butterfly",
|
||||||
CodePoint: "U+1F98B",
|
CodePoint: "1F98B",
|
||||||
Group: "Animals & Nature",
|
Group: "Animals & Nature",
|
||||||
SubGroup: "animal-bug",
|
SubGroup: "animal-bug",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Slug: "roll-of-paper",
|
Slug: "roll-of-paper",
|
||||||
Character: "🧻",
|
Character: "🧻",
|
||||||
UnicodeName: "roll of paper",
|
UnicodeName: "E11.0 roll of paper",
|
||||||
CodePoint: "U+1F9FB",
|
CodePoint: "1F9FB",
|
||||||
Group: "Objects",
|
Group: "Objects",
|
||||||
SubGroup: "household",
|
SubGroup: "household",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue