@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.
@@ -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 <text>
114
- And "strong" around <decorated>
142
+ Given the text "foo bar baz"
143
+ And "strong" around "bar"
115
144
  When the caret is put <position>
116
- And <keyword> is typed
145
+ And ":joy:" is typed
117
146
  Then the text is <final text>
118
147
 
119
148
  Examples:
120
- | text | decorated | position | keyword | final text |
121
- | "foo bar baz" | "bar" | after "foo " | ":joy:" | "foo πŸ˜‚,bar, baz" |
122
- # | "foo bar baz" | "bar" | before "bar" | ":joy:" | "foo πŸ˜‚,bar, baz" |
123
- | "foo bar baz" | "bar" | after "bar" | ":joy:" | "foo ,barπŸ˜‚, baz" |
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 <text>
140
- And a "link" "l1" around <annotated>
182
+ Given the text "foo bar baz"
183
+ And a "link" "l1" around "bar"
141
184
  When the caret is put <position>
142
- And <keyword> is typed
185
+ And ":joy:" is typed
143
186
  Then the text is <final text>
144
187
 
145
188
  Examples:
146
- | text | annotated | position | keyword | final text |
147
- | "foo bar baz" | "bar" | after "foo " | ":joy:" | "foo πŸ˜‚,bar, baz" |
148
- # | "foo bar baz" | "bar" | before "bar" | ":joy:" | "foo πŸ˜‚,bar, baz" |
149
- | "foo bar baz" | "bar" | after "bar" | ":joy:" | "foo ,bar,πŸ˜‚ baz" |
150
- | "foo bar baz" | "bar" | before " baz" | ":joy:" | "foo ,bar,πŸ˜‚ baz" |
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 <keyword> is typed
197
+ When <inserted text> is typed
155
198
  And <button> is pressed
156
199
  And <new text> is typed
157
- And "{Enter}" is pressed
158
- Then the text is <final text>
200
+ Then the keyword is ""
159
201
 
160
202
  Examples:
161
- | text | keyword | button | new text | final text |
162
- | "" | ":j" | "{ArrowLeft}{ArrowLeft}" | "f" | "f\|:j" |
163
- | "fo" | ":j" | "{ArrowLeft}{ArrowLeft}" | "o" | "foo\|: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'