Files
windmill/frontend/src/lib/components/pendingEditorFlush.test.ts
T
GuilhemandClaude Opus 5 adc7947579 feat: open an AI session from runs, jobs and trigger pages (#10608)
* feat: open an AI session from the runs and trigger pages

* feat: tell the chat which page the session preview shows

* fix: observe shallow url writes and keep page tabs deduped by path

* feat: open an AI session from the resource and variable drawers

* fix: re-point page tabs on hash change and follow the drawer's workspace

* fix: force a load when a page tab is re-pointed within one document

* fix: report a re-pointed preview tab as retargeted, not opened

* fix: reload a preview tab re-pointed at the url the frame drifted from

* fix: canonicalize runs previews and read drawer anchors per page

* fix: dedupe page tabs on the path so self-written filters don't duplicate

* perf: carry the active-preview rule only in chats that have a side panel

* fix: read a preview tab's hash as a row only where the page deep-links one

* fix: focus the preview tab showing the exact location before retargeting by path

* refactor: give preview locations one module that says what they mean

* fix: report the active preview from what is on screen, not the selected tab

* fix: read a preview location's view from the params a request can set

* fix: count every filter a request can set, and flush drawer drafts before routing

* docs: state each preview-routing constraint once, within four lines

* fix: take a page's view params from the filter schema it already declares

* docs: describe the filter contract the url builders now follow

* fix: describe a preview to the model from addressing fields only

* fix: keep a filter value holding a delimiter apart from two filters

* fix: keep a preview description to one line the model can trust

* fix: materialize the resource editors before persisting the draft

* docs: bring the preview-routing constraints back within four lines

* fix: refuse to route a preview on state the drawer could not persist

* fix: read a resource drawer's validity from the editor, not from draft dirtiness

* fix: answer what the user can see from one place in both descriptions

* refactor: name each write to a preview tab's two locations, and the read

* fix: flush only editors holding a pending change

* fix: drop a list page's row anchor when its drawer closes

* fix: clear the row anchor on every list page that deep-links one

* fix: keep a closed drawer closed, and refuse to leave unparseable text

* refactor: register the resource json field in the shared unparseable set

* refactor: decide a forced load where the command changes, not in the host

* fix: navigate a preview frame only when it is not already there

* fix: boot a remounted preview frame where the user left it

* fix: carry a list page's filters and open row into the session

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: navigate a preview frame by what it shows, not by its url

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: read a resource's raw-editor validity from the current parse

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: compare preview views without iterating URLSearchParams

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor: drop re-exports the path leaf left without readers

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 11:12:52 +00:00

28 lines
814 B
TypeScript

import { describe, it, expect } from 'vitest'
import {
anyEditorUnparseable,
setEditorUnparseable,
registerPendingEditor,
flushAllPendingEditorChanges
} from './pendingEditorFlush'
describe('pendingEditorFlush', () => {
it('reports unparseable text until the editor clears it', () => {
const editor = {}
expect(anyEditorUnparseable()).toBe(false)
setEditorUnparseable(editor, true)
expect(anyEditorUnparseable()).toBe(true)
setEditorUnparseable(editor, false)
expect(anyEditorUnparseable()).toBe(false)
})
it('flushes registered editors, and stops once they unmount', () => {
let flushed = 0
const deregister = registerPendingEditor({ flushPendingChanges: () => flushed++ })
flushAllPendingEditorChanges()
deregister()
flushAllPendingEditorChanges()
expect(flushed).toBe(1)
})
})