fixed #118, added test

This commit is contained in:
Christopher Pickering 2021-10-14 14:15:25 +03:00
parent 00ed6b18d2
commit 7d4e4920bc
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 14 additions and 3 deletions

View file

@ -29,7 +29,6 @@ def indent_html(rawcode: str, config: Config) -> str:
slt_template = config.optional_single_line_template_tags
for item in rawcode_flat_list:
# if a raw tag first line
if not is_block_raw and is_ignored_block_opening(config, item):
is_raw_first_line = True
@ -80,7 +79,6 @@ def indent_html(rawcode: str, config: Config) -> str:
re.IGNORECASE | re.MULTILINE | re.VERBOSE,
)
and is_block_raw is False
or re.search(config.ignored_block_closing, item, re.IGNORECASE | re.VERBOSE)
):
indent_level = max(indent_level - 1, 0)
tmp = (indent * indent_level) + item + "\n"

View file

@ -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_ignored_attributes --cov=src/djlint --cov-branch \
pytest tests/test_html.py::test_textarea_tag --cov=src/djlint --cov-branch \
--cov-report xml:coverage.xml --cov-report term-missing
@ -33,6 +33,19 @@ asdf
</div>
"""
)
# check double nesting
output = reformat(
tmp_file,
runner,
b"""<div>
<div class="field">
<textarea>asdf</textarea>
</div>
</div>
""",
)
assert output["exit_code"] == 0
def test_script_tag(runner: CliRunner, tmp_file: TextIO) -> None: