@jackuait/blok 0.7.0-beta.2 → 0.7.0-beta.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/blok.mjs +2 -2
- package/dist/chunks/{blok-D9Rs29Wo.mjs → blok-B0pAWdVk.mjs} +451 -440
- package/dist/chunks/{constants-DmNIR3I8.mjs → constants-DmDwNSTM.mjs} +1 -1
- package/dist/chunks/{i18next-loader-C2-jYpLi.mjs → i18next-loader-v9SlYZ0i.mjs} +1 -1
- package/dist/chunks/{index-D7V1g7Oq.mjs → index-DHLWzZaA.mjs} +1 -1
- package/dist/full.mjs +2 -2
- package/dist/tools.mjs +77 -54
- package/package.json +1 -1
- package/src/components/modules/blockManager/operations.ts +28 -1
- package/src/components/modules/ui.ts +18 -8
- package/src/stories/Block.stories.ts +21 -0
- package/src/stories/EditorModes.stories.ts +19 -0
- package/src/stories/InlineToolbar.stories.ts +41 -9
- package/src/stories/MarkerColors.stories.ts +48 -52
- package/src/stories/Notifier.stories.ts +19 -1
- package/src/stories/Placeholder.stories.ts +12 -0
- package/src/stories/Popover.stories.ts +26 -0
- package/src/stories/Selection.stories.ts +6 -0
- package/src/stories/Table.stories.ts +12 -0
- package/src/stories/Toolbar.stories.ts +9 -0
- package/src/stories/Toolbox.stories.ts +4 -0
- package/src/stories/Tooltip.stories.ts +6 -0
- package/src/stories/helpers.ts +63 -8
- package/src/tools/header/index.ts +6 -10
- package/src/tools/table/index.ts +38 -0
- package/src/tools/toggle/dom-builder.ts +1 -0
- package/src/tools/toggle/toggle-shortcuts.ts +4 -0
|
@@ -78,6 +78,9 @@ export const Focused: Story = {
|
|
|
78
78
|
data: sampleData,
|
|
79
79
|
readOnly: false,
|
|
80
80
|
},
|
|
81
|
+
parameters: {
|
|
82
|
+
chromatic: { delay: 500 },
|
|
83
|
+
},
|
|
81
84
|
play: async ({ canvasElement, step }) => {
|
|
82
85
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
83
86
|
await waitFor(
|
|
@@ -120,6 +123,9 @@ export const SelectedByShortcut: Story = {
|
|
|
120
123
|
data: sampleData,
|
|
121
124
|
readOnly: false,
|
|
122
125
|
},
|
|
126
|
+
parameters: {
|
|
127
|
+
chromatic: { delay: 500 },
|
|
128
|
+
},
|
|
123
129
|
play: async ({ canvasElement, step }) => {
|
|
124
130
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
125
131
|
await waitFor(
|
|
@@ -178,6 +184,9 @@ export const MultipleSelected: Story = {
|
|
|
178
184
|
data: sampleData,
|
|
179
185
|
readOnly: false,
|
|
180
186
|
},
|
|
187
|
+
parameters: {
|
|
188
|
+
chromatic: { delay: 500 },
|
|
189
|
+
},
|
|
181
190
|
play: async ({ canvasElement, step }) => {
|
|
182
191
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
183
192
|
await waitFor(
|
|
@@ -236,6 +245,9 @@ export const WithTextSelection: Story = {
|
|
|
236
245
|
data: sampleData,
|
|
237
246
|
readOnly: false,
|
|
238
247
|
},
|
|
248
|
+
parameters: {
|
|
249
|
+
chromatic: { delay: 500 },
|
|
250
|
+
},
|
|
239
251
|
play: async ({ canvasElement, step }) => {
|
|
240
252
|
await step('Wait for editor to initialize', async () => {
|
|
241
253
|
await waitFor(
|
|
@@ -342,6 +354,9 @@ export const NewBlockAnimation: Story = {
|
|
|
342
354
|
data: sampleData,
|
|
343
355
|
readOnly: false,
|
|
344
356
|
},
|
|
357
|
+
parameters: {
|
|
358
|
+
chromatic: { delay: 500 },
|
|
359
|
+
},
|
|
345
360
|
play: async ({ canvasElement, step }) => {
|
|
346
361
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
347
362
|
await waitFor(
|
|
@@ -395,6 +410,9 @@ export const NewBlockAnimation: Story = {
|
|
|
395
410
|
* This state is shown when a block is configured to stretch to full width.
|
|
396
411
|
*/
|
|
397
412
|
export const StretchedBlock: Story = {
|
|
413
|
+
parameters: {
|
|
414
|
+
chromatic: { delay: 500 },
|
|
415
|
+
},
|
|
398
416
|
args: {
|
|
399
417
|
data: {
|
|
400
418
|
time: Date.now(),
|
|
@@ -461,6 +479,9 @@ export const NavigationMode: Story = {
|
|
|
461
479
|
data: sampleData,
|
|
462
480
|
readOnly: false,
|
|
463
481
|
},
|
|
482
|
+
parameters: {
|
|
483
|
+
chromatic: { delay: 500 },
|
|
484
|
+
},
|
|
464
485
|
play: async ({ canvasElement, step }) => {
|
|
465
486
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
466
487
|
await waitFor(
|
|
@@ -94,6 +94,9 @@ export const NarrowMode: Story = {
|
|
|
94
94
|
readOnly: false,
|
|
95
95
|
width: 400,
|
|
96
96
|
},
|
|
97
|
+
parameters: {
|
|
98
|
+
chromatic: { delay: 500 },
|
|
99
|
+
},
|
|
97
100
|
play: async ({ canvasElement, step }) => {
|
|
98
101
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
99
102
|
await waitFor(
|
|
@@ -164,6 +167,9 @@ export const FocusedWithToolbar: Story = {
|
|
|
164
167
|
data: sampleData,
|
|
165
168
|
readOnly: false,
|
|
166
169
|
},
|
|
170
|
+
parameters: {
|
|
171
|
+
chromatic: { delay: 500 },
|
|
172
|
+
},
|
|
167
173
|
play: async ({ canvasElement, step }) => {
|
|
168
174
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
169
175
|
await waitFor(
|
|
@@ -208,6 +214,10 @@ export const ToolboxOpenedMode: Story = {
|
|
|
208
214
|
args: {
|
|
209
215
|
data: sampleData,
|
|
210
216
|
readOnly: false,
|
|
217
|
+
width: 450,
|
|
218
|
+
},
|
|
219
|
+
parameters: {
|
|
220
|
+
chromatic: { delay: 500 },
|
|
211
221
|
},
|
|
212
222
|
play: async ({ canvasElement, step }) => {
|
|
213
223
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
@@ -303,6 +313,9 @@ export const RTLMode: Story = {
|
|
|
303
313
|
direction: 'rtl',
|
|
304
314
|
},
|
|
305
315
|
},
|
|
316
|
+
parameters: {
|
|
317
|
+
chromatic: { delay: 500 },
|
|
318
|
+
},
|
|
306
319
|
play: async ({ canvasElement, step }) => {
|
|
307
320
|
await step('Verify RTL direction is applied', async () => {
|
|
308
321
|
await waitFor(
|
|
@@ -345,6 +358,9 @@ export const DraggingState: Story = {
|
|
|
345
358
|
data: sampleData,
|
|
346
359
|
readOnly: false,
|
|
347
360
|
},
|
|
361
|
+
parameters: {
|
|
362
|
+
chromatic: { delay: 500 },
|
|
363
|
+
},
|
|
348
364
|
play: async ({ canvasElement, step }) => {
|
|
349
365
|
const container = canvasElement.querySelector('[data-story-container]');
|
|
350
366
|
|
|
@@ -445,6 +461,9 @@ export const RectangleSelection: Story = {
|
|
|
445
461
|
data: sampleData,
|
|
446
462
|
readOnly: false,
|
|
447
463
|
},
|
|
464
|
+
parameters: {
|
|
465
|
+
chromatic: { delay: 500 },
|
|
466
|
+
},
|
|
448
467
|
play: async ({ canvasElement, step }) => {
|
|
449
468
|
await step('Wait for editor to initialize', async () => {
|
|
450
469
|
await waitFor(
|
|
@@ -3,7 +3,7 @@ import { userEvent, waitFor, expect } from 'storybook/test';
|
|
|
3
3
|
|
|
4
4
|
import { Header } from '../tools/header';
|
|
5
5
|
|
|
6
|
-
import { createEditorContainer, simulateClick, waitForToolbar, selectTextInBlock, waitForPointerEvents } from './helpers';
|
|
6
|
+
import { createEditorContainer, simulateClick, waitForToolbar, selectTextInBlock, waitForPointerEvents, waitForInlineToolbarOpen } from './helpers';
|
|
7
7
|
import type { EditorFactoryOptions } from './helpers';
|
|
8
8
|
|
|
9
9
|
import type { OutputData } from '@/types';
|
|
@@ -103,6 +103,9 @@ export const WithTextSelection: Story = {
|
|
|
103
103
|
args: {
|
|
104
104
|
data: sampleData,
|
|
105
105
|
},
|
|
106
|
+
parameters: {
|
|
107
|
+
chromatic: { delay: 500 },
|
|
108
|
+
},
|
|
106
109
|
play: async ({ canvasElement, step }) => {
|
|
107
110
|
await step('Wait for editor to initialize', async () => {
|
|
108
111
|
await waitFor(
|
|
@@ -144,6 +147,9 @@ export const BoldActive: Story = {
|
|
|
144
147
|
args: {
|
|
145
148
|
data: sampleData,
|
|
146
149
|
},
|
|
150
|
+
parameters: {
|
|
151
|
+
chromatic: { delay: 500 },
|
|
152
|
+
},
|
|
147
153
|
play: async ({ canvasElement, step }) => {
|
|
148
154
|
await step('Wait for editor to initialize', async () => {
|
|
149
155
|
await waitFor(
|
|
@@ -154,6 +160,7 @@ export const BoldActive: Story = {
|
|
|
154
160
|
},
|
|
155
161
|
TIMEOUT_INIT
|
|
156
162
|
);
|
|
163
|
+
await waitForToolbar(canvasElement);
|
|
157
164
|
});
|
|
158
165
|
|
|
159
166
|
await step('Select bold text to show active state', async () => {
|
|
@@ -162,7 +169,7 @@ export const BoldActive: Story = {
|
|
|
162
169
|
|
|
163
170
|
// Use 'strong' selector - browsers normalize <b> to <strong>
|
|
164
171
|
if (secondBlock) {
|
|
165
|
-
selectTextInBlock(secondBlock, 'strong');
|
|
172
|
+
await selectTextInBlock(secondBlock, 'strong');
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
await waitFor(
|
|
@@ -189,6 +196,9 @@ export const ItalicActive: Story = {
|
|
|
189
196
|
args: {
|
|
190
197
|
data: sampleData,
|
|
191
198
|
},
|
|
199
|
+
parameters: {
|
|
200
|
+
chromatic: { delay: 500 },
|
|
201
|
+
},
|
|
192
202
|
play: async ({ canvasElement, step }) => {
|
|
193
203
|
await step('Wait for editor to initialize', async () => {
|
|
194
204
|
await waitFor(
|
|
@@ -199,6 +209,7 @@ export const ItalicActive: Story = {
|
|
|
199
209
|
},
|
|
200
210
|
TIMEOUT_INIT
|
|
201
211
|
);
|
|
212
|
+
await waitForToolbar(canvasElement);
|
|
202
213
|
});
|
|
203
214
|
|
|
204
215
|
await step('Select italic text to show active state', async () => {
|
|
@@ -207,7 +218,7 @@ export const ItalicActive: Story = {
|
|
|
207
218
|
|
|
208
219
|
// Use 'em' selector - browsers normalize <i> to <em>
|
|
209
220
|
if (secondBlock) {
|
|
210
|
-
selectTextInBlock(secondBlock, 'em');
|
|
221
|
+
await selectTextInBlock(secondBlock, 'em');
|
|
211
222
|
}
|
|
212
223
|
|
|
213
224
|
await waitFor(
|
|
@@ -234,6 +245,9 @@ export const LinkActive: Story = {
|
|
|
234
245
|
args: {
|
|
235
246
|
data: sampleData,
|
|
236
247
|
},
|
|
248
|
+
parameters: {
|
|
249
|
+
chromatic: { delay: 500 },
|
|
250
|
+
},
|
|
237
251
|
play: async ({ canvasElement, step }) => {
|
|
238
252
|
await step('Wait for editor to initialize', async () => {
|
|
239
253
|
await waitFor(
|
|
@@ -244,6 +258,7 @@ export const LinkActive: Story = {
|
|
|
244
258
|
},
|
|
245
259
|
TIMEOUT_INIT
|
|
246
260
|
);
|
|
261
|
+
await waitForToolbar(canvasElement);
|
|
247
262
|
});
|
|
248
263
|
|
|
249
264
|
await step('Select link text to show active/unlink state', async () => {
|
|
@@ -251,7 +266,7 @@ export const LinkActive: Story = {
|
|
|
251
266
|
const thirdBlock = blocks[2];
|
|
252
267
|
|
|
253
268
|
if (thirdBlock) {
|
|
254
|
-
selectTextInBlock(thirdBlock, 'a');
|
|
269
|
+
await selectTextInBlock(thirdBlock, 'a');
|
|
255
270
|
}
|
|
256
271
|
|
|
257
272
|
await waitFor(
|
|
@@ -278,6 +293,9 @@ export const LinkInputShown: Story = {
|
|
|
278
293
|
args: {
|
|
279
294
|
data: sampleData,
|
|
280
295
|
},
|
|
296
|
+
parameters: {
|
|
297
|
+
chromatic: { delay: 500 },
|
|
298
|
+
},
|
|
281
299
|
play: async ({ canvasElement, step }) => {
|
|
282
300
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
283
301
|
await waitFor(
|
|
@@ -333,14 +351,12 @@ export const LinkInputShown: Story = {
|
|
|
333
351
|
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
334
352
|
|
|
335
353
|
expect(inlineToolbar).toBeInTheDocument();
|
|
336
|
-
|
|
337
|
-
// Also verify the popover is populated
|
|
338
|
-
const popoverContainer = inlineToolbar?.querySelector('[data-blok-testid="popover-container"]');
|
|
339
|
-
|
|
340
|
-
expect(popoverContainer).toBeInTheDocument();
|
|
341
354
|
},
|
|
342
355
|
TIMEOUT_ACTION
|
|
343
356
|
);
|
|
357
|
+
|
|
358
|
+
// Verify the toolbar has actual popover content (not just the empty wrapper)
|
|
359
|
+
await waitForInlineToolbarOpen();
|
|
344
360
|
});
|
|
345
361
|
|
|
346
362
|
await step('Click link tool to show input', async () => {
|
|
@@ -375,6 +391,9 @@ export const ConvertToDropdownOpen: Story = {
|
|
|
375
391
|
args: {
|
|
376
392
|
data: sampleData,
|
|
377
393
|
},
|
|
394
|
+
parameters: {
|
|
395
|
+
chromatic: { delay: 500 },
|
|
396
|
+
},
|
|
378
397
|
play: async ({ canvasElement, step }) => {
|
|
379
398
|
await step('Wait for editor to initialize', async () => {
|
|
380
399
|
await waitFor(
|
|
@@ -385,6 +404,7 @@ export const ConvertToDropdownOpen: Story = {
|
|
|
385
404
|
},
|
|
386
405
|
TIMEOUT_INIT
|
|
387
406
|
);
|
|
407
|
+
await waitForToolbar(canvasElement);
|
|
388
408
|
});
|
|
389
409
|
|
|
390
410
|
await step('Select text to show inline toolbar', async () => {
|
|
@@ -394,9 +414,13 @@ export const ConvertToDropdownOpen: Story = {
|
|
|
394
414
|
if (contentEditable) {
|
|
395
415
|
simulateClick(contentEditable);
|
|
396
416
|
selectText(contentEditable, 0, 11);
|
|
417
|
+
(contentEditable as HTMLElement).focus();
|
|
397
418
|
document.dispatchEvent(new Event('selectionchange'));
|
|
398
419
|
}
|
|
399
420
|
|
|
421
|
+
// Wait for the debounced selection handler (180ms) plus popover creation time
|
|
422
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
423
|
+
|
|
400
424
|
await waitFor(
|
|
401
425
|
() => {
|
|
402
426
|
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
@@ -450,6 +474,9 @@ export const ToolHoverState: Story = {
|
|
|
450
474
|
args: {
|
|
451
475
|
data: sampleData,
|
|
452
476
|
},
|
|
477
|
+
parameters: {
|
|
478
|
+
chromatic: { delay: 500 },
|
|
479
|
+
},
|
|
453
480
|
play: async ({ canvasElement, step }) => {
|
|
454
481
|
await step('Wait for editor to initialize', async () => {
|
|
455
482
|
await waitFor(
|
|
@@ -460,6 +487,7 @@ export const ToolHoverState: Story = {
|
|
|
460
487
|
},
|
|
461
488
|
TIMEOUT_INIT
|
|
462
489
|
);
|
|
490
|
+
await waitForToolbar(canvasElement);
|
|
463
491
|
});
|
|
464
492
|
|
|
465
493
|
await step('Select text to show inline toolbar', async () => {
|
|
@@ -469,9 +497,13 @@ export const ToolHoverState: Story = {
|
|
|
469
497
|
if (contentEditable) {
|
|
470
498
|
simulateClick(contentEditable);
|
|
471
499
|
selectText(contentEditable, 0, 11);
|
|
500
|
+
(contentEditable as HTMLElement).focus();
|
|
472
501
|
document.dispatchEvent(new Event('selectionchange'));
|
|
473
502
|
}
|
|
474
503
|
|
|
504
|
+
// Wait for the debounced selection handler (180ms) plus popover creation time
|
|
505
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
506
|
+
|
|
475
507
|
await waitFor(
|
|
476
508
|
() => {
|
|
477
509
|
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
@@ -3,7 +3,7 @@ import { waitFor, expect } from 'storybook/test';
|
|
|
3
3
|
|
|
4
4
|
import { Marker } from '../tools';
|
|
5
5
|
|
|
6
|
-
import { createEditorContainer, defaultTools, simulateClick, waitForToolbar, selectTextInBlock, waitForPointerEvents } from './helpers';
|
|
6
|
+
import { createEditorContainer, defaultTools, simulateClick, waitForToolbar, selectTextInBlock, waitForPointerEvents, waitForInlineToolbarOpen } from './helpers';
|
|
7
7
|
import type { EditorFactoryOptions } from './helpers';
|
|
8
8
|
|
|
9
9
|
import type { OutputData } from '@/types';
|
|
@@ -126,7 +126,15 @@ const openMarkerPicker = async (canvasElement: HTMLElement): Promise<void> => {
|
|
|
126
126
|
|
|
127
127
|
const range = document.createRange();
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
// Select the first text node directly — more reliable in headless Chromium
|
|
130
|
+
const textNode = contentEditable.firstChild;
|
|
131
|
+
|
|
132
|
+
if (textNode?.nodeType === Node.TEXT_NODE && textNode.textContent) {
|
|
133
|
+
range.setStart(textNode, 0);
|
|
134
|
+
range.setEnd(textNode, textNode.textContent.length);
|
|
135
|
+
} else {
|
|
136
|
+
range.selectNodeContents(contentEditable);
|
|
137
|
+
}
|
|
130
138
|
|
|
131
139
|
const selection = window.getSelection();
|
|
132
140
|
|
|
@@ -142,15 +150,8 @@ const openMarkerPicker = async (canvasElement: HTMLElement): Promise<void> => {
|
|
|
142
150
|
// 5. Wait for debounced selection handler (180ms) plus popover creation
|
|
143
151
|
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
144
152
|
|
|
145
|
-
// 6. Wait for inline toolbar to
|
|
146
|
-
await
|
|
147
|
-
() => {
|
|
148
|
-
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
149
|
-
|
|
150
|
-
expect(inlineToolbar).toBeInTheDocument();
|
|
151
|
-
},
|
|
152
|
-
TIMEOUT_ACTION
|
|
153
|
-
);
|
|
153
|
+
// 6. Wait for inline toolbar to be fully open (with popover content)
|
|
154
|
+
await waitForInlineToolbarOpen();
|
|
154
155
|
|
|
155
156
|
// 7. Wait for pointer events on the popover container
|
|
156
157
|
await waitForPointerEvents(`${INLINE_TOOLBAR_TESTID} [data-blok-testid="popover-container"]`);
|
|
@@ -401,6 +402,9 @@ export const PickerTextTab: Story = {
|
|
|
401
402
|
args: {
|
|
402
403
|
data: pickerData,
|
|
403
404
|
},
|
|
405
|
+
parameters: {
|
|
406
|
+
chromatic: { delay: 500 },
|
|
407
|
+
},
|
|
404
408
|
play: async ({ canvasElement, step }) => {
|
|
405
409
|
await step('Open marker picker on text tab', async () => {
|
|
406
410
|
await openMarkerPicker(canvasElement);
|
|
@@ -426,6 +430,9 @@ export const PickerBackgroundTab: Story = {
|
|
|
426
430
|
args: {
|
|
427
431
|
data: pickerData,
|
|
428
432
|
},
|
|
433
|
+
parameters: {
|
|
434
|
+
chromatic: { delay: 500 },
|
|
435
|
+
},
|
|
429
436
|
play: async ({ canvasElement, step }) => {
|
|
430
437
|
await step('Open marker picker', async () => {
|
|
431
438
|
await openMarkerPicker(canvasElement);
|
|
@@ -459,6 +466,9 @@ export const PickerDefaultButton: Story = {
|
|
|
459
466
|
args: {
|
|
460
467
|
data: pickerData,
|
|
461
468
|
},
|
|
469
|
+
parameters: {
|
|
470
|
+
chromatic: { delay: 500 },
|
|
471
|
+
},
|
|
462
472
|
play: async ({ canvasElement, step }) => {
|
|
463
473
|
await step('Open marker picker and verify default button', async () => {
|
|
464
474
|
await openMarkerPicker(canvasElement);
|
|
@@ -483,6 +493,9 @@ export const PickerNoActiveSwatch: Story = {
|
|
|
483
493
|
args: {
|
|
484
494
|
data: pickerData,
|
|
485
495
|
},
|
|
496
|
+
parameters: {
|
|
497
|
+
chromatic: { delay: 500 },
|
|
498
|
+
},
|
|
486
499
|
play: async ({ canvasElement, step }) => {
|
|
487
500
|
await step('Open marker picker and verify no active swatch', async () => {
|
|
488
501
|
await openMarkerPicker(canvasElement);
|
|
@@ -512,6 +525,9 @@ export const PickerActiveTextSwatch: Story = {
|
|
|
512
525
|
args: {
|
|
513
526
|
data: preColoredTextData,
|
|
514
527
|
},
|
|
528
|
+
parameters: {
|
|
529
|
+
chromatic: { delay: 500 },
|
|
530
|
+
},
|
|
515
531
|
play: async ({ canvasElement, step }) => {
|
|
516
532
|
await step('Select pre-colored text and open picker', async () => {
|
|
517
533
|
// Wait for the editor block to appear
|
|
@@ -531,24 +547,16 @@ export const PickerActiveTextSwatch: Story = {
|
|
|
531
547
|
const block = canvasElement.querySelector(BLOCK_TESTID);
|
|
532
548
|
|
|
533
549
|
if (block) {
|
|
534
|
-
selectTextInBlock(block, 'mark');
|
|
550
|
+
await selectTextInBlock(block, 'mark');
|
|
535
551
|
}
|
|
536
552
|
|
|
537
|
-
// Wait for
|
|
538
|
-
await
|
|
539
|
-
|
|
540
|
-
// Wait for inline toolbar
|
|
541
|
-
await waitFor(
|
|
542
|
-
() => {
|
|
543
|
-
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
544
|
-
|
|
545
|
-
expect(inlineToolbar).toBeInTheDocument();
|
|
546
|
-
},
|
|
547
|
-
TIMEOUT_ACTION
|
|
548
|
-
);
|
|
553
|
+
// Wait for inline toolbar to be fully open (with popover content)
|
|
554
|
+
await waitForInlineToolbarOpen();
|
|
549
555
|
|
|
550
|
-
// Wait for pointer events
|
|
556
|
+
// Wait for pointer events on the popover container
|
|
551
557
|
await waitForPointerEvents(`${INLINE_TOOLBAR_TESTID} [data-blok-testid="popover-container"]`);
|
|
558
|
+
|
|
559
|
+
// Small delay for CSS animation to complete
|
|
552
560
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
553
561
|
|
|
554
562
|
// Click the marker tool to open the picker
|
|
@@ -592,6 +600,9 @@ export const PickerActiveBackgroundSwatch: Story = {
|
|
|
592
600
|
args: {
|
|
593
601
|
data: preColoredBgData,
|
|
594
602
|
},
|
|
603
|
+
parameters: {
|
|
604
|
+
chromatic: { delay: 500 },
|
|
605
|
+
},
|
|
595
606
|
play: async ({ canvasElement, step }) => {
|
|
596
607
|
await step('Select pre-colored background text and open picker', async () => {
|
|
597
608
|
// Wait for the editor block to appear
|
|
@@ -611,24 +622,16 @@ export const PickerActiveBackgroundSwatch: Story = {
|
|
|
611
622
|
const block = canvasElement.querySelector(BLOCK_TESTID);
|
|
612
623
|
|
|
613
624
|
if (block) {
|
|
614
|
-
selectTextInBlock(block, 'mark');
|
|
625
|
+
await selectTextInBlock(block, 'mark');
|
|
615
626
|
}
|
|
616
627
|
|
|
617
|
-
// Wait for
|
|
618
|
-
await
|
|
619
|
-
|
|
620
|
-
// Wait for inline toolbar
|
|
621
|
-
await waitFor(
|
|
622
|
-
() => {
|
|
623
|
-
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
624
|
-
|
|
625
|
-
expect(inlineToolbar).toBeInTheDocument();
|
|
626
|
-
},
|
|
627
|
-
TIMEOUT_ACTION
|
|
628
|
-
);
|
|
628
|
+
// Wait for inline toolbar to be fully open (with popover content)
|
|
629
|
+
await waitForInlineToolbarOpen();
|
|
629
630
|
|
|
630
|
-
// Wait for pointer events
|
|
631
|
+
// Wait for pointer events on the popover container
|
|
631
632
|
await waitForPointerEvents(`${INLINE_TOOLBAR_TESTID} [data-blok-testid="popover-container"]`);
|
|
633
|
+
|
|
634
|
+
// Small delay for CSS animation to complete
|
|
632
635
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
633
636
|
|
|
634
637
|
// Click the marker tool to open the picker
|
|
@@ -681,6 +684,9 @@ export const MarkerButtonActive: Story = {
|
|
|
681
684
|
args: {
|
|
682
685
|
data: preColoredTextData,
|
|
683
686
|
},
|
|
687
|
+
parameters: {
|
|
688
|
+
chromatic: { delay: 500 },
|
|
689
|
+
},
|
|
684
690
|
play: async ({ canvasElement, step }) => {
|
|
685
691
|
await step('Select pre-colored text to show marker active state', async () => {
|
|
686
692
|
// Wait for the editor block to appear
|
|
@@ -700,21 +706,11 @@ export const MarkerButtonActive: Story = {
|
|
|
700
706
|
const block = canvasElement.querySelector(BLOCK_TESTID);
|
|
701
707
|
|
|
702
708
|
if (block) {
|
|
703
|
-
selectTextInBlock(block, 'mark');
|
|
709
|
+
await selectTextInBlock(block, 'mark');
|
|
704
710
|
}
|
|
705
711
|
|
|
706
|
-
// Wait for
|
|
707
|
-
await
|
|
708
|
-
|
|
709
|
-
// Wait for inline toolbar
|
|
710
|
-
await waitFor(
|
|
711
|
-
() => {
|
|
712
|
-
const inlineToolbar = document.querySelector(INLINE_TOOLBAR_TESTID);
|
|
713
|
-
|
|
714
|
-
expect(inlineToolbar).toBeInTheDocument();
|
|
715
|
-
},
|
|
716
|
-
TIMEOUT_ACTION
|
|
717
|
-
);
|
|
712
|
+
// Wait for inline toolbar to be fully open (with popover content)
|
|
713
|
+
await waitForInlineToolbarOpen();
|
|
718
714
|
|
|
719
715
|
// Verify the marker tool button is active
|
|
720
716
|
await waitFor(
|
|
@@ -113,6 +113,9 @@ export const AlertDefault: Story = {
|
|
|
113
113
|
message: 'This is a default notification',
|
|
114
114
|
type: 'alert',
|
|
115
115
|
},
|
|
116
|
+
parameters: {
|
|
117
|
+
chromatic: { delay: 500 },
|
|
118
|
+
},
|
|
116
119
|
play: async ({ step }) => {
|
|
117
120
|
await step('Show default alert notification', async () => {
|
|
118
121
|
await showNotification({
|
|
@@ -145,6 +148,9 @@ export const AlertSuccess: Story = {
|
|
|
145
148
|
type: 'alert',
|
|
146
149
|
style: 'success',
|
|
147
150
|
},
|
|
151
|
+
parameters: {
|
|
152
|
+
chromatic: { delay: 500 },
|
|
153
|
+
},
|
|
148
154
|
play: async ({ step }) => {
|
|
149
155
|
await step('Show success alert notification', async () => {
|
|
150
156
|
await showNotification({
|
|
@@ -174,6 +180,9 @@ export const AlertError: Story = {
|
|
|
174
180
|
type: 'alert',
|
|
175
181
|
style: 'error',
|
|
176
182
|
},
|
|
183
|
+
parameters: {
|
|
184
|
+
chromatic: { delay: 500 },
|
|
185
|
+
},
|
|
177
186
|
play: async ({ step }) => {
|
|
178
187
|
await step('Show error alert notification', async () => {
|
|
179
188
|
await showNotification({
|
|
@@ -202,6 +211,9 @@ export const ConfirmNotification: Story = {
|
|
|
202
211
|
message: 'Are you sure you want to proceed?',
|
|
203
212
|
type: 'confirm',
|
|
204
213
|
},
|
|
214
|
+
parameters: {
|
|
215
|
+
chromatic: { delay: 500 },
|
|
216
|
+
},
|
|
205
217
|
play: async ({ step }) => {
|
|
206
218
|
await step('Show confirm notification', async () => {
|
|
207
219
|
await showNotification({
|
|
@@ -244,6 +256,9 @@ export const PromptNotification: Story = {
|
|
|
244
256
|
message: 'Enter your name:',
|
|
245
257
|
type: 'prompt',
|
|
246
258
|
},
|
|
259
|
+
parameters: {
|
|
260
|
+
chromatic: { delay: 500 },
|
|
261
|
+
},
|
|
247
262
|
play: async ({ step }) => {
|
|
248
263
|
await step('Show prompt notification', async () => {
|
|
249
264
|
await showNotification({
|
|
@@ -282,6 +297,9 @@ export const WithHTMLContent: Story = {
|
|
|
282
297
|
type: 'alert',
|
|
283
298
|
style: 'success',
|
|
284
299
|
},
|
|
300
|
+
parameters: {
|
|
301
|
+
chromatic: { delay: 500 },
|
|
302
|
+
},
|
|
285
303
|
play: async ({ step }) => {
|
|
286
304
|
await step('Clean up and show notification with HTML', async () => {
|
|
287
305
|
cleanupNotifications();
|
|
@@ -316,7 +334,7 @@ export const BounceInAnimation: Story = {
|
|
|
316
334
|
type: 'alert',
|
|
317
335
|
},
|
|
318
336
|
parameters: {
|
|
319
|
-
chromatic: { disableSnapshot: true },
|
|
337
|
+
chromatic: { disableSnapshot: true, delay: 500 },
|
|
320
338
|
},
|
|
321
339
|
play: async ({ step }) => {
|
|
322
340
|
await step('Show notification with bounce animation', async () => {
|
|
@@ -81,6 +81,9 @@ export const PlaceholderOnlyOnFocus: Story = {
|
|
|
81
81
|
placeholder: DEFAULT_PLACEHOLDER,
|
|
82
82
|
data: undefined,
|
|
83
83
|
},
|
|
84
|
+
parameters: {
|
|
85
|
+
chromatic: { delay: 500 },
|
|
86
|
+
},
|
|
84
87
|
play: async ({ canvasElement, step }) => {
|
|
85
88
|
await step('Wait for editor to initialize', async () => {
|
|
86
89
|
await waitFor(
|
|
@@ -153,6 +156,9 @@ export const TypeAndClearPlaceholder: Story = {
|
|
|
153
156
|
placeholder: DEFAULT_PLACEHOLDER,
|
|
154
157
|
data: undefined,
|
|
155
158
|
},
|
|
159
|
+
parameters: {
|
|
160
|
+
chromatic: { delay: 500 },
|
|
161
|
+
},
|
|
156
162
|
play: async ({ canvasElement, step }) => {
|
|
157
163
|
await step('Wait for editor to initialize', async () => {
|
|
158
164
|
await waitFor(
|
|
@@ -229,6 +235,9 @@ export const MultipleBlocksPlaceholder: Story = {
|
|
|
229
235
|
],
|
|
230
236
|
},
|
|
231
237
|
},
|
|
238
|
+
parameters: {
|
|
239
|
+
chromatic: { delay: 500 },
|
|
240
|
+
},
|
|
232
241
|
play: async ({ canvasElement, step }) => {
|
|
233
242
|
await step('Wait for editor to initialize', async () => {
|
|
234
243
|
await waitFor(
|
|
@@ -274,6 +283,9 @@ export const PlaceholderWithToolboxOpen: Story = {
|
|
|
274
283
|
placeholder: DEFAULT_PLACEHOLDER,
|
|
275
284
|
data: undefined,
|
|
276
285
|
},
|
|
286
|
+
parameters: {
|
|
287
|
+
chromatic: { delay: 500 },
|
|
288
|
+
},
|
|
277
289
|
play: async ({ canvasElement, step }) => {
|
|
278
290
|
await step('Wait for editor and toolbar to initialize', async () => {
|
|
279
291
|
await waitFor(
|