Repository navigation
Stop the window wiring tests needing the keyboard focus - #622
Merged
Merged
Conversation
Which list -selectedRef answers for is read off the first responder, so the tests took the focus to say which one they meant. A test cannot hold the keyboard: anything that takes it hands the window back its own first responder, and the test then asks about a list nothing is focused on. * Let the window controller be asked which ref a given responder names, and keep reading the first responder for the answer it gives itself * Hand the list over in the tests rather than focusing it, so what they describe no longer depends on what else is on screen
goneng
force-pushed
the
fix-wiring-tests-depending-on-focus
branch
from
September 13, 2026 07:33
e6863a1 to
ac3f726
Compare
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




-selectedRefreads the first responder to decide whether the sidebar orthe history list is being asked, so
PBGitWindowWiringTeststook thekeyboard focus to say which one it meant. A test cannot hold the keyboard:
anything that takes it hands the window back its own first responder, and
the test is then asking about a list that nothing is focused on.
The window controller can now be asked what a given responder names, and
answers
-selectedRefby handing it the first responder as before. Thetests hand the list over directly, so no test in the suite touches focus.
What this does not claim
These tests have failed for me in ways I could not reproduce on demand. I
tried twice against the unfixed code and both passed:
So this removes a dependency the tests should not have had, and nothing
more. If they fail again, the cause is elsewhere and still open.
One thing found on the way, worth knowing before writing tests here:
-[PBGitHistoryController selectedCommits]is derived from its arraycontroller and is put back by the controller's own machinery, so setting
it directly does not stick. The tests keep driving the array controller.
Test plan
make unit-test: 71 tests, 0 failuresmakeFirstResponder:left anywhere in the suiteGitX instance running: passes in both