40 Commits

Author SHA1 Message Date
Will McGugan
985fcb1180 fix tests and snapshots 2024-12-08 15:46:56 +00:00
Will McGugan
6995834c3c added system commands 2024-08-22 11:46:56 +01:00
Will McGugan
d2ccc36d89 snapshot update 2024-08-16 15:49:40 +01:00
Will McGugan
54cec67bd8 titles 2024-07-17 17:16:40 +01:00
Darren Burns
7b0251ee04 Command palette events (#4600)
* Add some events for the command palette

* Sending open, close, and highlighted events from CommandPalette -> App

* Docstrings

* Changelog

* Use Union for old python support

* Docstrings
2024-06-05 11:47:59 +01:00
Dave Pearson
9a8ab7d374 Add a unit test for provider discovery 2024-02-13 14:52:26 +00:00
Will McGugan
bc93b21bc6 Lazy command provider (#3756)
* Lazy command privoder

* changelog

* fix tests

* test fix
2023-11-27 14:15:58 +00:00
Dave Pearson
01cfdf8848 Add some wiggle room to the no-matches command palette timeout test
See #3700.
2023-11-20 12:28:17 +00:00
Dave Pearson
dc19558ef8 Remove anything to do with CommandPalette.current_screen
It was for the older approach to command palette isolation; it's not really
needed any more.
2023-11-08 11:47:26 +00:00
Dave Pearson
51dc134a13 Isolate the command palette from app-based queries
This fixes #3633 by ensuring that if a query is made against the app while
the command palette is active, the query trickles down to the
previously-active screen rather than into the command palette modal screen.

This also updates the command palette unit tests to take this change into
account.
2023-11-06 13:57:44 +00:00
Dave Pearson
7cbba6636f Add a test for the command palette not leaving workers behind 2023-10-31 08:54:25 +00:00
Dave Pearson
b939256007 Add a test that the command palette doesn't kill other workers
See #3615.
2023-10-31 08:47:33 +00:00
Guy Avital
0289a208d2 test_no_results() wait for message to show
The "no matches found" message in the command palette show after a specific delay, so make the test wait the same delay
2023-09-27 22:51:41 +03:00
Will McGugan
ea6bf766e7 Cp shutdown (#3303)
* change hotkey

* binding

* rename Source to Provider

* name change

* name changes

* words

* docstring

* system commands

* add icon click

* replace dim with muted

* log shutdown errors

* Update src/textual/screen.py

Co-authored-by: Dave Pearson <davep@davep.org>

* fix tests

* Wee bit more source->provider rewording

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-09-14 15:21:51 +01:00
Will McGugan
5d6a95dec5 Command Palette tweaks and docs (#3289)
* renames to command palette and docs

* docs

* simplifyt

* note

* docstring

* Update src/textual/command.py

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>

* Update docs/examples/guide/command_palette/command01.py

Co-authored-by: Dave Pearson <davep@davep.org>

* populate text

* screen commands

* Update docs/guide/command_palette.md

Co-authored-by: Dave Pearson <davep@davep.org>

* Update docs/guide/command_palette.md

Co-authored-by: Dave Pearson <davep@davep.org>

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Dave Pearson <davep@davep.org>
2023-09-13 15:03:25 +01:00
Dave Pearson
62bad31616 Actually use the command source in the test, in the test, redux 2023-08-29 11:37:23 +01:00
Dave Pearson
97790b461f Actually use the command source in the test, in the test 2023-08-29 11:35:10 +01:00
Dave Pearson
c511b5af0e Spell out gndn 2023-08-29 09:08:50 +01:00
Dave Pearson
e6b9a264a1 Rename search_for to search
As per this request:

  https://github.com/Textualize/textual/pull/3058#discussion_r1307135816
2023-08-28 11:05:39 +01:00
Dave Pearson
af4423166b Rename hunt_for to search_for
Sounds a lot less dramatic but... okay, fair enough.
2023-08-21 19:37:24 +01:00
Dave Pearson
89980cc079 Ensure that the run-on-select tests restore the old state 2023-08-21 11:20:45 +01:00
Dave Pearson
f3442798d1 Wait for the command sources to complete after input, before moving on
Just in the problematic tests. As an experiment for the moment. I've still
not quite got to the bottom of the core problem, as I've been seeing, but
there is an issue with testing the command palette: how to ensure that
there's actually matched commands before going on to test interaction, when
the sourcing of command matches is concurrent with anything else.

Here I reach in into the workers of the command palette and wait for them to
finish and *then* I go on to use the result.

Having been able to recreate the surface error locally, on a nice fast M2Pro
Mac, with a significant async sleep in the source, this fixed the error in
that situation. So let's see if that makes a dent in CI...
2023-08-16 21:24:44 +01:00
Dave Pearson
356165b989 Ensure all test commands make it through 2023-08-16 20:48:58 +01:00
Dave Pearson
091ef4e868 Remove experimental change to tests 2023-08-16 15:13:45 +01:00
Dave Pearson
c778ef7fea Test if we can guard against pytest not doing a full teardown 2023-08-16 14:43:09 +01:00
Dave Pearson
6c86621fb6 Add some unit tests for bits of command palette UI interaction 2023-08-16 14:22:40 +01:00
Dave Pearson
f9d102894d Update the tests to take into account the new default source 2023-08-16 09:42:04 +01:00
Dave Pearson
878351564f Simplify the no-results unit test for the command palette 2023-08-15 15:41:51 +01:00
Dave Pearson
d46955b5e5 Add a test for getting no results 2023-08-15 15:24:21 +01:00
Dave Pearson
93b9372ac4 Add unit testing for the use of the escape key 2023-08-15 12:55:10 +01:00
Dave Pearson
5c4f7b3c3b Remove an unused import 2023-08-15 12:45:04 +01:00
Dave Pearson
39f41b2b40 Add a test for dismissing the command palette via a click "outside" 2023-08-15 11:44:36 +01:00
Dave Pearson
e914049c63 Simply check the Input is not empty 2023-08-15 11:27:36 +01:00
Dave Pearson
f27b68007b Swap the tests to simply test we got something
It's looking like it's going to be almost impossible to test the exact
command chosen, every time, in CI, with all the timing issues. So let's make
life easier, for now anyway, and simply check that *something* was selected.
2023-08-15 11:05:32 +01:00
Dave Pearson
71643d7342 Add pauses between each keypress in the palette selection tests
These tests all work fine locally, but I'm getting the usual unpredictable
async results in CI. Let's see if pausing after each press helps.
2023-08-15 10:52:19 +01:00
Dave Pearson
e7ee82cef8 Add tests for auto-run on and off in the command palette 2023-08-15 10:43:43 +01:00
Dave Pearson
d7b8f5ad32 Add a test for command sources with no available app or screen 2023-08-15 09:40:32 +01:00
Dave Pearson
03ebd864c6 Add a test that app and screen command sources combine 2023-08-14 19:54:58 +01:00
Dave Pearson
3b41d4f8e5 Add unit tests for the command source environment information 2023-08-14 15:49:12 +01:00
Dave Pearson
7451e9988a Add unit tests for declaring command palette command sources 2023-08-14 14:19:22 +01:00