1
- import { parser } from '../src' ;
1
+ import { parse } from '../src' ;
2
2
import { bigEmoji , paragraph , plain , emoticon } from '../src/utils' ;
3
3
4
4
test . each ( [
5
- [ '=) asd' , [ paragraph ( [ emoticon ( '=)' , 'slight_smile' ) , plain ( ' asd' ) ] ) ] ] ,
5
+ // Should render normal Emojis
6
6
[
7
- `=)
8
- =)
9
- ` ,
7
+ `test
8
+ :) test` ,
10
9
[
11
- bigEmoji ( [
12
- emoticon ( '=)' , 'slight_smile' ) ,
13
- emoticon ( '=)' , 'slight_smile' ) ,
10
+ paragraph ( [ plain ( 'test' ) ] ) ,
11
+ paragraph ( [
12
+ plain ( ' ' ) ,
13
+ emoticon ( ':)' , 'slight_smile' ) ,
14
+ plain ( ' test' ) ,
14
15
] ) ,
15
16
] ,
16
17
] ,
18
+ [ ':) asd' , [ paragraph ( [ emoticon ( ':)' , 'slight_smile' ) , plain ( ' asd' ) ] ) ] ] ,
19
+ [ ':) asd' , [ paragraph ( [ emoticon ( ':)' , 'slight_smile' ) , plain ( ' asd' ) ] ) ] ] ,
20
+ [
21
+ ' :) asd' ,
22
+ [ paragraph ( [ plain ( ' ' ) , emoticon ( ':)' , 'slight_smile' ) , plain ( ' asd' ) ] ) ] ,
23
+ ] ,
24
+ [ 'Hi :)' , [ paragraph ( [ plain ( 'Hi ' ) , emoticon ( ':)' , 'slight_smile' ) ] ) ] ] ,
17
25
[
18
- 'asdas = ) asd' ,
26
+ 'asdas : ) asd' ,
19
27
[
20
28
paragraph ( [
21
29
plain ( 'asdas ' ) ,
22
- emoticon ( '= )' , 'slight_smile' ) ,
30
+ emoticon ( ': )' , 'slight_smile' ) ,
23
31
plain ( ' asd' ) ,
24
32
] ) ,
25
33
] ,
26
34
] ,
27
35
[
28
- 'normal emojis :):) :)' ,
36
+ ':) :) :) :)' ,
29
37
[
30
38
paragraph ( [
31
- plain ( 'normal emojis ' ) ,
32
39
emoticon ( ':)' , 'slight_smile' ) ,
40
+ plain ( ' ' ) ,
41
+ emoticon ( ':)' , 'slight_smile' ) ,
42
+ plain ( ' ' ) ,
43
+ emoticon ( ':)' , 'slight_smile' ) ,
44
+ plain ( ' ' ) ,
45
+ emoticon ( ':)' , 'slight_smile' ) ,
46
+ ] ) ,
47
+ ] ,
48
+ ] ,
49
+
50
+ // Should render BigEmojis
51
+ [
52
+ `:)
53
+ :)
54
+ ` ,
55
+ [
56
+ bigEmoji ( [
33
57
emoticon ( ':)' , 'slight_smile' ) ,
34
58
emoticon ( ':)' , 'slight_smile' ) ,
35
59
] ) ,
@@ -45,6 +69,7 @@ test.each([
45
69
] ) ,
46
70
] ,
47
71
] ,
72
+
48
73
[
49
74
' :):):) ' ,
50
75
[
@@ -55,6 +80,7 @@ test.each([
55
80
] ) ,
56
81
] ,
57
82
] ,
83
+
58
84
[
59
85
'\n :):):) \n' ,
60
86
[
@@ -75,8 +101,9 @@ test.each([
75
101
] ) ,
76
102
] ,
77
103
] ,
104
+
78
105
[
79
- ':):)' ,
106
+ ':) :)' ,
80
107
[
81
108
bigEmoji ( [
82
109
emoticon ( ':)' , 'slight_smile' ) ,
@@ -85,6 +112,20 @@ test.each([
85
112
] ,
86
113
] ,
87
114
[ ':)' , [ bigEmoji ( [ emoticon ( ':)' , 'slight_smile' ) ] ) ] ] ,
115
+ [ ' :)' , [ bigEmoji ( [ emoticon ( ':)' , 'slight_smile' ) ] ) ] ] ,
116
+ [ ':) ' , [ bigEmoji ( [ emoticon ( ':)' , 'slight_smile' ) ] ) ] ] ,
117
+ [ ' :) ' , [ bigEmoji ( [ emoticon ( ':)' , 'slight_smile' ) ] ) ] ] ,
118
+
119
+ // Should not render Emojis or BigEmojis if they are not surrounded by spaces
120
+ [ 'normal emojis :):):)' , [ paragraph ( [ plain ( 'normal emojis :):):)' ) ] ) ] ] ,
121
+ [ ':):):) normal emojis' , [ paragraph ( [ plain ( ':):):) normal emojis' ) ] ) ] ] ,
122
+ [ ':):):):)' , [ paragraph ( [ plain ( ':):):):)' ) ] ) ] ] ,
123
+ [ '10:30' , [ paragraph ( [ plain ( '10:30' ) ] ) ] ] ,
124
+ [ 'he:)llo' , [ paragraph ( [ plain ( 'he:)llo' ) ] ) ] ] ,
125
+ [ ':)Hi' , [ paragraph ( [ plain ( ':)Hi' ) ] ) ] ] ,
126
+ [ 'Hi:) Hi' , [ paragraph ( [ plain ( 'Hi:) Hi' ) ] ) ] ] ,
127
+ [ 'Hi:)' , [ paragraph ( [ plain ( 'Hi:)' ) ] ) ] ] ,
128
+ [ '@#@#! :)@!@' , [ paragraph ( [ plain ( '@#@#! :)@!@' ) ] ) ] ] ,
88
129
] ) ( 'parses %p' , ( input , output ) => {
89
- expect ( parser ( input , { emoticons : true } ) ) . toMatchObject ( output ) ;
130
+ expect ( parse ( input , { emoticons : true } ) ) . toMatchObject ( output ) ;
90
131
} ) ;
0 commit comments