55 Commits

Author SHA1 Message Date
TomJGooding
7a9d32fdbf test: make tests async to fix failures on Python 3.9
After upgrading `pytest-asyncio` to the latest version, lots of tests
started failing in CI only on Python 3.9:

`RuntimeError: There is no current event loop in thread 'MainThread'`

Apparently these tests may have only been passing previously due to
issues in earlier versions of `pytest-asyncio`. Changing these tests to
async seems to fix the failures on Python 3.9.

Related issue:
https://github.com/pytest-dev/pytest-asyncio/issues/1039
2025-09-17 13:38:05 +01:00
Sergi Pons Freixes
f59af27b0a Add tests for first-child and last-child pseudo-classes 2025-04-28 20:44:39 -07:00
Will McGugan
8a6cdf64ec Merge branch 'main' into app-query-change 2025-03-27 13:46:49 +00:00
Will McGugan
4d15999e7f docstring 2025-03-12 17:07:10 +07:00
Will McGugan
fea8775220 fix clicking on border in line api 2025-03-12 17:05:27 +07:00
Will McGugan
29f7adc5a1 change to app query model 2025-02-19 21:13:18 +00:00
Will McGugan
57525e4227 content 2025-01-19 17:13:20 +00:00
Will McGugan
568152a3dd comments 2025-01-03 17:16:37 +00:00
Will McGugan
d82c0270e1 consistency 2024-11-20 19:02:27 +00:00
Will McGugan
406766b6b5 don't add new parameter 2024-11-20 18:44:07 +00:00
Will McGugan
33c0afe61d disable loading widgets 2024-11-20 18:16:44 +00:00
Will McGugan
254e6e0bd2 test fixes 2024-11-12 13:00:02 +00:00
Will McGugan
bd091972ee new mechanism to expose pseudo classes 2024-10-18 15:05:09 +01:00
Will McGugan
bf16ded909 pycln comment 2024-10-02 17:39:26 +01:00
Will McGugan
91747dea56 tests 2024-10-02 17:37:23 +01:00
Will McGugan
87e1142242 raise AttributeError 2024-10-02 17:31:43 +01:00
Will McGugan
7b825bb456 test fixes 2024-10-02 14:42:55 +01:00
Will McGugan
9dce34c2d7 fix test 2024-09-24 12:05:36 +01:00
Will McGugan
69e259fb16 add tests 2024-09-24 11:50:36 +01:00
Will McGugan
03ad3af83f remove old hack 2024-09-07 17:52:25 +01:00
Will McGugan
e22d703d1d rename 2024-07-29 14:09:34 +01:00
Rodrigo Girão Serrão
2a7e762058 Use __init_subclass__ instead of metaclass.
Relevant review comment: https://github.com/Textualize/textual/pull/4252#discussion_r1511505517
2024-03-05 10:44:32 +00:00
Will McGugan
698f9273c2 sort 2024-03-01 17:27:22 +00:00
Will McGugan
082b0930ce snapshot test 2024-03-01 16:52:12 +00:00
Will McGugan
b8fccd494a lazy mount (#3936)
* lazy mount

* Lazy test

* doc

* Add to docs

* snapshot and changelog

* typing

* future

* less flaky

* comment
2024-01-01 15:54:55 +00:00
Will McGugan
6a894461ba Fix render str (#3920)
* Fix text render

* changelog
2023-12-22 15:40:39 +00:00
Will McGugan
82d6e3e05f Roll back ALLOW_CHILDREN and max height fix (#3814)
* max height

* changelog

* snapshot

* unused exception
2023-12-07 18:40:48 +00:00
Will McGugan
a3e91d43a4 mount error (#3780)
* mount error

* changelog
2023-11-29 15:38:10 +00:00
Will McGugan
4058e598e8 error if no children allowed (#3758)
* error if no children allowed

* changelog

* changelog

* remove comment

* quote RHS

* annotations

* attempt to fix 3.7

* restore experiment
2023-11-27 17:09:50 +00:00
TomJGooding
ca68b868a6 feat(widget): add is_mounted property (#3709)
* feat(widget): add is_mounted property

Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>

* fix property docstring

* add simple test

* update changelog

---------

Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
2023-11-20 20:42:08 +00:00
Will McGugan
47af5e0402 Add loading reactive (#3509)
* Add loading reactive

* loading indicator example

* Apply suggestions from code review

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

* into

* changelog

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-10-11 16:53:49 +01:00
Rodrigo Girão Serrão
b5fa18f27a Delete WIP comment 2023-06-12 10:26:13 +01:00
Rodrigo Girão Serrão
22577b4ce7 A couple more widget tests. 2023-06-09 15:17:12 +01:00
Will McGugan
0849e6f410 mount order (#2702)
* mount order

* fix test

* simplify hooks

* changelog

* docstring
2023-05-31 15:16:26 +01:00
darrenburns
17c6f3fc2a Fix for interaction between pseudoclasses and widget-level render caches (#2155)
* Using pseudoclass state in DataTable cache keys

* Use full pseudo-class state on tree cache key

* Adding tests for Widget.get_pseudo_class_state

* Test hiding hover cursor when mouse cursor leaves DataTable

* Update CHANGELOG.md
2023-03-28 14:26:24 +01:00
Will McGugan
f5e779c4c4 tabbed content widget (#2059)
* tabbed content widget

* TabbedContent widget and docs

* missing docs

* fix active

* doc fix

* test fix

* additional test

* test for render_str

* docstring

* changelog

* doc update

* changelog

* fix bad optimization

* Update docs/widgets/tabbed_content.md

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

* fix for empty initial

* docstrings

* Update src/textual/widgets/_content_switcher.py

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

* docstring

* remove log

* permit nested tabs

* renamed TabsCleared to Cleared

* added tests, fix types on click

* tests

* fix broken test

* fix for nested tabs

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-18 10:38:41 +00:00
Will McGugan
de692aaf07 fix for remove nodes (#2080)
* fix for remove nodes

* added test
2023-03-16 11:36:10 +00:00
Will McGugan
b0f5c35782 tabs widget (#2020)
* tabs widget

* click underline

* color tweak

* docs

* docs update

* expose Tab

* added remove_tab and clear

* fix cycling

* add animation

* docs

* changelog

* remove recompose

* docstrings

* Update docs/guide/actions.md

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

* Rodrigoed the tabs

* Update docs/widgets/tabs.md

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

* Update docs/widgets/tabs.md

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

* copy

* docstrings

* docstring

* docstring

* Apply suggestions from code review

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

* stop click

* docstring

* auto assign consistent IDs

* Apply suggestions from code review

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

* Document bindings

* document bindings

* Apply suggestions from code review

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

* Apply suggestions from code review

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

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-13 14:39:15 +00:00
Darren Burns
9287f64a66 Add isort pre-commit hook, sort imports in src and test directories 2023-02-09 13:28:08 +00:00
Will McGugan
aba2633f44 Update tests/test_widget.py
Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>
2023-01-25 12:00:51 +01:00
Will McGugan
3673b0ff48 keep reference to remove task 2023-01-24 16:01:37 +01:00
Will McGugan
d9dd1dcbe8 simplify 2023-01-24 15:53:53 +01:00
Will McGugan
f97392ac8b added test 2023-01-24 15:24:55 +01:00
darrenburns
df37a9b90a Add get_child_by_id and get_widget_by_id (#1146)
* Add get_child_by_id and get_widget_by_id

* Remove redundant code

* Add unit tests for app-level get_child_by_id and get_widget_by_id

* Remove redundant test fixture injection

* Update CHANGELOG

* Enforce uniqueness of ID amongst widget children

* Enforce unique widget IDs amongst widgets mounted together

* Update CHANGELOG.md

* Ensuring unique IDs in a more logical place

* Add docstring to NodeList._get_by_id

* Dont use duplicate IDs in tests, dont mount 2000 widgets

* Mounting less widgets in a unit test

* Reword error message

* Use lower-level depth first search in get_widget_by_id to break out early
2022-11-16 15:29:59 +00:00
Darren Burns
1b0c94e8a0 Remove draw.py, fix imports 2022-10-13 11:15:15 +01:00
Will McGugan
fdc549a66c fix test 2022-10-04 10:15:09 +01:00
Will McGugan
8589b90d92 test fix 2022-10-03 17:17:47 +01:00
Will McGugan
216d05b17f test fix 2022-09-20 16:33:07 +01:00
Will McGugan
6bfc26c1ec more docs 2022-05-25 15:36:58 +01:00
Darren Burns
43f65d73ae Pass Rich Style object into Textual render method 2022-05-06 10:20:05 +01:00