testomatio-editor-blocks 0.4.18 → 0.4.20
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/package/editor/blocks/step.js +29 -0
- package/package/editor/customMarkdownConverter.js +30 -22
- package/package/styles.css +23 -12
- package/package.json +1 -1
- package/src/editor/blocks/step.tsx +37 -0
- package/src/editor/customMarkdownConverter.test.ts +14 -78
- package/src/editor/customMarkdownConverter.ts +25 -19
- package/src/editor/styles.css +23 -12
|
@@ -91,6 +91,31 @@ export const stepBlock = createReactBlockSpec({
|
|
|
91
91
|
}
|
|
92
92
|
return count;
|
|
93
93
|
}, [block.id, documentVersion, editor.document]);
|
|
94
|
+
// Check if there is a preceding "Steps" heading
|
|
95
|
+
const hasStepsHeading = useMemo(() => {
|
|
96
|
+
const allBlocks = editor.document;
|
|
97
|
+
const blockIndex = allBlocks.findIndex((b) => b.id === block.id);
|
|
98
|
+
if (blockIndex < 0)
|
|
99
|
+
return false;
|
|
100
|
+
for (let i = blockIndex - 1; i >= 0; i--) {
|
|
101
|
+
const b = allBlocks[i];
|
|
102
|
+
if (b.type === "testStep" || b.type === "snippet") {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (b.type === "heading") {
|
|
106
|
+
const text = (Array.isArray(b.content) ? b.content : [])
|
|
107
|
+
.filter((n) => n.type === "text")
|
|
108
|
+
.map((n) => { var _a; return (_a = n.text) !== null && _a !== void 0 ? _a : ""; })
|
|
109
|
+
.join("")
|
|
110
|
+
.trim()
|
|
111
|
+
.toLowerCase()
|
|
112
|
+
.replace(/[:\-–—]$/, "");
|
|
113
|
+
return text === "steps";
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}, [block.id, documentVersion, editor.document]);
|
|
94
119
|
useEditorChange(() => {
|
|
95
120
|
setDocumentVersion((version) => version + 1);
|
|
96
121
|
}, editor);
|
|
@@ -229,6 +254,10 @@ export const stepBlock = createReactBlockSpec({
|
|
|
229
254
|
}, [expectedHasContent, isExpectedVisible]);
|
|
230
255
|
const canToggleData = !dataHasContent;
|
|
231
256
|
const canToggleExpected = !expectedHasContent;
|
|
257
|
+
// Render as plain text when not under a "Steps" heading
|
|
258
|
+
if (!hasStepsHeading) {
|
|
259
|
+
return (_jsxs("div", { className: "bn-teststep-plain", "data-block-id": block.id, children: [_jsx("span", { children: stepTitle || "(empty step)" }), stepData ? _jsx("span", { className: "bn-teststep-plain__data", children: stepData }) : null, expectedResult ? _jsx("span", { className: "bn-teststep-plain__expected", children: expectedResult }) : null] }));
|
|
260
|
+
}
|
|
232
261
|
if (viewMode === "horizontal") {
|
|
233
262
|
return (_jsx(StepHorizontalView, { blockId: block.id, stepNumber: stepNumber, stepValue: combinedStepValue, expectedResult: expectedResult, onStepChange: handleCombinedStepChange, onExpectedChange: handleExpectedChange, onInsertNextStep: handleInsertNextStep, onFieldFocus: handleFieldFocus, viewToggle: _jsx("button", { type: "button", className: "bn-teststep__view-toggle bn-teststep__view-toggle--horizontal", "data-tooltip": "Switch step view", "aria-label": "Switch step view", onClick: handleToggleView, children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [_jsx("mask", { id: "mask-toggle", style: { maskType: "alpha" }, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "16", height: "16", children: _jsx("rect", { width: "16", height: "16", fill: "#D9D9D9" }) }), _jsx("g", { mask: "url(#mask-toggle)", children: _jsx("path", { d: "M12.6667 2C13.0333 2 13.3472 2.13056 13.6083 2.39167C13.8694 2.65278 14 2.96667 14 3.33333L14 12.6667C14 13.0333 13.8694 13.3472 13.6083 13.6083C13.3472 13.8694 13.0333 14 12.6667 14L10 14C9.63333 14 9.31944 13.8694 9.05833 13.6083C8.79722 13.3472 8.66667 13.0333 8.66667 12.6667L8.66667 3.33333C8.66667 2.96667 8.79722 2.65278 9.05833 2.39167C9.31945 2.13055 9.63333 2 10 2L12.6667 2ZM6 2C6.36667 2 6.68056 2.13055 6.94167 2.39167C7.20278 2.65278 7.33333 2.96667 7.33333 3.33333L7.33333 12.6667C7.33333 13.0333 7.20278 13.3472 6.94167 13.6083C6.68055 13.8694 6.36667 14 6 14L3.33333 14C2.96667 14 2.65278 13.8694 2.39167 13.6083C2.13056 13.3472 2 13.0333 2 12.6667L2 3.33333C2 2.96667 2.13056 2.65278 2.39167 2.39167C2.65278 2.13055 2.96667 2 3.33333 2L6 2ZM3.33333 12.6667L6 12.6667L6 3.33333L3.33333 3.33333L3.33333 12.6667Z", fill: "currentColor" }) })] }) }) }));
|
|
234
263
|
}
|
|
@@ -237,7 +237,7 @@ function serializeBlock(block, ctx, orderedIndex, stepIndex) {
|
|
|
237
237
|
}
|
|
238
238
|
case "bulletListItem": {
|
|
239
239
|
const text = inlineToMarkdown(block.content);
|
|
240
|
-
lines.push(`${indent}
|
|
240
|
+
lines.push(`${indent}* ${text}`.trimEnd());
|
|
241
241
|
lines.push(...serializeChildren(block, ctx));
|
|
242
242
|
return lines;
|
|
243
243
|
}
|
|
@@ -624,13 +624,11 @@ function parseList(lines, startIndex, listType, indentLevel, allowEmptySteps = f
|
|
|
624
624
|
break;
|
|
625
625
|
}
|
|
626
626
|
// Only try to parse as testStep for top-level items (indentLevel === 0)
|
|
627
|
-
//
|
|
628
|
-
//
|
|
629
|
-
if (indentLevel === 0 && (allowEmptySteps ||
|
|
630
|
-
// For bullet lists, always try to parse as test steps
|
|
631
|
-
// For numbered lists, only try if they have step-like characteristics
|
|
627
|
+
// Under a Steps heading (allowEmptySteps=true): always try for both bullet and numbered
|
|
628
|
+
// Outside Steps heading: only if the item looks like a test step (has Expected markers or indented data)
|
|
629
|
+
if (indentLevel === 0 && (allowEmptySteps || isLikelyStep(lines, index))) {
|
|
632
630
|
const looksLikeTestStep = listType === "bullet" ||
|
|
633
|
-
(listType === "numbered" && (isLikelyStep(lines, index)));
|
|
631
|
+
(listType === "numbered" && (allowEmptySteps || isLikelyStep(lines, index)));
|
|
634
632
|
if (looksLikeTestStep) {
|
|
635
633
|
const nextStep = parseTestStep(lines, index, allowEmptySteps);
|
|
636
634
|
if (nextStep) {
|
|
@@ -678,20 +676,28 @@ function parseList(lines, startIndex, listType, indentLevel, allowEmptySteps = f
|
|
|
678
676
|
}
|
|
679
677
|
function isLikelyStep(lines, index) {
|
|
680
678
|
// Look ahead to see if there's indented content or expected result
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
679
|
+
// Look ahead through subsequent lines for expected result markers or indented content
|
|
680
|
+
for (let i = index + 1; i < lines.length; i++) {
|
|
681
|
+
const line = lines[i];
|
|
682
|
+
const trimmed = line.trim();
|
|
683
|
+
// Stop at blank lines
|
|
684
|
+
if (!trimmed)
|
|
685
|
+
break;
|
|
686
|
+
// Check for indented content (step data) first — indented lines indicate a test step
|
|
687
|
+
const hasIndent = /^\s{2,}/.test(line);
|
|
688
|
+
if (hasIndent)
|
|
689
|
+
return true;
|
|
690
|
+
// Stop at new list items, headings, or other block-level elements (only if not indented)
|
|
691
|
+
if (/^[-*+]\s/.test(trimmed) || /^\d+[.)]\s/.test(trimmed))
|
|
692
|
+
break;
|
|
693
|
+
if (trimmed.startsWith("#") || trimmed.startsWith(">") || trimmed.startsWith("|") || trimmed.startsWith("```") || trimmed.startsWith(":::"))
|
|
694
|
+
break;
|
|
695
|
+
// Check for expected result markers
|
|
696
|
+
if (EXPECTED_LABEL_REGEX.test(trimmed))
|
|
697
|
+
return true;
|
|
698
|
+
if (trimmed.match(/^\*[^*]*expected/i))
|
|
699
|
+
return true;
|
|
700
|
+
}
|
|
695
701
|
return false;
|
|
696
702
|
}
|
|
697
703
|
function parseTestStep(lines, index, allowEmpty = false, snippetId) {
|
|
@@ -1145,7 +1151,9 @@ export function markdownToBlocks(markdown) {
|
|
|
1145
1151
|
index = snippetWrapper.nextIndex;
|
|
1146
1152
|
continue;
|
|
1147
1153
|
}
|
|
1148
|
-
const stepLikeBlock =
|
|
1154
|
+
const stepLikeBlock = (stepsHeadingLevel !== null || isLikelyStep(lines, index))
|
|
1155
|
+
? parseTestStep(lines, index, stepsHeadingLevel !== null)
|
|
1156
|
+
: null;
|
|
1149
1157
|
if (stepLikeBlock) {
|
|
1150
1158
|
blocks.push(stepLikeBlock.block);
|
|
1151
1159
|
index = stepLikeBlock.nextIndex;
|
package/package/styles.css
CHANGED
|
@@ -354,6 +354,21 @@ html.dark .bn-step-image-preview__content {
|
|
|
354
354
|
background: var(--status-blocked-bg);
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
+
.bn-teststep-plain {
|
|
358
|
+
padding: 4px 0;
|
|
359
|
+
font-family: "Inter", system-ui, -apple-system, sans-serif;
|
|
360
|
+
font-size: 14px;
|
|
361
|
+
line-height: 20px;
|
|
362
|
+
color: #262626;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.bn-teststep-plain__data,
|
|
366
|
+
.bn-teststep-plain__expected {
|
|
367
|
+
display: block;
|
|
368
|
+
color: #737373;
|
|
369
|
+
font-size: 13px;
|
|
370
|
+
}
|
|
371
|
+
|
|
357
372
|
.bn-teststep,
|
|
358
373
|
.bn-teststep button,
|
|
359
374
|
.bn-teststep input,
|
|
@@ -490,19 +505,15 @@ html.dark .bn-step-image-preview__content {
|
|
|
490
505
|
}
|
|
491
506
|
|
|
492
507
|
.bn-teststep__view-toggle[data-tooltip]::after {
|
|
493
|
-
|
|
494
|
-
left:
|
|
495
|
-
|
|
496
|
-
top: 50%;
|
|
497
|
-
transform: translateY(-50%);
|
|
508
|
+
top: calc(100% + 6px);
|
|
509
|
+
left: 50%;
|
|
510
|
+
transform: translateX(-50%);
|
|
498
511
|
}
|
|
499
512
|
|
|
500
513
|
.bn-teststep__view-toggle--horizontal[data-tooltip]::after {
|
|
501
|
-
|
|
502
|
-
left:
|
|
503
|
-
|
|
504
|
-
top: 50%;
|
|
505
|
-
transform: translateY(-50%) rotate(-90deg);
|
|
514
|
+
top: calc(100% + 6px);
|
|
515
|
+
left: 50%;
|
|
516
|
+
transform: translateX(-50%);
|
|
506
517
|
}
|
|
507
518
|
|
|
508
519
|
.bn-teststep__horizontal-fields {
|
|
@@ -946,7 +957,7 @@ html.dark .bn-step-image-preview__content {
|
|
|
946
957
|
[data-tooltip]::after {
|
|
947
958
|
content: attr(data-tooltip);
|
|
948
959
|
position: absolute;
|
|
949
|
-
|
|
960
|
+
top: calc(100% + 6px);
|
|
950
961
|
left: 50%;
|
|
951
962
|
transform: translateX(-50%);
|
|
952
963
|
background: #0a0a0a;
|
|
@@ -986,7 +997,7 @@ html.dark .bn-step-image-preview__content {
|
|
|
986
997
|
font-weight: 400;
|
|
987
998
|
line-height: 20px;
|
|
988
999
|
color: #262626;
|
|
989
|
-
overflow:
|
|
1000
|
+
overflow: visible;
|
|
990
1001
|
}
|
|
991
1002
|
|
|
992
1003
|
.bn-step-editor--multiline {
|
package/package.json
CHANGED
|
@@ -100,6 +100,32 @@ export const stepBlock = createReactBlockSpec(
|
|
|
100
100
|
return count;
|
|
101
101
|
}, [block.id, documentVersion, editor.document]);
|
|
102
102
|
|
|
103
|
+
// Check if there is a preceding "Steps" heading
|
|
104
|
+
const hasStepsHeading = useMemo(() => {
|
|
105
|
+
const allBlocks = editor.document;
|
|
106
|
+
const blockIndex = allBlocks.findIndex((b) => b.id === block.id);
|
|
107
|
+
if (blockIndex < 0) return false;
|
|
108
|
+
|
|
109
|
+
for (let i = blockIndex - 1; i >= 0; i--) {
|
|
110
|
+
const b = allBlocks[i];
|
|
111
|
+
if (b.type === "testStep" || b.type === "snippet") {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (b.type === "heading") {
|
|
115
|
+
const text = (Array.isArray(b.content) ? b.content : [])
|
|
116
|
+
.filter((n: any) => n.type === "text")
|
|
117
|
+
.map((n: any) => n.text ?? "")
|
|
118
|
+
.join("")
|
|
119
|
+
.trim()
|
|
120
|
+
.toLowerCase()
|
|
121
|
+
.replace(/[:\-–—]$/, "");
|
|
122
|
+
return text === "steps";
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}, [block.id, documentVersion, editor.document]);
|
|
128
|
+
|
|
103
129
|
useEditorChange(() => {
|
|
104
130
|
setDocumentVersion((version) => version + 1);
|
|
105
131
|
}, editor);
|
|
@@ -273,6 +299,17 @@ export const stepBlock = createReactBlockSpec(
|
|
|
273
299
|
const canToggleData = !dataHasContent;
|
|
274
300
|
const canToggleExpected = !expectedHasContent;
|
|
275
301
|
|
|
302
|
+
// Render as plain text when not under a "Steps" heading
|
|
303
|
+
if (!hasStepsHeading) {
|
|
304
|
+
return (
|
|
305
|
+
<div className="bn-teststep-plain" data-block-id={block.id}>
|
|
306
|
+
<span>{stepTitle || "(empty step)"}</span>
|
|
307
|
+
{stepData ? <span className="bn-teststep-plain__data">{stepData}</span> : null}
|
|
308
|
+
{expectedResult ? <span className="bn-teststep-plain__expected">{expectedResult}</span> : null}
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
276
313
|
if (viewMode === "horizontal") {
|
|
277
314
|
return (
|
|
278
315
|
<StepHorizontalView
|
|
@@ -485,37 +485,9 @@ describe("markdownToBlocks", () => {
|
|
|
485
485
|
const blocks = markdownToBlocks(markdown);
|
|
486
486
|
const stepBlocks = blocks.filter((block) => block.type === "testStep");
|
|
487
487
|
|
|
488
|
+
// Preconditions and Postconditions bullets are now parsed as bulletListItem (not testStep)
|
|
489
|
+
// Only items under the "Steps" heading with Expected markers remain as testSteps
|
|
488
490
|
expect(stepBlocks).toEqual([
|
|
489
|
-
{
|
|
490
|
-
type: "testStep",
|
|
491
|
-
props: {
|
|
492
|
-
stepTitle: "The user is logged into the application.",
|
|
493
|
-
stepData: "",
|
|
494
|
-
expectedResult: "",
|
|
495
|
-
listStyle: "bullet",
|
|
496
|
-
},
|
|
497
|
-
children: [],
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
type: "testStep",
|
|
501
|
-
props: {
|
|
502
|
-
stepTitle: "The user has the necessary permissions to receive notifications.",
|
|
503
|
-
stepData: "",
|
|
504
|
-
expectedResult: "",
|
|
505
|
-
listStyle: "bullet",
|
|
506
|
-
},
|
|
507
|
-
children: [],
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
type: "testStep",
|
|
511
|
-
props: {
|
|
512
|
-
stepTitle: "The application is configured to send real-time notifications.",
|
|
513
|
-
stepData: "",
|
|
514
|
-
expectedResult: "",
|
|
515
|
-
listStyle: "bullet",
|
|
516
|
-
},
|
|
517
|
-
children: [],
|
|
518
|
-
},
|
|
519
491
|
{
|
|
520
492
|
type: "testStep",
|
|
521
493
|
props: {
|
|
@@ -556,26 +528,6 @@ describe("markdownToBlocks", () => {
|
|
|
556
528
|
},
|
|
557
529
|
children: [],
|
|
558
530
|
},
|
|
559
|
-
{
|
|
560
|
-
type: "testStep",
|
|
561
|
-
props: {
|
|
562
|
-
stepTitle: "The user has received and viewed the notifications.",
|
|
563
|
-
stepData: "",
|
|
564
|
-
expectedResult: "",
|
|
565
|
-
listStyle: "bullet",
|
|
566
|
-
},
|
|
567
|
-
children: [],
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
type: "testStep",
|
|
571
|
-
props: {
|
|
572
|
-
stepTitle: "The application continues to function as expected after receiving and processing the notifications.",
|
|
573
|
-
stepData: "",
|
|
574
|
-
expectedResult: "",
|
|
575
|
-
listStyle: "bullet",
|
|
576
|
-
},
|
|
577
|
-
children: [],
|
|
578
|
-
},
|
|
579
531
|
]);
|
|
580
532
|
});
|
|
581
533
|
|
|
@@ -674,33 +626,21 @@ describe("markdownToBlocks", () => {
|
|
|
674
626
|
children: [],
|
|
675
627
|
},
|
|
676
628
|
{
|
|
677
|
-
type: "
|
|
678
|
-
props:
|
|
679
|
-
|
|
680
|
-
stepData: "",
|
|
681
|
-
expectedResult: "",
|
|
682
|
-
listStyle: "bullet",
|
|
683
|
-
},
|
|
629
|
+
type: "bulletListItem",
|
|
630
|
+
props: baseProps,
|
|
631
|
+
content: [{ type: "text", text: "The user is logged into the application.", styles: {} }],
|
|
684
632
|
children: [],
|
|
685
633
|
},
|
|
686
634
|
{
|
|
687
|
-
type: "
|
|
688
|
-
props:
|
|
689
|
-
|
|
690
|
-
stepData: "",
|
|
691
|
-
expectedResult: "",
|
|
692
|
-
listStyle: "bullet",
|
|
693
|
-
},
|
|
635
|
+
type: "bulletListItem",
|
|
636
|
+
props: baseProps,
|
|
637
|
+
content: [{ type: "text", text: "The user has the necessary permissions to receive notifications.", styles: {} }],
|
|
694
638
|
children: [],
|
|
695
639
|
},
|
|
696
640
|
{
|
|
697
|
-
type: "
|
|
698
|
-
props:
|
|
699
|
-
|
|
700
|
-
stepData: "",
|
|
701
|
-
expectedResult: "",
|
|
702
|
-
listStyle: "bullet",
|
|
703
|
-
},
|
|
641
|
+
type: "bulletListItem",
|
|
642
|
+
props: baseProps,
|
|
643
|
+
content: [{ type: "text", text: "The application is configured to send real-time notifications.", styles: {} }],
|
|
704
644
|
children: [],
|
|
705
645
|
},
|
|
706
646
|
]);
|
|
@@ -1008,13 +948,9 @@ describe("markdownToBlocks", () => {
|
|
|
1008
948
|
children: [],
|
|
1009
949
|
},
|
|
1010
950
|
{
|
|
1011
|
-
type: "
|
|
1012
|
-
props:
|
|
1013
|
-
|
|
1014
|
-
stepData: "",
|
|
1015
|
-
expectedResult: "",
|
|
1016
|
-
listStyle: "bullet",
|
|
1017
|
-
},
|
|
951
|
+
type: "bulletListItem",
|
|
952
|
+
props: baseProps,
|
|
953
|
+
content: [{ type: "text", text: "Bullet", styles: {} }],
|
|
1018
954
|
children: [],
|
|
1019
955
|
},
|
|
1020
956
|
]);
|
|
@@ -314,7 +314,7 @@ function serializeBlock(
|
|
|
314
314
|
}
|
|
315
315
|
case "bulletListItem": {
|
|
316
316
|
const text = inlineToMarkdown(block.content);
|
|
317
|
-
lines.push(`${indent}
|
|
317
|
+
lines.push(`${indent}* ${text}`.trimEnd());
|
|
318
318
|
lines.push(...serializeChildren(block, ctx));
|
|
319
319
|
return lines;
|
|
320
320
|
}
|
|
@@ -777,14 +777,12 @@ function parseList(
|
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
// Only try to parse as testStep for top-level items (indentLevel === 0)
|
|
780
|
-
//
|
|
781
|
-
//
|
|
782
|
-
if (indentLevel === 0 && (allowEmptySteps ||
|
|
783
|
-
// For bullet lists, always try to parse as test steps
|
|
784
|
-
// For numbered lists, only try if they have step-like characteristics
|
|
780
|
+
// Under a Steps heading (allowEmptySteps=true): always try for both bullet and numbered
|
|
781
|
+
// Outside Steps heading: only if the item looks like a test step (has Expected markers or indented data)
|
|
782
|
+
if (indentLevel === 0 && (allowEmptySteps || isLikelyStep(lines, index))) {
|
|
785
783
|
const looksLikeTestStep = listType === "bullet" ||
|
|
786
784
|
(listType === "numbered" && (
|
|
787
|
-
isLikelyStep(lines, index)
|
|
785
|
+
allowEmptySteps || isLikelyStep(lines, index)
|
|
788
786
|
));
|
|
789
787
|
|
|
790
788
|
if (looksLikeTestStep) {
|
|
@@ -836,20 +834,26 @@ function parseList(
|
|
|
836
834
|
|
|
837
835
|
function isLikelyStep(lines: string[], index: number): boolean {
|
|
838
836
|
// Look ahead to see if there's indented content or expected result
|
|
839
|
-
|
|
837
|
+
// Look ahead through subsequent lines for expected result markers or indented content
|
|
838
|
+
for (let i = index + 1; i < lines.length; i++) {
|
|
839
|
+
const line = lines[i];
|
|
840
|
+
const trimmed = line.trim();
|
|
841
|
+
|
|
842
|
+
// Stop at blank lines
|
|
843
|
+
if (!trimmed) break;
|
|
840
844
|
|
|
841
|
-
|
|
842
|
-
|
|
845
|
+
// Check for indented content (step data) first — indented lines indicate a test step
|
|
846
|
+
const hasIndent = /^\s{2,}/.test(line);
|
|
847
|
+
if (hasIndent) return true;
|
|
843
848
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
849
|
+
// Stop at new list items, headings, or other block-level elements (only if not indented)
|
|
850
|
+
if (/^[-*+]\s/.test(trimmed) || /^\d+[.)]\s/.test(trimmed)) break;
|
|
851
|
+
if (trimmed.startsWith("#") || trimmed.startsWith(">") || trimmed.startsWith("|") || trimmed.startsWith("```") || trimmed.startsWith(":::")) break;
|
|
847
852
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (hasIndent && !/^\d+[.)]/.test(nextTrimmed) && !/^[-*+]/.test(nextTrimmed)) return true;
|
|
853
|
+
// Check for expected result markers
|
|
854
|
+
if (EXPECTED_LABEL_REGEX.test(trimmed)) return true;
|
|
855
|
+
if (trimmed.match(/^\*[^*]*expected/i)) return true;
|
|
856
|
+
}
|
|
853
857
|
|
|
854
858
|
return false;
|
|
855
859
|
}
|
|
@@ -1377,7 +1381,9 @@ export function markdownToBlocks(markdown: string): CustomPartialBlock[] {
|
|
|
1377
1381
|
continue;
|
|
1378
1382
|
}
|
|
1379
1383
|
|
|
1380
|
-
const stepLikeBlock =
|
|
1384
|
+
const stepLikeBlock = (stepsHeadingLevel !== null || isLikelyStep(lines, index))
|
|
1385
|
+
? parseTestStep(lines, index, stepsHeadingLevel !== null)
|
|
1386
|
+
: null;
|
|
1381
1387
|
if (stepLikeBlock) {
|
|
1382
1388
|
blocks.push(stepLikeBlock.block);
|
|
1383
1389
|
index = stepLikeBlock.nextIndex;
|
package/src/editor/styles.css
CHANGED
|
@@ -354,6 +354,21 @@ html.dark .bn-step-image-preview__content {
|
|
|
354
354
|
background: var(--status-blocked-bg);
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
+
.bn-teststep-plain {
|
|
358
|
+
padding: 4px 0;
|
|
359
|
+
font-family: "Inter", system-ui, -apple-system, sans-serif;
|
|
360
|
+
font-size: 14px;
|
|
361
|
+
line-height: 20px;
|
|
362
|
+
color: #262626;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.bn-teststep-plain__data,
|
|
366
|
+
.bn-teststep-plain__expected {
|
|
367
|
+
display: block;
|
|
368
|
+
color: #737373;
|
|
369
|
+
font-size: 13px;
|
|
370
|
+
}
|
|
371
|
+
|
|
357
372
|
.bn-teststep,
|
|
358
373
|
.bn-teststep button,
|
|
359
374
|
.bn-teststep input,
|
|
@@ -490,19 +505,15 @@ html.dark .bn-step-image-preview__content {
|
|
|
490
505
|
}
|
|
491
506
|
|
|
492
507
|
.bn-teststep__view-toggle[data-tooltip]::after {
|
|
493
|
-
|
|
494
|
-
left:
|
|
495
|
-
|
|
496
|
-
top: 50%;
|
|
497
|
-
transform: translateY(-50%);
|
|
508
|
+
top: calc(100% + 6px);
|
|
509
|
+
left: 50%;
|
|
510
|
+
transform: translateX(-50%);
|
|
498
511
|
}
|
|
499
512
|
|
|
500
513
|
.bn-teststep__view-toggle--horizontal[data-tooltip]::after {
|
|
501
|
-
|
|
502
|
-
left:
|
|
503
|
-
|
|
504
|
-
top: 50%;
|
|
505
|
-
transform: translateY(-50%) rotate(-90deg);
|
|
514
|
+
top: calc(100% + 6px);
|
|
515
|
+
left: 50%;
|
|
516
|
+
transform: translateX(-50%);
|
|
506
517
|
}
|
|
507
518
|
|
|
508
519
|
.bn-teststep__horizontal-fields {
|
|
@@ -946,7 +957,7 @@ html.dark .bn-step-image-preview__content {
|
|
|
946
957
|
[data-tooltip]::after {
|
|
947
958
|
content: attr(data-tooltip);
|
|
948
959
|
position: absolute;
|
|
949
|
-
|
|
960
|
+
top: calc(100% + 6px);
|
|
950
961
|
left: 50%;
|
|
951
962
|
transform: translateX(-50%);
|
|
952
963
|
background: #0a0a0a;
|
|
@@ -986,7 +997,7 @@ html.dark .bn-step-image-preview__content {
|
|
|
986
997
|
font-weight: 400;
|
|
987
998
|
line-height: 20px;
|
|
988
999
|
color: #262626;
|
|
989
|
-
overflow:
|
|
1000
|
+
overflow: visible;
|
|
990
1001
|
}
|
|
991
1002
|
|
|
992
1003
|
.bn-step-editor--multiline {
|