testomatio-editor-blocks 0.4.48 → 0.4.50

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.
@@ -776,6 +776,7 @@ function parseTestStep(lines, index, allowEmpty = false, snippetId) {
776
776
  let expectedResult = "";
777
777
  let next = index + 1;
778
778
  let inExpectedResult = false;
779
+ let blankLineSeenOutsideCodeBlock = false;
779
780
  const stepIndent = current.length - current.trimStart().length;
780
781
  while (next < lines.length) {
781
782
  const line = lines[next];
@@ -789,6 +790,7 @@ function parseTestStep(lines, index, allowEmpty = false, snippetId) {
789
790
  }
790
791
  else {
791
792
  stepDataLines.push("");
793
+ blankLineSeenOutsideCodeBlock = true;
792
794
  }
793
795
  }
794
796
  next += 1;
@@ -894,6 +896,10 @@ function parseTestStep(lines, index, allowEmpty = false, snippetId) {
894
896
  next += 1;
895
897
  continue;
896
898
  }
899
+ // After a blank line outside a code block, stop adding to step data
900
+ if (blankLineSeenOutsideCodeBlock) {
901
+ break;
902
+ }
897
903
  if (STEP_DATA_LINE_REGEX.test(rawTrimmed)) {
898
904
  const content = unescapeMarkdown(rawTrimmed);
899
905
  stepDataLines.push(content);
@@ -1079,7 +1079,8 @@ html.dark .bn-step-image-preview__content {
1079
1079
  }
1080
1080
 
1081
1081
  .bn-step-editor .overtype-wrapper .overtype-preview strong.step-preview-bold {
1082
- font-weight: 600 !important;
1082
+ -webkit-text-stroke: 0.5px currentColor;
1083
+ font-weight: inherit !important;
1083
1084
  color: inherit !important;
1084
1085
  }
1085
1086
 
@@ -1090,8 +1091,8 @@ html.dark .bn-step-image-preview__content {
1090
1091
 
1091
1092
  .bn-step-editor .overtype-wrapper .overtype-preview code.step-preview-code {
1092
1093
  background-color: transparent !important;
1093
- border-radius: 3px !important;
1094
- font-family: "Fira Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
1094
+ font-family: inherit !important;
1095
+ font-size: inherit !important;
1095
1096
  color: rgb(146, 64, 14) !important;
1096
1097
  }
1097
1098
 
@@ -1356,3 +1357,11 @@ html.dark .bn-step-image-preview__content {
1356
1357
  .bn-testcase--draft {
1357
1358
  --status-color: var(--status-default);
1358
1359
  }
1360
+
1361
+ /* Prevent unnecessary horizontal scrollbar on BlockNote tables.
1362
+ ProseMirror sets overflow-x: auto on .tableWrapper, but the
1363
+ table-widgets-container extends slightly past the wrapper edge,
1364
+ triggering a scrollbar even when table content fits. */
1365
+ .bn-editor [data-content-type="table"] .tableWrapper {
1366
+ overflow-x: hidden;
1367
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testomatio-editor-blocks",
3
- "version": "0.4.48",
3
+ "version": "0.4.50",
4
4
  "description": "Custom BlockNote schema, markdown conversion helpers, and UI for Testomatio-style test cases and steps.",
5
5
  "type": "module",
6
6
  "main": "./package/index.js",
@@ -51,10 +51,10 @@ const writeStepViewMode = (mode: StepViewMode) => {
51
51
  /**
52
52
  * Returns true when a normalised (lowercased, trailing-punctuation-stripped)
53
53
  * heading text looks like a "Steps" heading.
54
- * Accepted forms: steps, step, step(s).
54
+ * Accepted forms: steps, step, step(s), test steps, test step, test step(s).
55
55
  */
56
56
  export function isStepsHeading(text: string): boolean {
57
- return /^step(s|\(s\))?$/.test(text);
57
+ return /^(test\s+)?step(s|\(s\))?$/.test(text);
58
58
  }
59
59
 
60
60
  export const isEmptyParagraph = (b: any): boolean =>
@@ -337,12 +337,6 @@ export const stepBlock = createReactBlockSpec(
337
337
  [block.id, combinedStepValue, editor],
338
338
  );
339
339
 
340
- useEffect(() => {
341
- if (dataHasContent && !isDataVisible) {
342
- setIsDataVisible(true);
343
- }
344
- }, [dataHasContent, isDataVisible]);
345
-
346
340
  const handleStepTitleChange = useCallback(
347
341
  (next: string) => {
348
342
  if (next === stepTitle) {
@@ -380,7 +374,8 @@ export const stepBlock = createReactBlockSpec(
380
374
 
381
375
  const handleHideData = useCallback(() => {
382
376
  setIsDataVisible(false);
383
- }, []);
377
+ editor.updateBlock(block.id, { props: { stepData: "" } });
378
+ }, [editor, block.id]);
384
379
 
385
380
  const handleExpectedChange = useCallback(
386
381
  (next: string) => {
@@ -457,16 +452,8 @@ export const stepBlock = createReactBlockSpec(
457
452
  const handleHideExpected = useCallback(() => {
458
453
  setIsExpectedVisible(false);
459
454
  writeExpectedCollapsedPreference(true);
460
- }, []);
461
-
462
- useEffect(() => {
463
- if (expectedHasContent && !isExpectedVisible) {
464
- setIsExpectedVisible(true);
465
- }
466
- }, [expectedHasContent, isExpectedVisible]);
467
-
468
- const canToggleData = !dataHasContent;
469
- const canToggleExpected = !expectedHasContent;
455
+ editor.updateBlock(block.id, { props: { expectedResult: "" } });
456
+ }, [editor, block.id]);
470
457
 
471
458
  const viewToggleButton = (
472
459
  <button
@@ -523,6 +510,7 @@ export const stepBlock = createReactBlockSpec(
523
510
  placeholder={STEP_TITLE_PLACEHOLDER}
524
511
  onChange={handleStepTitleChange}
525
512
  autoFocus={stepTitle.length === 0}
513
+ multiline
526
514
  enableAutocomplete
527
515
  fieldName="title"
528
516
  suggestionFilter={(suggestion) => (suggestion as StepSuggestion).isSnippet !== true}
@@ -556,17 +544,15 @@ export const stepBlock = createReactBlockSpec(
556
544
  label="Step data"
557
545
  placeholder={STEP_DATA_PLACEHOLDER}
558
546
  labelAction={
559
- canToggleData ? (
560
- <button
561
- type="button"
562
- className="bn-step-field__dismiss"
563
- data-tooltip="Hide step data"
564
- onClick={handleHideData}
565
- aria-label="Hide step data"
566
- >
567
- ×
568
- </button>
569
- ) : undefined
547
+ <button
548
+ type="button"
549
+ className="bn-step-field__dismiss"
550
+ data-tooltip="Hide step data"
551
+ onClick={handleHideData}
552
+ aria-label="Hide step data"
553
+ >
554
+ ×
555
+ </button>
570
556
  }
571
557
  value={stepData}
572
558
  onChange={handleStepDataChange}
@@ -585,18 +571,16 @@ export const stepBlock = createReactBlockSpec(
585
571
  label="Expected result"
586
572
  placeholder={EXPECTED_RESULT_PLACEHOLDER}
587
573
  labelAction={
588
- canToggleExpected ? (
589
- <button
590
- type="button"
591
- className="bn-step-field__dismiss"
592
- data-tooltip="Hide expected result"
593
- onClick={handleHideExpected}
594
- tabIndex={-1}
595
- aria-label="Hide expected result"
596
- >
597
- ×
598
- </button>
599
- ) : undefined
574
+ <button
575
+ type="button"
576
+ className="bn-step-field__dismiss"
577
+ data-tooltip="Hide expected result"
578
+ onClick={handleHideExpected}
579
+ tabIndex={-1}
580
+ aria-label="Hide expected result"
581
+ >
582
+ ×
583
+ </button>
600
584
  }
601
585
  value={expectedResult}
602
586
  onChange={handleExpectedChange}