Commit Graph

531 Commits

Author SHA1 Message Date
Rodrigo Girão Serrão
a87c9ca916 Add tests for placeholder widget. 2022-11-18 15:14:56 +00:00
Will McGugan
0a45ff374f update to greater than or equals 2022-11-12 12:24:36 +00:00
Will McGugan
e9489f194f tweak to anim test 2022-11-12 12:22:31 +00:00
Will McGugan
46d12fcfe0 win fix 2022-11-12 12:17:01 +00:00
Will McGugan
2605785288 use per_counter 2022-11-12 12:12:23 +00:00
Will McGugan
949745a08a add sleep to test 2022-11-12 12:05:59 +00:00
Will McGugan
b752ab5a04 more tests 2022-11-12 12:00:49 +00:00
Will McGugan
a0ab6c99f1 test for animation 2022-11-12 11:47:14 +00:00
Dave Pearson
4418cbab78 Merge branch 'main' into awaitable-remove 2022-11-10 20:43:25 +00:00
Dave Pearson
32e6f71856 Be 100% sure all removals take place 2022-11-10 20:41:11 +00:00
Dave Pearson
d3e7f5ad99 Add a unit test for removal ordering via DOMQuery.remove 2022-11-10 20:36:57 +00:00
Dave Pearson
9748850657 Add a unit test for removal ordering via Widget.remove 2022-11-10 20:34:51 +00:00
Dave Pearson
4dbb1f8e20 AwaitRemove work-in-progress
Initial work on #1094 -- this implements the core idea; lots of tidying up
to do but saving for the end of the week.
2022-11-10 16:54:44 +00:00
Will McGugan
1b61a95c70 table tests 2022-11-10 16:22:52 +00:00
Will McGugan
97eab5fd6e Merge branch 'main' into call-later 2022-11-10 15:24:31 +00:00
Dave Pearson
d73d4e898f Add unit tests for App._on_remove
These tests are designed to give 100% coverage to the App._on_remove method,
which is the heart of the widget removal system. This is done in
anticipation to some reworking as part of #1094.

Note that, for the moment, there's a bit of a hack in here. These tests need
the pilot. The pilot would need that we await changes to the DOM. Removing
things from the DOM changes the DOM. Remove can't be awaited (see above
change that's coming). So... until such a time as we can await a remove, we
go with a simple await of asyncio.sleep to get things started.

Once #1094 has been done these tests should all still work fine *and* we
should be able to await the removes rather than use the sleeps.
2022-11-10 13:13:15 +00:00
Will McGugan
39a764f49f call later 2022-11-09 17:23:28 +00:00
Dave Pearson
57a2b77e26 Merge branch 'main' into remove-refresh 2022-11-09 16:23:01 +00:00
Dave Pearson
5d6daf2a00 Extend the on_unmount unit tests
Because some changes are going to be made to the way that removal of widgets
happens, and because this will affect the linkage between parents and
children, and because we don't want the current way of working to change...
extend to the tests to be sure that when an unmount happens a widget has no
children any more, but still knows about its parent.
2022-11-09 14:59:13 +00:00
Will McGugan
dd5c0e612a make watchers instant 2022-11-09 12:06:14 +00:00
Dave Pearson
4e8c10b7f4 Merge pull request #1138 from davep/no-self-own
Raise an error if a widget tries to be its own parent
2022-11-08 14:03:25 +00:00
Dave Pearson
0324fb90d1 Hoist WidgetError and MountError to the top level of widget.py 2022-11-08 13:53:22 +00:00
Dave Pearson
73cc6021ee Add the final TooManyMatches mounting unit test
This was waiting for the update to query_one that would raise an exception
if the result had more than one match. That's in Textual now so we can
finally add this test.
2022-11-08 13:21:56 +00:00
Dave Pearson
fbbd8a2678 Raise an error if a widget tries to be its own parent
See #1062
2022-11-08 12:07:06 +00:00
darrenburns
65008082ca Support focusable containers (#1130)
* Fix containers not being focusable

* Fix tests to allow for focusable containers

* Add test for non-focusable container with focusable children

* Fix a typo in a test
2022-11-07 16:36:53 +00:00
Will McGugan
8cfff549f7 Merge pull request #1095 from davep/mount-relative
Add support for mounting widgets relative to other widgets
2022-11-03 16:20:30 +00:00
Dave Pearson
b0d2caf221 Add unit tests for mounting relative to -2
To satisfy https://github.com/Textualize/textual/pull/1095#discussion_r1013041338
2022-11-03 15:49:15 +00:00
Dave Pearson
82674ad181 Merge branch 'Textualize:main' into mount-relative 2022-11-03 15:23:09 +00:00
Dave Pearson
c1cfdffc96 Change query_one so that it raises an error on multiple hits
As part of this, add a only_one method to DOMQuery.

Addresses #1096.
2022-11-03 13:44:51 +00:00
Dave Pearson
abad0a311a Make NodeList._index "public"
See https://github.com/Textualize/textual/pull/1095#discussion_r1011988160
2022-11-02 16:10:34 +00:00
Dave Pearson
f29015f70a Add a reminder to the mount tests about query_one
See https://github.com/Textualize/textual/issues/1096
2022-11-02 15:57:09 +00:00
Dave Pearson
b925fb6b19 Start unit tests for mounting 2022-11-02 15:18:49 +00:00
Dave Pearson
2df0144902 Remove the old _find_dom_spot tests
This set of tests got left over from the great renaming.
2022-11-02 11:39:58 +00:00
Dave Pearson
627486a42a Lots of reworking of the mount-before/after work
Lots of things going on here, mainly narrowing in on the final form.
2022-11-02 11:35:22 +00:00
Dave Pearson
016f7be83a Add an insert method to the NodeList 2022-11-01 22:26:38 +00:00
Dave Pearson
e35d146445 Tidy up and extend the DOM spot tests 2022-11-01 21:33:25 +00:00
darrenburns
5e64a9fb90 Introduce _typing module for version-dependent typing imports (#1088)
* Introduce _typing module for version-dependent typing imports

* Remove unused import
2022-11-01 17:13:42 +00:00
darrenburns
bbd811d671 Support multiple CSS files (#1079)
* Support multiple CSS paths

* Update a type to match docstring

* Ensure the demo app still works

* Use absolute paths in tests to (hopefully) appease Windows

* Notes about CSS changes in guide/docstrings, small grammar/typos fixes

* Move snapshot apps into snapshot_tests dir, improve messaging in snapshot output, add test for multiple css files interacting with classvar CSS

* Ensure consistent snapshot naming cross-platform

* Use rpartition instead of partition in import_app

* Fix handling of import_app when colon in arg

* Support paths containing Windows drive names in import_app

* Add note on new relative paths in snap_compare

* Update docs/guide/CSS.md

Co-authored-by: Will McGugan <willmcgugan@gmail.com>

* Fix formatting

* Update CHANGELOG to mention CSS_PATH supporting a list

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2022-11-01 17:13:25 +00:00
Dave Pearson
39b23e1f51 WIP: Starting work on adding before/after mount directions
This is still a work-in-progress, but this feels like a good point to commit
for safe keeping. This is a non-working WIP.
2022-11-01 17:01:56 +00:00
Dave Pearson
cee69fbc32 Add an _index method to NodeList
This maps on to a normal List.index.
2022-11-01 10:55:15 +00:00
Dave Pearson
294166cfec Add unit tests for the NodeList class 2022-11-01 09:58:32 +00:00
Dave Pearson
457340777b Change DOM queries to be case-sensitive for classes and IDs
See #1041 and #1047.
2022-10-31 15:25:22 +00:00
Will McGugan
67fcbde8cd Merge branch 'main' into footer-fix 2022-10-31 14:46:59 +00:00
Will McGugan
d37c5ed3da test fix for windows 2022-10-31 13:53:45 +00:00
Will McGugan
41e2b71dcc update changelog 2022-10-31 13:46:28 +00:00
Will McGugan
586ff470c5 Merge branch 'main' into fix-texlog-maxlines 2022-10-31 13:38:55 +00:00
Will McGugan
0d99b0ccd1 Merge pull request #1067 from Textualize/fr-unit
Fr unit
2022-10-31 13:37:00 +00:00
Will McGugan
881a9c2752 Merge pull request #1061 from Textualize/horizontal-fix
allow waiting of screen operations
2022-10-31 13:36:46 +00:00
Will McGugan
07dced3435 Update tests/test_unmount.py
Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>
2022-10-31 13:31:10 +00:00
Will McGugan
5cb5dd8599 Merge branch 'main' into unmount 2022-10-31 13:30:58 +00:00