-
-
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.
feat(formatter): added white space cleanup for template tags
closes #485
- Loading branch information
1 parent
9050d30
commit 13d0d4f
Showing
6 changed files
with
90 additions
and
64 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
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Test django spaceless tag. | ||
poetry run pytest tests/test_django/test_tag_spaces.py | ||
""" | ||
import pytest | ||
|
||
from src.djlint.reformat import formatter | ||
from tests.conftest import config_builder, printer | ||
|
||
test_data = [ | ||
pytest.param( | ||
("{% a %}\n" "{%b %}{%+c%}{%-d+%}\n" "{#a}{{g {%a%}}}{%l{{q}}+%}"), | ||
( | ||
"{% a %}\n" | ||
"{% b %}{%+ c %}{%- d +%}\n" | ||
"{#a}{{ g {% a % }}}{% l{{ q }} +%}\n" | ||
), | ||
({}), | ||
id="messy stuff", | ||
), | ||
pytest.param( | ||
("{% a %}\n" "{%b%}{%c%}{%-d+%}\n" "{#a}{{g {%a%}}}{%l{{q}}+%}"), | ||
("{% a %}\n" "{%b%}{%c%}{%-d+%}\n" "{#a}{{g {%a%}}}{%l{{q}}+%}\n"), | ||
({"profile": "handlebars"}), | ||
id="messy stuff", | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize(("source", "expected", "args"), test_data) | ||
def test_base(source, expected, args): | ||
output = formatter(config_builder(args), source) | ||
|
||
printer(expected, source, output) | ||
assert expected == output |