Skip to content

Add characterization tests for jump-to-field and field-focus scroll behavior - #2

Draft
jaipilot[bot] wants to merge 1 commit into
jaipilot-campaign/jabref-16639-headfrom
jaipilot/pr-1-nKR8EjYKpxQs
Draft

Add characterization tests for jump-to-field and field-focus scroll behavior#2
jaipilot[bot] wants to merge 1 commit into
jaipilot-campaign/jabref-16639-headfrom
jaipilot/pr-1-nKR8EjYKpxQs

Conversation

@jaipilot

@jaipilot jaipilot Bot commented Aug 22, 2026

Copy link
Copy Markdown

Related PR

Companion evaluation of JabRef#16639 (mirrored here as skrcode/jabref PR #1, head a178cfb).

What this does

This is a test-only companion: it adds two focused JUnit test classes that lock the observable behavior this PR introduces. No production code is changed.

  • jabgui/src/test/java/org/jabref/gui/entryeditor/JumpToFieldViewModelTest.java: proves JumpToFieldViewModel#getFieldNames() now returns every known field (sorted, distinct), not just fields already shown in the entry editor, and returns an empty list when no entry is being edited.
  • jabgui/src/test/java/org/jabref/gui/fieldeditors/FieldEditorFXFocusTest.java: proves FieldEditorFX#focus() requests focus on the actual nested TextInputControl (not just the editor's first child), scrolls an ancestor ScrollPane to reveal a field that is below the viewport, and leaves the scroll position untouched when the field already fits in the viewport.

Why no production change

The changed production files (AllFieldsTab, EntryEditor, EntryEditorFocusUtils, JumpToFieldViewModel, FieldEditorFX, JabRefFrame) were reviewed for cleanup, performance, and modernization opportunities. The diff is small and already clean: Checkstyle, the modernizer task, and an OpenRewrite dry-run report no findings, and no unused code, duplication, or measurable hot path exists in the changed paths. The one non-obvious pattern (a double-nested Platform.runLater in AllFieldsTab#showFieldEditor) is a deliberate fix for a real layout-timing bug (see commit adecf23, 'Fix runLater guards') introduced by this same PR's scroll-into-view feature, so it was intentionally left unchanged. No dependency/build version used by the PR's own changed files needed an upgrade.

Verification

  • xvfb-run -a ./gradlew :jabgui:test --tests "org.jabref.gui.entryeditor.JumpToFieldViewModelTest" --tests "org.jabref.gui.fieldeditors.FieldEditorFXFocusTest" --tests "org.jabref.gui.fieldeditors.FieldEditorFXTest" — 8/8 passed, run identically before and after the (empty) production-edit pass.
  • ./gradlew :jabgui:compileJava :jabgui:compileTestJava :jabgui:checkstyleMain :jabgui:checkstyleTest — clean.
  • xvfb-run -a ./gradlew :jabgui:test --tests "org.jabref.gui.JabGuiArchitectureTest" — passed.
  • A full unscoped :jabgui:test run shows 11 pre-existing failures unrelated to this PR (live-network download tests such as LinkedFileViewModelTest/DownloadLinkedFileActionTest/BookCoverFetcherTest, and a platform-specific keybinding-label expectation in KeyBindingViewModelTest); confirmed these failures are present on the unmodified PR-head checkout too (e.g. KeyBindingViewModelTest fails identically with our new files removed), so they are pre-existing environment/network issues, not regressions from this companion.

AI usage

JAIPilot (automated review/companion-drafting agent). Test-only companion; no production behavior was changed.

Limitations

  • AllFieldsTab's section-auto-expand-on-focus and the JabRefFrame/EntryEditor JUMP_TO_FIELD routing change were not independently unit-tested: exercising them faithfully requires constructing the full entry-editor tab graph (GuiPreferences, StateManager, JournalAbbreviationRepository, PreviewPanel, etc.), which is disproportionate to this bounded companion and was left to the existing manual/integration test coverage.
  • No production edits were retained; this is solely an additive, behavior-preserving test companion.

Generated by JAIPilot Cloud for #1 from Anthropic session sesn_01Cq7UzDtiytnKR8EjYKpxQs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants