From e238bee274cbbabb46630dc3b1ff7b645f1c2775 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 12 Apr 2022 16:37:32 +0100 Subject: [PATCH] ws --- sandbox/basic.css | 2 +- src/textual/app.py | 2 +- tests/css/test_parse.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sandbox/basic.css b/sandbox/basic.css index 8bcb7ee79..4d3e64d65 100644 --- a/sandbox/basic.css +++ b/sandbox/basic.css @@ -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; diff --git a/src/textual/app.py b/src/textual/app.py index c710ac5ee..873d4c5e7 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -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: diff --git a/tests/css/test_parse.py b/tests/css/test_parse.py index 34f79034c..defb15a5e 100644 --- a/tests/css/test_parse.py +++ b/tests/css/test_parse.py @@ -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)