openpencil/tests/engine
Danila Poyarkov f2ef9c976d
XPath query for node selection (#82)
* Add XPath query for node selection

- packages/core/src/xpath.ts: XPath engine using fontoxpath with custom
  DOM facade over SceneGraph nodes
- RPC command: 'query' with selector, page, limit params
- CLI command: 'open-pencil query <file> <xpath>' with --json, --page, --limit
- AI/MCP tool: 'query_nodes' with XPath examples in description
- Queryable attributes: name, width, height, x, y, visible, opacity,
  cornerRadius, fontSize, fontFamily, fontWeight, layoutMode, itemSpacing,
  padding*, strokeWeight, rotation, locked, blendMode, text, lineHeight,
  letterSpacing

* Add tests and docs for XPath query

- 9 unit tests for queryByXPath/matchByXPath core functions
- 6 tool tests for query_nodes AI/MCP tool
- README: query examples in CLI section
- VitePress docs: patterns, queryable attributes, example output
- CHANGELOG: feature entry

* Lazy-load fontoxpath to avoid bundling in desktop app

- Dynamic import() instead of static import for fontoxpath
- queryByXPath/matchByXPath now async (they were sync before)
- RpcCommand.execute allows R | Promise<R> for async commands
- Fix 2 lint errors (unnecessary optional chain, always-truthy)
- Update all tests and CLI to await results
2026-03-09 15:32:27 +03:00
..
abspos-cache.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
acp-agent.test.ts Add ACP agent package with tests 2026-03-05 09:14:54 +03:00
clipboard.test.ts Merge pull request #78 from open-pencil/detach-orphaned-instances 2026-03-09 00:11:05 +03:00
color.test.ts Centralize all color utilities in color.ts 2026-03-07 10:02:11 +03:00
copy.test.ts Fix copyFill missing gradientTransform/imageTransform, add copy tests 2026-03-09 08:50:28 +03:00
effects-and-resize.test.ts Fix effects rendering: shadows, blur, spread (#24) 2026-03-03 09:53:39 +03:00
eval-cli.test.ts Fix hit-testing: scope hover to current page, click-through empty containers 2026-03-05 08:56:35 +03:00
export-jsx.test.ts CSS Grid layout mode (#73) 2026-03-08 18:23:53 +03:00
fig-import.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
fig-roundtrip.test.ts Emit derivedTextData and textUserLayoutVersion for text nodes 2026-03-08 23:28:54 +03:00
figma-api.test.ts Fill Figma Plugin API gaps: 29 new tests, 30+ new properties and methods 2026-03-01 13:35:02 +03:00
fonts.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
individual-strokes.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
layout.test.ts CSS Grid layout mode (#73) 2026-03-08 18:23:53 +03:00
mcp-server.test.ts Fix hit-testing: scope hover to current page, click-through empty containers 2026-03-05 08:56:35 +03:00
mcp.test.ts Fix hit-testing: scope hover to current page, click-through empty containers 2026-03-05 08:56:35 +03:00
multi-selection.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
mutation.test.ts Add mutation unit tests: toggleBoldInRange, vectorNetworkBlob precision, SceneGraph+UndoManager integration 2026-03-07 23:11:03 +03:00
perf.bench.ts Fix copyFill missing gradientTransform/imageTransform, add copy tests 2026-03-09 08:50:28 +03:00
profiler.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
render.test.ts Tailwind CSS v4 JSX export (#54) 2026-03-06 18:04:11 +03:00
renderer-effects.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
scene-graph.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
snap.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
style-runs.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
svg-export.test.ts SVG export (#52) 2026-03-05 10:31:02 +03:00
tailwind-jsx.test.ts CSS Grid layout mode (#73) 2026-03-08 18:23:53 +03:00
text-editor.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
tools-ai-adapter.test.ts Unify tool definitions: define once, adapt for AI/CLI/MCP 2026-03-01 15:02:05 +03:00
tools-cli.test.ts Fix hit-testing: scope hover to current page, click-through empty containers 2026-03-05 08:56:35 +03:00
tools.test.ts XPath query for node selection (#82) 2026-03-09 15:32:27 +03:00
undo.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
vector.test.ts Clean up tools/schema, add geometry.ts, isMixed helper, fix imports, add tests 2026-03-06 22:33:10 +03:00
xpath.test.ts XPath query for node selection (#82) 2026-03-09 15:32:27 +03:00