2026-05-16 13:19:03 +00:00
|
|
|
import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
import { expectDefined } from '#tests/helpers/assert'
|
2026-05-05 23:22:08 +00:00
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
const editor = useEditorSetup()
|
2026-03-07 19:11:25 +00:00
|
|
|
|
|
|
|
|
test('layers panel resize increases width', async () => {
|
2026-05-16 13:19:03 +00:00
|
|
|
const panel = editor.page.getByTestId('layers-panel')
|
2026-03-07 19:11:25 +00:00
|
|
|
const before = await panel.boundingBox()
|
|
|
|
|
expect(before).not.toBeNull()
|
|
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
const handle = editor.page.getByTestId('left-splitter-handle')
|
2026-03-07 19:11:25 +00:00
|
|
|
const handleBox = await handle.boundingBox()
|
|
|
|
|
expect(handleBox).not.toBeNull()
|
|
|
|
|
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
const handleBounds = expectDefined(handleBox, 'splitter handle bounds')
|
|
|
|
|
const beforeBounds = expectDefined(before, 'layers panel bounds')
|
|
|
|
|
const cx = handleBounds.x + handleBounds.width / 2
|
|
|
|
|
const cy = handleBounds.y + handleBounds.height / 2
|
2026-03-07 19:11:25 +00:00
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.mouse.move(cx, cy)
|
|
|
|
|
await editor.page.mouse.down()
|
|
|
|
|
await editor.page.mouse.move(cx + 80, cy, { steps: 10 })
|
|
|
|
|
await editor.page.mouse.up()
|
|
|
|
|
await editor.canvas.waitForRender()
|
2026-03-07 19:11:25 +00:00
|
|
|
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
const after = expectDefined(await panel.boundingBox(), 'resized layers panel bounds')
|
|
|
|
|
expect(after.width).toBeGreaterThan(beforeBounds.width + 40)
|
2026-05-16 13:19:03 +00:00
|
|
|
editor.canvas.assertNoErrors()
|
2026-03-07 19:11:25 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('panel width persists after page reload', async () => {
|
2026-05-05 11:58:02 +00:00
|
|
|
// Allow Reka's auto-save debounce to flush before recording the width
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.waitForTimeout(300)
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
const recordedWidth = expectDefined(
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.getByTestId('layers-panel').boundingBox(),
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
'persisted layers panel bounds'
|
|
|
|
|
).width
|
2026-03-07 19:11:25 +00:00
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.reload()
|
|
|
|
|
await editor.canvas.waitForInit()
|
2026-03-07 19:11:25 +00:00
|
|
|
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
const after = expectDefined(
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.getByTestId('layers-panel').boundingBox(),
|
chore(tests): guard more test lookups
- Remove non-null assertions from context menu, panels, perf, properties, MCP, SVG, undo, and instance override tests
- Add explicit store, renderer, node, and bounding-box guards
- Validate affected engine and E2E tests
2026-05-06 06:43:28 +00:00
|
|
|
'reloaded layers panel bounds'
|
|
|
|
|
)
|
|
|
|
|
expect(Math.abs(after.width - recordedWidth)).toBeLessThanOrEqual(2)
|
2026-05-16 13:19:03 +00:00
|
|
|
editor.canvas.assertNoErrors()
|
2026-03-07 19:11:25 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('Cmd+Backslash hides panels', async () => {
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.keyboard.press('Meta+\\')
|
|
|
|
|
await editor.canvas.waitForRender()
|
2026-03-07 19:11:25 +00:00
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
await expect(editor.page.getByTestId('layers-panel')).not.toBeVisible()
|
|
|
|
|
editor.canvas.assertNoErrors()
|
2026-03-07 19:11:25 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('Cmd+Backslash shows panels again', async () => {
|
2026-05-16 13:19:03 +00:00
|
|
|
await editor.page.keyboard.press('Meta+\\')
|
|
|
|
|
await editor.canvas.waitForRender()
|
2026-03-07 19:11:25 +00:00
|
|
|
|
2026-05-16 13:19:03 +00:00
|
|
|
await expect(editor.page.getByTestId('layers-panel')).toBeVisible()
|
|
|
|
|
editor.canvas.assertNoErrors()
|
2026-03-07 19:11:25 +00:00
|
|
|
})
|