mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Invalid pseudo selectors (#2445)
* token error * error on bad pseudo selectors
This commit is contained in:
@@ -140,52 +140,52 @@ A1
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
A:foo {}
|
||||
A:foo:bar {}
|
||||
A:focus {}
|
||||
A:focus:hover {}
|
||||
A
|
||||
:foo {}
|
||||
:focus {}
|
||||
A
|
||||
:foo:bar {}
|
||||
:focus:hover {}
|
||||
A
|
||||
:foo
|
||||
:bar {}
|
||||
A:foo-bar {}
|
||||
:focus
|
||||
:hover {}
|
||||
A:enabled {}
|
||||
A
|
||||
:foo-bar {}
|
||||
:enabled {}
|
||||
|
||||
A :foo {}
|
||||
A :foo :bar {}
|
||||
A :foo-bar {}
|
||||
A :focus {}
|
||||
A :focus :hover {}
|
||||
A :enabled {}
|
||||
|
||||
.A:foo {}
|
||||
.A:foo:bar {}
|
||||
.A:focus {}
|
||||
.A:focus:hover {}
|
||||
.A
|
||||
:foo {}
|
||||
:focus {}
|
||||
.A
|
||||
:foo:bar {}
|
||||
:focus:hover {}
|
||||
.A
|
||||
:foo
|
||||
:bar {}
|
||||
.A:foo-bar {}
|
||||
:focus
|
||||
:hover {}
|
||||
.A:enabled {}
|
||||
.A
|
||||
:foo-bar {}
|
||||
:enabled {}
|
||||
|
||||
#A:foo {}
|
||||
#A:foo:bar {}
|
||||
#A:focus {}
|
||||
#A:focus:hover {}
|
||||
#A
|
||||
:foo {}
|
||||
:focus {}
|
||||
#A
|
||||
:foo:bar {}
|
||||
:focus:hover {}
|
||||
#A
|
||||
:foo
|
||||
:bar {}
|
||||
#A:foo-bar {}
|
||||
:focus
|
||||
:hover {}
|
||||
#A:enabled {}
|
||||
#A
|
||||
:foo-bar {}
|
||||
:enabled {}
|
||||
|
||||
A1.A1.A1:foo {}
|
||||
A1.A1#A1:foo {}
|
||||
A1:foo.A1:foo#A1:foo {}
|
||||
A1.A1.A1:focus {}
|
||||
A1.A1#A1:focus {}
|
||||
A1:focus.A1:focus#A1:focus {}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
@@ -1226,3 +1226,21 @@ class TestTypeNames:
|
||||
stylesheet.add_source(f"StartType {separator} 1TestType {{}}")
|
||||
with pytest.raises(TokenError):
|
||||
stylesheet.parse()
|
||||
|
||||
|
||||
def test_parse_bad_psuedo_selector():
|
||||
"""Check unknown selector raises a token error."""
|
||||
|
||||
bad_selector = """\
|
||||
Widget:foo{
|
||||
border: red;
|
||||
}
|
||||
"""
|
||||
|
||||
stylesheet = Stylesheet()
|
||||
stylesheet.add_source(bad_selector, "foo")
|
||||
|
||||
with pytest.raises(TokenError) as error:
|
||||
stylesheet.parse()
|
||||
|
||||
assert error.value.start == (0, 6)
|
||||
|
||||
Reference in New Issue
Block a user