-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(formatter): fixed formatting on nested inline comments
closes #423
- Loading branch information
1 parent
400639d
commit a86df43
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
pytest tests/test_django/test_comments.py --cov=src/djlint --cov-branch \ | ||
--cov-report xml:coverage.xml --cov-report term-missing | ||
pytest tests/test_django/test_comments.py::test_comment | ||
pytest tests/test_django/test_comments.py::test_nested_inline_comment | ||
""" | ||
# pylint: disable=C0116 | ||
|
@@ -133,3 +133,22 @@ def test_inline_comment(runner: CliRunner, tmp_file: TextIO) -> None: | |
) | ||
assert output.text == """{# <div></div> #}\n{% if this %}<div></div>{% endif %}\n""" | ||
assert output.exit_code == 0 | ||
|
||
|
||
def test_nested_inline_comment(runner: CliRunner, tmp_file: TextIO) -> None: | ||
output = reformat( | ||
tmp_file, | ||
runner, | ||
b"""<div> | ||
{% if 1 %} | ||
<div class="{% if 1 %}class {% else %} class {% endif %}"> | ||
<div class="class" | ||
data-parameters="{#[email protected]#}" | ||
data-target="profile-{{ profile_type }}-{{ profile_id }}"> | ||
</div> | ||
</div> | ||
{% endif %} | ||
""", | ||
) | ||
|
||
assert output.exit_code == 0 |