mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #1278 from davep/bug/1253/type-selector
Allow numbers in type selectors
This commit is contained in:
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- Rebuilt `DirectoryTree` with new `Tree` control.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Type selectors can now contain numbers https://github.com/Textualize/textual/issues/1253
|
||||
|
||||
## [0.5.0] - 2022-11-20
|
||||
|
||||
### Added
|
||||
|
||||
@@ -49,7 +49,7 @@ expect_root_scope = Expect(
|
||||
selector_start_id=r"\#" + IDENTIFIER,
|
||||
selector_start_class=r"\." + IDENTIFIER,
|
||||
selector_start_universal=r"\*",
|
||||
selector_start=r"[a-zA-Z_\-]+",
|
||||
selector_start=IDENTIFIER,
|
||||
variable_name=rf"{VARIABLE_REF}:",
|
||||
).expect_eof(True)
|
||||
|
||||
|
||||
@@ -8,12 +8,15 @@ def test_query():
|
||||
class View(Widget):
|
||||
pass
|
||||
|
||||
class View2(View):
|
||||
pass
|
||||
|
||||
class App(Widget):
|
||||
pass
|
||||
|
||||
app = App()
|
||||
main_view = View(id="main")
|
||||
help_view = View(id="help")
|
||||
help_view = View2(id="help")
|
||||
app._add_child(main_view)
|
||||
app._add_child(help_view)
|
||||
|
||||
@@ -53,6 +56,7 @@ def test_query():
|
||||
assert list(app.query("App")) == [app]
|
||||
assert list(app.query("#main")) == [main_view]
|
||||
assert list(app.query("View#main")) == [main_view]
|
||||
assert list(app.query("View2#help")) == [help_view]
|
||||
assert list(app.query("#widget1")) == [widget1]
|
||||
assert list(app.query("#Widget1")) == [] # Note case.
|
||||
assert list(app.query("#widget2")) == [widget2]
|
||||
|
||||
Reference in New Issue
Block a user