@portabletext/plugin-emoji-picker 1.0.3 β 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +241 -270
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +245 -258
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/emoji-picker-machine.tsx +444 -377
- package/src/emoji-picker.feature +81 -24
- package/src/emoji-picker.test.tsx +1 -1
package/src/emoji-picker.feature
CHANGED
|
@@ -14,6 +14,21 @@ Feature: Emoji Picker
|
|
|
14
14
|
| ":jo" | "y:" | "π" |
|
|
15
15
|
| ":joy" | ":" | "π" |
|
|
16
16
|
|
|
17
|
+
Scenario Outline: Is only triggered when an initial colon is typed
|
|
18
|
+
Given the text <text>
|
|
19
|
+
When the caret is put <position>
|
|
20
|
+
And <inserted text> is inserted
|
|
21
|
+
Then the text is <final text>
|
|
22
|
+
And the keyword is <keyword>
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
| text | position | inserted text | final text | keyword |
|
|
26
|
+
| "" | after "" | ":j" | ":j" | "j" |
|
|
27
|
+
| ":" | after ":" | "j" | ":j" | "" |
|
|
28
|
+
| ":j" | after ":j" | "o" | ":jo" | "" |
|
|
29
|
+
| ":jo" | after ":jo" | ":" | ":jo:" | "" |
|
|
30
|
+
| ":joy" | after ":joy" | ":" | ":joy:" | "" |
|
|
31
|
+
|
|
17
32
|
Scenario: Undo after direct hit
|
|
18
33
|
When ":joy:" is typed
|
|
19
34
|
Then the text is "π"
|
|
@@ -25,7 +40,7 @@ Feature: Emoji Picker
|
|
|
25
40
|
And undo is performed
|
|
26
41
|
And "{Backspace}" is pressed
|
|
27
42
|
And ":" is typed
|
|
28
|
-
Then the text is "
|
|
43
|
+
Then the text is ":joy:"
|
|
29
44
|
And the keyword is ""
|
|
30
45
|
And the matches are ""
|
|
31
46
|
|
|
@@ -109,20 +124,34 @@ Feature: Emoji Picker
|
|
|
109
124
|
| "foo bar baz" | "bar" | before "ar baz" | ":joy:" | "foo ,bπar, baz" |
|
|
110
125
|
| "foo bar baz" | "bar" | before "r baz" | ":joy:" | "foo ,baπr, baz" |
|
|
111
126
|
|
|
127
|
+
Scenario Outline: Triggering at the edge of decorator
|
|
128
|
+
Given the text "foo bar baz"
|
|
129
|
+
And "strong" around "bar"
|
|
130
|
+
When the caret is put <position>
|
|
131
|
+
And ":j" is typed
|
|
132
|
+
Then the keyword is "j"
|
|
133
|
+
|
|
134
|
+
Examples:
|
|
135
|
+
| position |
|
|
136
|
+
| after "foo " |
|
|
137
|
+
| before "bar" |
|
|
138
|
+
| after "bar" |
|
|
139
|
+
| before " baz" |
|
|
140
|
+
|
|
112
141
|
Scenario Outline: Matching at the edge of decorator
|
|
113
|
-
Given the text
|
|
114
|
-
And "strong" around
|
|
142
|
+
Given the text "foo bar baz"
|
|
143
|
+
And "strong" around "bar"
|
|
115
144
|
When the caret is put <position>
|
|
116
|
-
And
|
|
145
|
+
And ":joy:" is typed
|
|
117
146
|
Then the text is <final text>
|
|
118
147
|
|
|
119
148
|
Examples:
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
123
|
-
|
|
|
149
|
+
| position | final text |
|
|
150
|
+
| after "foo " | "foo π,bar, baz" |
|
|
151
|
+
| before "bar" | "foo π,bar, baz" |
|
|
152
|
+
| after "bar" | "foo ,barπ, baz" |
|
|
153
|
+
| before " baz" | "foo ,barπ, baz" |
|
|
124
154
|
|
|
125
|
-
# | "foo bar baz" | "bar" | before " baz" | ":joy:" | "foo ,barπ, baz" |
|
|
126
155
|
Scenario Outline: Matching inside annotation
|
|
127
156
|
Given the text <text>
|
|
128
157
|
And a "link" "l1" around <annotated>
|
|
@@ -135,32 +164,46 @@ Feature: Emoji Picker
|
|
|
135
164
|
| "foo bar baz" | "bar" | before "ar baz" | ":joy:" | "foo ,bπar, baz" |
|
|
136
165
|
| "foo bar baz" | "bar" | before "r baz" | ":joy:" | "foo ,baπr, baz" |
|
|
137
166
|
|
|
167
|
+
Scenario Outline: Triggering at the edge of an annotation
|
|
168
|
+
Given the text "foo bar baz"
|
|
169
|
+
And a "link" "l1" around "bar"
|
|
170
|
+
When the caret is put <position>
|
|
171
|
+
And ":j" is typed
|
|
172
|
+
Then the keyword is "j"
|
|
173
|
+
|
|
174
|
+
Examples:
|
|
175
|
+
| position |
|
|
176
|
+
| after "foo " |
|
|
177
|
+
| before "bar" |
|
|
178
|
+
| after "bar" |
|
|
179
|
+
| before " baz" |
|
|
180
|
+
|
|
138
181
|
Scenario Outline: Matching at the edge of an annotation
|
|
139
|
-
Given the text
|
|
140
|
-
And a "link" "l1" around
|
|
182
|
+
Given the text "foo bar baz"
|
|
183
|
+
And a "link" "l1" around "bar"
|
|
141
184
|
When the caret is put <position>
|
|
142
|
-
And
|
|
185
|
+
And ":joy:" is typed
|
|
143
186
|
Then the text is <final text>
|
|
144
187
|
|
|
145
188
|
Examples:
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
149
|
-
|
|
|
150
|
-
|
|
|
189
|
+
| position | final text |
|
|
190
|
+
| after "foo " | "foo π,bar, baz" |
|
|
191
|
+
| before "bar" | "foo π,bar, baz" |
|
|
192
|
+
| after "bar" | "foo ,bar,π baz" |
|
|
193
|
+
| before " baz" | "foo ,bar,π baz" |
|
|
151
194
|
|
|
152
|
-
Scenario Outline: Typing before the colon
|
|
195
|
+
Scenario Outline: Typing before the colon dismisses the emoji picker
|
|
153
196
|
Given the text <text>
|
|
154
|
-
When <
|
|
197
|
+
When <inserted text> is typed
|
|
155
198
|
And <button> is pressed
|
|
156
199
|
And <new text> is typed
|
|
157
|
-
|
|
158
|
-
Then the text is <final text>
|
|
200
|
+
Then the keyword is ""
|
|
159
201
|
|
|
160
202
|
Examples:
|
|
161
|
-
| text |
|
|
162
|
-
| "" | ":j"
|
|
163
|
-
| "fo" | ":j"
|
|
203
|
+
| text | inserted text | button | new text |
|
|
204
|
+
| "" | ":j" | "{ArrowLeft}{ArrowLeft}" | "f" |
|
|
205
|
+
| "fo" | ":j" | "{ArrowLeft}{ArrowLeft}" | "o" |
|
|
206
|
+
| "" | ":j" | "{ArrowLeft}{ArrowLeft}" | ":" |
|
|
164
207
|
|
|
165
208
|
Scenario Outline: Navigating away from the keyword
|
|
166
209
|
Given the text <text>
|
|
@@ -196,3 +239,17 @@ Feature: Emoji Picker
|
|
|
196
239
|
| "" | ":!!" | "!!" | "βΌοΈ" |
|
|
197
240
|
| "" | "::)" | ":)" | "π" |
|
|
198
241
|
| "" | "::" | ":" | "π" |
|
|
242
|
+
|
|
243
|
+
Scenario: Narrowing keyword by deletion
|
|
244
|
+
Given the text "foo"
|
|
245
|
+
When the caret is put after "fo"
|
|
246
|
+
And <inserted text> is inserted
|
|
247
|
+
And "{ArrowLeft}" is pressed
|
|
248
|
+
And "{Backspace}" is pressed
|
|
249
|
+
Then the text is <final text>
|
|
250
|
+
And the keyword is <keyword>
|
|
251
|
+
|
|
252
|
+
Examples:
|
|
253
|
+
| inserted text | final text | keyword |
|
|
254
|
+
| ":joy" | "fo:jyo" | "jy" |
|
|
255
|
+
| ":jπ»y" | "fo:jyo" | "jy" |
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
type Context,
|
|
6
6
|
} from '@portabletext/editor/test/vitest'
|
|
7
7
|
import {defineSchema} from '@portabletext/schema'
|
|
8
|
-
import {page, type Locator} from '@vitest/browser/context'
|
|
9
8
|
import {Before, Then} from 'racejar'
|
|
10
9
|
import {Feature} from 'racejar/vitest'
|
|
11
10
|
import {expect, vi} from 'vitest'
|
|
11
|
+
import {page, type Locator} from 'vitest/browser'
|
|
12
12
|
import {createMatchEmojis} from './create-match-emojis'
|
|
13
13
|
import emojiPickerFeature from './emoji-picker.feature?raw'
|
|
14
14
|
import {useEmojiPicker} from './use-emoji-picker'
|