From 863efbf1164b595527aadc764fdf126f9117a373 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Thu, 7 Oct 2021 08:16:04 +0200 Subject: [PATCH] added script and style tags to single line tags. fixed #68 and added test --- src/djlint/formatter/compress_html.py | 2 +- src/djlint/settings.py | 2 ++ tests/test_html.py | 20 +++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/djlint/formatter/compress_html.py b/src/djlint/formatter/compress_html.py index d707c4f..acd0bcf 100644 --- a/src/djlint/formatter/compress_html.py +++ b/src/djlint/formatter/compress_html.py @@ -102,5 +102,5 @@ def compress_html(html: str, config: Config) -> str: r"\1\3\4", html, ) - + print(html) return html diff --git a/src/djlint/settings.py b/src/djlint/settings.py index a39fc87..922c031 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -564,6 +564,8 @@ class Config: | label | div | li + | script + | style """ self.always_single_line_html_tags: str = r""" diff --git a/tests/test_html.py b/tests/test_html.py index a08f908..7f684eb 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -5,7 +5,7 @@ run:: pytest tests/test_html.py --cov=src/djlint --cov-branch \ --cov-report xml:coverage.xml --cov-report term-missing - pytest tests/test_html.py::test_long_attributes --cov=src/djlint --cov-branch \ + pytest tests/test_html.py::test_style_tag --cov=src/djlint --cov-branch \ --cov-report xml:coverage.xml --cov-report term-missing @@ -53,6 +53,15 @@ console.log(); """ ) + # check script includes + output = reformat( + tmp_file, + runner, + b"""""", + ) + + assert output["exit_code"] == 0 + def test_html_comments_tag(runner: CliRunner, tmp_file: TextIO) -> None: write_to_file( @@ -343,3 +352,12 @@ def test_style_tag(runner: CliRunner, tmp_file: TextIO) -> None: ) assert output["exit_code"] == 0 + + # check style includes + output = reformat( + tmp_file, + runner, + b"""""", + ) + + assert output["exit_code"] == 0