2026-05-16 13:55:34 +00:00
|
|
|
import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
|
2026-05-06 07:10:54 +00:00
|
|
|
import { expectDefined } from '#tests/helpers/assert'
|
2026-05-16 13:19:03 +00:00
|
|
|
import { getSelectedNode } from '#tests/helpers/store'
|
2026-05-05 23:22:08 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const editor = useEditorSetup()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
|
|
|
|
function getPageChildren() {
|
2026-05-16 13:55:34 +00:00
|
|
|
return editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-05 23:59:56 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
return store.graph.getChildren(store.state.currentPageId).map((n) => ({
|
|
|
|
|
type: n.type,
|
|
|
|
|
name: n.name,
|
|
|
|
|
text: n.text
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test('pressing T activates text tool', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('t')
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const tool = await editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-06 07:10:54 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
|
|
|
|
return store.state.activeTool
|
|
|
|
|
})
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
expect(tool).toBe('TEXT')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('clicking with text tool creates a text node', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.canvas.click(200, 200)
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
|
|
|
|
// Wait a tick for text editing mode to activate
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.waitForTimeout(200)
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
|
|
|
|
const children = await getPageChildren()
|
|
|
|
|
const textNode = children.find((c) => c.type === 'TEXT')
|
|
|
|
|
expect(textNode).toBeTruthy()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('text node is selected after creation', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
const node = await getSelectedNode(editor.page)
|
2026-05-06 07:10:54 +00:00
|
|
|
expect(node?.type).toBe('TEXT')
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('typography section appears for text node', async () => {
|
|
|
|
|
// Exit text editing mode
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('Escape')
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
|
|
|
|
// Re-select the text node
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.canvas.click(200, 200)
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const typoSection = editor.page.getByTestId('typography-section')
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
await expect(typoSection).toBeVisible()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('text node has default font properties', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
const node = await getSelectedNode(editor.page)
|
2026-05-06 07:10:54 +00:00
|
|
|
expect(node?.fontSize).toBeGreaterThan(0)
|
|
|
|
|
expect(node?.fontFamily).toBeTruthy()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('creating text via store works', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('Escape')
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-05 23:59:56 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
const id = store.createShape('TEXT', 100, 300, 200, 30)
|
|
|
|
|
store.graph.updateNode(id, { text: 'Hello World', fontSize: 24, fontFamily: 'Inter' })
|
|
|
|
|
store.select([id])
|
|
|
|
|
})
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const node = await getSelectedNode(editor.page)
|
2026-05-06 07:10:54 +00:00
|
|
|
expect(node?.text).toBe('Hello World')
|
|
|
|
|
expect(node?.fontSize).toBe(24)
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('undo removes text node', async () => {
|
|
|
|
|
const beforeCount = (await getPageChildren()).length
|
|
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.canvas.undo()
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
|
|
|
|
const afterCount = (await getPageChildren()).length
|
|
|
|
|
expect(afterCount).toBe(beforeCount - 1)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('frame tool creates FRAME node', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('f')
|
|
|
|
|
await editor.canvas.drag(400, 100, 600, 250)
|
|
|
|
|
await editor.canvas.waitForRender()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const node = expectDefined(await getSelectedNode(editor.page), 'selected frame')
|
2026-05-06 07:10:54 +00:00
|
|
|
expect(node.type).toBe('FRAME')
|
|
|
|
|
expect(node.width).toBeGreaterThan(0)
|
|
|
|
|
expect(node.height).toBeGreaterThan(0)
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
editor.canvas.assertNoErrors()
|
Add 8 E2E test suites for release sanity coverage
83 new tests across 8 files:
- design-panel: selection → properties panel, fill/stroke/effect add, visibility toggle, multi-select
- code-panel: JSX output, OpenPencil/Tailwind toggle, copy button, empty state
- components: create component (⌘⌥K), create instance, propagation, detach
- copy-paste: store copy/paste, ⌘D duplicate, cut, multi-select duplicate
- multi-page: add/switch/delete pages, rename, last-page protection
- text-editing: text tool, text node creation, typography section, frame tool
- keyboard-shortcuts: all 9 tool keys, ⌘A/Escape/Backspace, ]/[, ⌘G/⌘⇧G, ⌘\, ⌘Z/⌘⇧Z
- context-menu: right-click items, duplicate/visibility/lock/delete/group/component, Copy as submenu
2026-03-07 10:23:32 +00:00
|
|
|
})
|
2026-04-06 12:40:18 +00:00
|
|
|
|
|
|
|
|
test('Enter key opens text editing and selects all without erasing', async () => {
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('Escape')
|
|
|
|
|
await editor.canvas.waitForRender()
|
2026-04-06 12:40:18 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const textId = await editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-05 23:59:56 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
2026-04-06 12:40:18 +00:00
|
|
|
const id = store.createShape('TEXT', 300, 300, 200, 30)
|
|
|
|
|
store.graph.updateNode(id, { text: 'Keep this text' })
|
|
|
|
|
store.select([id])
|
|
|
|
|
store.requestRender()
|
|
|
|
|
return id
|
|
|
|
|
})
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.canvas.waitForRender()
|
2026-04-06 12:40:18 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const before = await getSelectedNode(editor.page)
|
2026-05-06 07:10:54 +00:00
|
|
|
expect(before?.text).toBe('Keep this text')
|
|
|
|
|
expect(before?.type).toBe('TEXT')
|
2026-04-06 12:40:18 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
await editor.page.keyboard.press('Enter')
|
|
|
|
|
await editor.page.waitForTimeout(200)
|
2026-04-06 12:40:18 +00:00
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const editing = await editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-06 07:10:54 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
|
|
|
|
return store.state.editingTextId
|
|
|
|
|
})
|
2026-04-06 12:40:18 +00:00
|
|
|
expect(editing).toBe(textId)
|
|
|
|
|
|
2026-05-16 13:55:34 +00:00
|
|
|
const after = await editor.page.evaluate(() => {
|
2026-05-06 09:19:39 +00:00
|
|
|
const store = window.openPencil?.getStore?.()
|
2026-05-05 23:59:56 +00:00
|
|
|
if (!store) throw new Error('OpenPencil store not initialized')
|
2026-04-06 12:40:18 +00:00
|
|
|
const id = store.state.editingTextId
|
|
|
|
|
if (!id) return null
|
|
|
|
|
return store.graph.getNode(id)?.text ?? null
|
|
|
|
|
})
|
|
|
|
|
expect(after).toBe('Keep this text')
|
|
|
|
|
})
|