test(gutenberg-to-portable-text): add transform tests (#332)

* test(gutenberg-to-portable-text): add transform tests

This adds a bunch of tests, mostly for the transformers but also some
minor edge cases in the inline parser, too.

It also enables `noUnusedLocals` in `tsconfig.json` which caught a
couple of unused things.

* chore: add domain to each

* style: format

* chore: remove some figures

---------

Co-authored-by: emdashbot[bot] <emdashbot[bot]@users.noreply.github.com>
This commit is contained in:
James Garbutt
2026-04-07 07:36:14 +01:00
committed by GitHub
parent dbaf8c6f85
commit a996387de4
5 changed files with 401 additions and 9 deletions

View File

@@ -9,7 +9,7 @@
import { parse } from "@wordpress/block-serialization-default-parser";
import { parseInlineContent } from "./inline.js";
import { getTransformer, defaultTransformers, fallbackTransformer } from "./transformers/index.js";
import { getTransformer } from "./transformers/index.js";
import type {
GutenbergBlock,
PortableTextBlock,

View File

@@ -550,8 +550,6 @@ export const group: BlockTransformer = (block, _options, context) => {
* core/table → table block
*/
export const table: BlockTransformer = (block, _options, context) => {
const _hasFixedLayout = attrBoolean(block.attrs, "hasFixedLayout");
// Parse the table HTML
const tableMatch = block.innerHTML.match(TABLE_TAG_PATTERN);
if (!tableMatch) {