@portabletext/plugin-emoji-picker 1.0.3 ā 1.0.4
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 +188 -293
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +190 -280
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/emoji-picker-machine.tsx +326 -389
- package/src/emoji-picker.feature +41 -12
- 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
|
|
|
@@ -139,28 +154,28 @@ Feature: Emoji Picker
|
|
|
139
154
|
Given the text <text>
|
|
140
155
|
And a "link" "l1" around <annotated>
|
|
141
156
|
When the caret is put <position>
|
|
142
|
-
And <
|
|
143
|
-
Then the
|
|
157
|
+
And <inserted text> is inserted
|
|
158
|
+
Then the keyword is <keyword>
|
|
144
159
|
|
|
145
160
|
Examples:
|
|
146
|
-
| text | annotated | position
|
|
147
|
-
| "foo bar baz" | "bar" | after "foo "
|
|
148
|
-
# | "foo bar baz" | "bar" | before "bar" | ":
|
|
149
|
-
| "foo bar baz" | "bar" | after "bar"
|
|
150
|
-
| "foo bar baz" | "bar" | before " baz" | ":joy:" | "foo ,bar,š baz" |
|
|
161
|
+
| text | annotated | position | inserted text | keyword |
|
|
162
|
+
| "foo bar baz" | "bar" | after "foo " | ":j" | "j" |
|
|
163
|
+
# | "foo bar baz" | "bar" | before "bar" | ":j" | "j" |
|
|
164
|
+
| "foo bar baz" | "bar" | after "bar" | ":j" | "j" |
|
|
151
165
|
|
|
166
|
+
# | "foo bar baz" | "bar" | before " baz" | ":j" | "j" |
|
|
152
167
|
Scenario Outline: Typing before the colon
|
|
153
168
|
Given the text <text>
|
|
154
|
-
When <
|
|
169
|
+
When <inserted text> is typed
|
|
155
170
|
And <button> is pressed
|
|
156
171
|
And <new text> is typed
|
|
157
172
|
And "{Enter}" is pressed
|
|
158
173
|
Then the text is <final text>
|
|
159
174
|
|
|
160
175
|
Examples:
|
|
161
|
-
| text |
|
|
162
|
-
| "" | ":j"
|
|
163
|
-
| "fo" | ":j"
|
|
176
|
+
| text | inserted text | button | new text | final text |
|
|
177
|
+
| "" | ":j" | "{ArrowLeft}{ArrowLeft}" | "f" | "f\|:j" |
|
|
178
|
+
| "fo" | ":j" | "{ArrowLeft}{ArrowLeft}" | "o" | "foo\|:j" |
|
|
164
179
|
|
|
165
180
|
Scenario Outline: Navigating away from the keyword
|
|
166
181
|
Given the text <text>
|
|
@@ -196,3 +211,17 @@ Feature: Emoji Picker
|
|
|
196
211
|
| "" | ":!!" | "!!" | "ā¼ļø" |
|
|
197
212
|
| "" | "::)" | ":)" | "š" |
|
|
198
213
|
| "" | "::" | ":" | "š" |
|
|
214
|
+
|
|
215
|
+
Scenario: Narrowing keyword by deletion
|
|
216
|
+
Given the text "foo"
|
|
217
|
+
When the caret is put after "fo"
|
|
218
|
+
And <inserted text> is inserted
|
|
219
|
+
And "{ArrowLeft}" is pressed
|
|
220
|
+
And "{Backspace}" is pressed
|
|
221
|
+
Then the text is <final text>
|
|
222
|
+
And the keyword is <keyword>
|
|
223
|
+
|
|
224
|
+
Examples:
|
|
225
|
+
| inserted text | final text | keyword |
|
|
226
|
+
| ":joy" | "fo:jyo" | "jy" |
|
|
227
|
+
| ":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'
|