This commit is contained in:
Will McGugan
2022-04-12 16:37:32 +01:00
parent 352c8b789d
commit e238bee274
3 changed files with 19 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ App > Screen {
Tweet {
height: 22;
max-width: 80;
margin: 1 3;
margin: 1 3;
background: $panel;
color: $text-panel;
layout: vertical;

View File

@@ -234,7 +234,7 @@ class App(DOMNode):
return
try:
if len(objects) == 1:
if len(objects) == 1 and not kwargs:
if self._log_console is not None:
self._log_console.print(objects[0])
if self.devtools.is_connected:

View File

@@ -9,6 +9,7 @@ from textual.css.stylesheet import Stylesheet, StylesheetParseError
from textual.css.tokenize import tokenize
from textual.css.tokenizer import Token, ReferencedBy
from textual.css.transition import Transition
from textual.geometry import Spacing
from textual.layouts.dock import DockLayout
@@ -1065,3 +1066,19 @@ class TestParseOpacity:
with pytest.raises(StylesheetParseError):
stylesheet.parse(css)
assert stylesheet.rules[0].errors
class TestParseMargin:
def test_margin_partial(self):
css = "#foo {margin: 1; margin-top: 2; margin-right: 3; margin-bottom: -1;}"
stylesheet = Stylesheet()
stylesheet.parse(css)
assert stylesheet.rules[0].styles.margin == Spacing(2, 3, -1, 1)
class TestParsePadding:
def test_padding_partial(self):
css = "#foo {padding: 1; padding-top: 2; padding-right: 3; padding-bottom: -1;}"
stylesheet = Stylesheet()
stylesheet.parse(css)
assert stylesheet.rules[0].styles.padding == Spacing(2, 3, -1, 1)