testomatio-editor-blocks 0.4.13 → 0.4.15

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.
@@ -1028,7 +1028,7 @@ function parseParagraph(lines, index) {
1028
1028
  }
1029
1029
  function parseSnippetWrapper(lines, index) {
1030
1030
  const trimmed = lines[index].trim();
1031
- const startMatch = trimmed.match(/^<!--\s*begin snippet\s*#?([^\s>]+)\s*-->/i);
1031
+ const startMatch = trimmed.match(/^<!--\s*begin snippet\s*#?\s*([^\s>]+)\s*-->/i);
1032
1032
  if (!startMatch) {
1033
1033
  return null;
1034
1034
  }
@@ -1037,7 +1037,7 @@ function parseSnippetWrapper(lines, index) {
1037
1037
  let next = index + 1;
1038
1038
  while (next < lines.length) {
1039
1039
  const maybeEnd = lines[next].trim();
1040
- const endMatch = maybeEnd.match(/^<!--\s*end snippet\s*#?([^\s>]+)?\s*-->/i);
1040
+ const endMatch = maybeEnd.match(/^<!--\s*end snippet\s*#?\s*([^\s>]+)?\s*-->/i);
1041
1041
  if (endMatch) {
1042
1042
  const endId = endMatch[1];
1043
1043
  if (!endId || endId === snippetId) {
@@ -1048,7 +1048,7 @@ function parseSnippetWrapper(lines, index) {
1048
1048
  next += 1;
1049
1049
  continue;
1050
1050
  }
1051
- const otherStart = maybeEnd.match(/^<!--\s*begin snippet\s*#?([^\s>]+)\s*-->/i);
1051
+ const otherStart = maybeEnd.match(/^<!--\s*begin snippet\s*#?\s*([^\s>]+)\s*-->/i);
1052
1052
  if (otherStart) {
1053
1053
  // Skip nested snippet wrappers from the body entirely.
1054
1054
  next += 1;
@@ -11,6 +11,7 @@ export type SnippetJsonApiAttributes = {
11
11
  body?: string | null;
12
12
  description?: string | null;
13
13
  "usage-count"?: number | string | null;
14
+ "is-snippet"?: boolean | null;
14
15
  };
15
16
  export type SnippetJsonApiResource = {
16
17
  id?: string | number | null;
@@ -79,7 +79,7 @@ function normalizeJsonApiResource(resource) {
79
79
  body: (_c = (_b = attrs === null || attrs === void 0 ? void 0 : attrs.body) !== null && _b !== void 0 ? _b : attrs === null || attrs === void 0 ? void 0 : attrs.description) !== null && _c !== void 0 ? _c : null,
80
80
  description: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.description) !== null && _d !== void 0 ? _d : null,
81
81
  usageCount: coerceNumber(attrs === null || attrs === void 0 ? void 0 : attrs["usage-count"]),
82
- isSnippet: true,
82
+ isSnippet: (attrs === null || attrs === void 0 ? void 0 : attrs["is-snippet"]) === true,
83
83
  };
84
84
  }
85
85
  function isSnippetSuggestionArray(value) {
@@ -498,11 +498,11 @@ html.dark .bn-step-image-preview__content {
498
498
  }
499
499
 
500
500
  .bn-teststep__view-toggle--horizontal[data-tooltip]::after {
501
- right: auto;
502
- top: auto;
503
- bottom: calc(100% + 6px);
504
- left: 50%;
505
- transform: translateX(-50%) rotate(-90deg);
501
+ bottom: auto;
502
+ left: auto;
503
+ right: calc(100% + 6px);
504
+ top: 50%;
505
+ transform: translateY(-50%) rotate(-90deg);
506
506
  }
507
507
 
508
508
  .bn-teststep__horizontal-fields {
@@ -656,16 +656,22 @@ html.dark .bn-step-image-preview__content {
656
656
  }
657
657
 
658
658
  .bn-snippet-dropdown__search-input {
659
- border: none;
660
- outline: none;
661
- background: transparent;
659
+ border: none !important;
660
+ outline: none !important;
661
+ background: transparent !important;
662
662
  font-family: inherit;
663
- font-size: 14px;
663
+ font-size: 14px !important;
664
664
  font-weight: 500;
665
- line-height: normal;
665
+ line-height: normal !important;
666
666
  color: var(--text-primary);
667
667
  width: 100%;
668
- padding: 0;
668
+ height: auto;
669
+ display: inline !important;
670
+ padding: 0 !important;
671
+ appearance: none !important;
672
+ -webkit-appearance: none !important;
673
+ border-radius: 0 !important;
674
+ box-shadow: none !important;
669
675
  }
670
676
 
671
677
  .bn-snippet-dropdown__search-input::placeholder {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testomatio-editor-blocks",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
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",
package/src/App.tsx CHANGED
@@ -254,6 +254,7 @@ const DEMO_SNIPPET_FIXTURES: SnippetJsonApiDocument = {
254
254
  body: "Open /login\nWait for form to render\nEnsure no console errors",
255
255
  description: "Navigate to login and wait for readiness",
256
256
  "usage-count": 12,
257
+ "is-snippet": true,
257
258
  },
258
259
  },
259
260
  {
@@ -264,6 +265,7 @@ const DEMO_SNIPPET_FIXTURES: SnippetJsonApiDocument = {
264
265
  body: "Type email\nType password\nClick Sign In",
265
266
  description: "Reusable credentials filler",
266
267
  "usage-count": 9,
268
+ "is-snippet": true,
267
269
  },
268
270
  },
269
271
  {
@@ -274,6 +276,7 @@ const DEMO_SNIPPET_FIXTURES: SnippetJsonApiDocument = {
274
276
  body: "Assert toast visible\nWait 3s\nAssert toast removed",
275
277
  description: "Shared assertion for ephemeral notifications",
276
278
  "usage-count": 7,
279
+ "is-snippet": true,
277
280
  },
278
281
  },
279
282
  ],
@@ -385,6 +385,28 @@ describe("markdownToBlocks", () => {
385
385
  ]);
386
386
  });
387
387
 
388
+ it("parses snippet markdown with space between # and ID", () => {
389
+ const markdown = [
390
+ "<!-- begin snippet # 22289 -->",
391
+ "* Fill `<Email>` with correct registered email",
392
+ "* Verify that the update to the target is successful",
393
+ "<!-- end snippet # 22289 -->",
394
+ ].join("\n");
395
+
396
+ expect(markdownToBlocks(markdown)).toEqual([
397
+ {
398
+ type: "snippet",
399
+ props: {
400
+ snippetId: "22289",
401
+ snippetTitle: "",
402
+ snippetData: "* Fill `<Email>` with correct registered email\n* Verify that the update to the target is successful",
403
+ snippetExpectedResult: "",
404
+ },
405
+ children: [],
406
+ },
407
+ ]);
408
+ });
409
+
388
410
  it("parses snippet bodies and ignores nested snippet markers", () => {
389
411
  const markdown = [
390
412
  "<!-- begin snippet #888 -->",
@@ -1238,7 +1238,7 @@ function parseSnippetWrapper(
1238
1238
  index: number,
1239
1239
  ): { block: CustomPartialBlock; nextIndex: number } | null {
1240
1240
  const trimmed = lines[index].trim();
1241
- const startMatch = trimmed.match(/^<!--\s*begin snippet\s*#?([^\s>]+)\s*-->/i);
1241
+ const startMatch = trimmed.match(/^<!--\s*begin snippet\s*#?\s*([^\s>]+)\s*-->/i);
1242
1242
  if (!startMatch) {
1243
1243
  return null;
1244
1244
  }
@@ -1249,7 +1249,7 @@ function parseSnippetWrapper(
1249
1249
 
1250
1250
  while (next < lines.length) {
1251
1251
  const maybeEnd = lines[next].trim();
1252
- const endMatch = maybeEnd.match(/^<!--\s*end snippet\s*#?([^\s>]+)?\s*-->/i);
1252
+ const endMatch = maybeEnd.match(/^<!--\s*end snippet\s*#?\s*([^\s>]+)?\s*-->/i);
1253
1253
  if (endMatch) {
1254
1254
  const endId = endMatch[1];
1255
1255
  if (!endId || endId === snippetId) {
@@ -1260,7 +1260,7 @@ function parseSnippetWrapper(
1260
1260
  next += 1;
1261
1261
  continue;
1262
1262
  }
1263
- const otherStart = maybeEnd.match(/^<!--\s*begin snippet\s*#?([^\s>]+)\s*-->/i);
1263
+ const otherStart = maybeEnd.match(/^<!--\s*begin snippet\s*#?\s*([^\s>]+)\s*-->/i);
1264
1264
  if (otherStart) {
1265
1265
  // Skip nested snippet wrappers from the body entirely.
1266
1266
  next += 1;
@@ -19,6 +19,7 @@ describe("snippet autocomplete", () => {
19
19
  body: "Open /login",
20
20
  description: "Ready state",
21
21
  "usage-count": 4,
22
+ "is-snippet": true,
22
23
  },
23
24
  },
24
25
  ],
@@ -14,6 +14,7 @@ export type SnippetJsonApiAttributes = {
14
14
  body?: string | null;
15
15
  description?: string | null;
16
16
  "usage-count"?: number | string | null;
17
+ "is-snippet"?: boolean | null;
17
18
  };
18
19
 
19
20
  export type SnippetJsonApiResource = {
@@ -118,7 +119,7 @@ function normalizeJsonApiResource(resource: SnippetJsonApiResource | null | unde
118
119
  body: attrs?.body ?? attrs?.description ?? null,
119
120
  description: attrs?.description ?? null,
120
121
  usageCount: coerceNumber(attrs?.["usage-count"]),
121
- isSnippet: true,
122
+ isSnippet: attrs?.["is-snippet"] === true,
122
123
  };
123
124
  }
124
125
 
@@ -498,11 +498,11 @@ html.dark .bn-step-image-preview__content {
498
498
  }
499
499
 
500
500
  .bn-teststep__view-toggle--horizontal[data-tooltip]::after {
501
- right: auto;
502
- top: auto;
503
- bottom: calc(100% + 6px);
504
- left: 50%;
505
- transform: translateX(-50%) rotate(-90deg);
501
+ bottom: auto;
502
+ left: auto;
503
+ right: calc(100% + 6px);
504
+ top: 50%;
505
+ transform: translateY(-50%) rotate(-90deg);
506
506
  }
507
507
 
508
508
  .bn-teststep__horizontal-fields {
@@ -656,16 +656,22 @@ html.dark .bn-step-image-preview__content {
656
656
  }
657
657
 
658
658
  .bn-snippet-dropdown__search-input {
659
- border: none;
660
- outline: none;
661
- background: transparent;
659
+ border: none !important;
660
+ outline: none !important;
661
+ background: transparent !important;
662
662
  font-family: inherit;
663
- font-size: 14px;
663
+ font-size: 14px !important;
664
664
  font-weight: 500;
665
- line-height: normal;
665
+ line-height: normal !important;
666
666
  color: var(--text-primary);
667
667
  width: 100%;
668
- padding: 0;
668
+ height: auto;
669
+ display: inline !important;
670
+ padding: 0 !important;
671
+ appearance: none !important;
672
+ -webkit-appearance: none !important;
673
+ border-radius: 0 !important;
674
+ box-shadow: none !important;
669
675
  }
670
676
 
671
677
  .bn-snippet-dropdown__search-input::placeholder {