mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #2057 from davep/stylezilla
Add some initial rules to a "mega stylesheet"
This commit is contained in:
227
tests/css/test_mega_stylesheet.css
Normal file
227
tests/css/test_mega_stylesheet.css
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* The idea with this stylesheet is that it should contain as many valid
|
||||||
|
* ways of styling things as possible. So, as time goes on, feel free to add
|
||||||
|
* something to here. Be creative. Do the wildest things you can think of.
|
||||||
|
*/
|
||||||
|
|
||||||
|
* {}
|
||||||
|
* * {}
|
||||||
|
* * * {}
|
||||||
|
* > * {}
|
||||||
|
* > * > * {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
A {}
|
||||||
|
A A {}
|
||||||
|
A A A {}
|
||||||
|
A > A {}
|
||||||
|
A > A > A {}
|
||||||
|
|
||||||
|
A1 {}
|
||||||
|
A1 A1 {}
|
||||||
|
A1 A1 A1 {}
|
||||||
|
A1 > A1 {}
|
||||||
|
A1 > A1 > A1 {}
|
||||||
|
|
||||||
|
A {}
|
||||||
|
A A1 {}
|
||||||
|
A A1 A1 {}
|
||||||
|
A > A1 {}
|
||||||
|
A > A1 > A1 {}
|
||||||
|
|
||||||
|
A1 {}
|
||||||
|
A1 A {}
|
||||||
|
A1 A A {}
|
||||||
|
A1 > A {}
|
||||||
|
A1 > A > A {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
A {}
|
||||||
|
A, A {}
|
||||||
|
A,A {}
|
||||||
|
A, A, A {}
|
||||||
|
A,A,A {}
|
||||||
|
A , A , A {}
|
||||||
|
A
|
||||||
|
,
|
||||||
|
A
|
||||||
|
,
|
||||||
|
A
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
A1 {}
|
||||||
|
A1, A1 {}
|
||||||
|
A1,A1 {}
|
||||||
|
A1, A1, A1 {}
|
||||||
|
A1,A1,A1 {}
|
||||||
|
A1 , A1 , A1 {}
|
||||||
|
A1
|
||||||
|
,
|
||||||
|
A1
|
||||||
|
,
|
||||||
|
A1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
.A {}
|
||||||
|
.A .A {}
|
||||||
|
.A .A .A {}
|
||||||
|
.A > .A {}
|
||||||
|
.A > .A > .A {}
|
||||||
|
|
||||||
|
.A1 {}
|
||||||
|
.A1 .A1 {}
|
||||||
|
.A1 .A1 .A1 {}
|
||||||
|
.A1 > .A1 {}
|
||||||
|
.A1 > .A1 > .A1 {}
|
||||||
|
|
||||||
|
.A1 {}
|
||||||
|
.A1 .A {}
|
||||||
|
.A1 .A .A {}
|
||||||
|
.A1 > .A {}
|
||||||
|
.A1 > .A > .A {}
|
||||||
|
|
||||||
|
.A {}
|
||||||
|
.A .A1 {}
|
||||||
|
.A .A1 .A1 {}
|
||||||
|
.A > .A1 {}
|
||||||
|
.A > .A1 > .A1 {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
.A {}
|
||||||
|
.A.A {}
|
||||||
|
.A.A.A {}
|
||||||
|
|
||||||
|
.A1 {}
|
||||||
|
.A1.A1 {}
|
||||||
|
.A1.A1.A1 {}
|
||||||
|
|
||||||
|
.A1 {}
|
||||||
|
.A1.A {}
|
||||||
|
.A1.A.A {}
|
||||||
|
|
||||||
|
.A {}
|
||||||
|
.A.A1 {}
|
||||||
|
.A.A1.A1 {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
#A {}
|
||||||
|
#A #A {}
|
||||||
|
#A #A #A {}
|
||||||
|
#A > #A {}
|
||||||
|
#A > #A > #A {}
|
||||||
|
|
||||||
|
#A1 {}
|
||||||
|
#A1 #A1 {}
|
||||||
|
#A1 #A1 #A1 {}
|
||||||
|
#A1 > #A1 {}
|
||||||
|
#A1 > #A1 > #A1 {}
|
||||||
|
|
||||||
|
#A1 {}
|
||||||
|
#A1 #A {}
|
||||||
|
#A1 #A #A {}
|
||||||
|
#A1 > #A {}
|
||||||
|
#A1 > #A > #A {}
|
||||||
|
|
||||||
|
#A {}
|
||||||
|
#A #A1 {}
|
||||||
|
#A #A1 #A1 {}
|
||||||
|
#A > #A1 {}
|
||||||
|
#A > #A1 > #A1 {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
A:foo {}
|
||||||
|
A:foo:bar {}
|
||||||
|
A
|
||||||
|
:foo {}
|
||||||
|
A
|
||||||
|
:foo:bar {}
|
||||||
|
A
|
||||||
|
:foo
|
||||||
|
:bar {}
|
||||||
|
A:foo-bar {}
|
||||||
|
A
|
||||||
|
:foo-bar {}
|
||||||
|
|
||||||
|
A :foo {}
|
||||||
|
A :foo :bar {}
|
||||||
|
A :foo-bar {}
|
||||||
|
|
||||||
|
.A:foo {}
|
||||||
|
.A:foo:bar {}
|
||||||
|
.A
|
||||||
|
:foo {}
|
||||||
|
.A
|
||||||
|
:foo:bar {}
|
||||||
|
.A
|
||||||
|
:foo
|
||||||
|
:bar {}
|
||||||
|
.A:foo-bar {}
|
||||||
|
.A
|
||||||
|
:foo-bar {}
|
||||||
|
|
||||||
|
#A:foo {}
|
||||||
|
#A:foo:bar {}
|
||||||
|
#A
|
||||||
|
:foo {}
|
||||||
|
#A
|
||||||
|
:foo:bar {}
|
||||||
|
#A
|
||||||
|
:foo
|
||||||
|
:bar {}
|
||||||
|
#A:foo-bar {}
|
||||||
|
#A
|
||||||
|
:foo-bar {}
|
||||||
|
|
||||||
|
A1.A1.A1:foo {}
|
||||||
|
A1.A1#A1:foo {}
|
||||||
|
A1:foo.A1:foo#A1:foo {}
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
$foo:;
|
||||||
|
$foo:1;
|
||||||
|
$fo1:1;
|
||||||
|
$1:1;
|
||||||
|
$-:1;
|
||||||
|
$--:1;
|
||||||
|
$--------------------------------------------------:1;
|
||||||
|
$-1:1;
|
||||||
|
$--1:1;
|
||||||
|
$--------------------------------------------------1:1;
|
||||||
|
$_1:1;
|
||||||
|
$__1:1;
|
||||||
|
$__________________________________________________1:1;
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
A{}
|
||||||
|
A {
|
||||||
|
}
|
||||||
|
A {} A {} A {}
|
||||||
|
A{}A{}A{}
|
||||||
|
A {
|
||||||
|
} A {} A {
|
||||||
|
}
|
||||||
|
A
|
||||||
|
{}
|
||||||
|
A
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Don't change or remove this. This class is looked for in the unit
|
||||||
|
* test code to make sure that everything parsed.
|
||||||
|
*/
|
||||||
|
.---we-made-it-to-the-end--- {
|
||||||
|
}
|
||||||
11
tests/css/test_mega_stylesheet.py
Normal file
11
tests/css/test_mega_stylesheet.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from textual.css.stylesheet import Stylesheet
|
||||||
|
|
||||||
|
|
||||||
|
def test_mega_stylesheet() -> None:
|
||||||
|
"""It should be possible to load a known-good stylesheet."""
|
||||||
|
mega_stylesheet = Stylesheet()
|
||||||
|
mega_stylesheet.read(Path(__file__).parent / "test_mega_stylesheet.css")
|
||||||
|
mega_stylesheet.parse()
|
||||||
|
assert ".---we-made-it-to-the-end---" in mega_stylesheet.css
|
||||||
Reference in New Issue
Block a user