mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-17 05:50:24 +00:00
parent
c025b249b3
commit
7a70e395d3
2 changed files with 48 additions and 0 deletions
|
|
@ -412,6 +412,7 @@ class Config:
|
|||
| filter
|
||||
| each
|
||||
| macro
|
||||
| call
|
||||
| raw
|
||||
"""
|
||||
+ self.custom_blocks
|
||||
|
|
@ -527,6 +528,7 @@ class Config:
|
|||
| verbatim
|
||||
| each
|
||||
| macro
|
||||
| call
|
||||
| raw
|
||||
"""
|
||||
+ self.custom_blocks
|
||||
|
|
@ -568,6 +570,8 @@ class Config:
|
|||
| endmacro
|
||||
| raw
|
||||
| endraw
|
||||
| call
|
||||
| endcall
|
||||
"""
|
||||
+ self.custom_blocks
|
||||
+ r"""
|
||||
|
|
|
|||
44
tests/test_jinja/test_call.py
Normal file
44
tests/test_jinja/test_call.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"""Djlint tests specific to jinja.
|
||||
|
||||
run::
|
||||
|
||||
pytest tests/test_jinja/test_call.py --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
pytest tests/test_jinja/test_call.py::test_call --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
"""
|
||||
# pylint: disable=C0116
|
||||
|
||||
from typing import TextIO
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
from tests.conftest import reformat
|
||||
|
||||
|
||||
def test_call(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
output = reformat(
|
||||
tmp_file, runner, b"{% call 'cool' %}<div>some html</div>{% endcall %}"
|
||||
)
|
||||
assert output.exit_code == 1
|
||||
assert (
|
||||
output.text
|
||||
== r"""{% call 'cool' %}
|
||||
<div>some html</div>
|
||||
{% endcall %}
|
||||
"""
|
||||
)
|
||||
|
||||
output = reformat(
|
||||
tmp_file, runner, b"{% call('cool') %}<div>some html</div>{% endcall %}"
|
||||
)
|
||||
assert output.exit_code == 1
|
||||
assert (
|
||||
output.text
|
||||
== r"""{% call('cool') %}
|
||||
<div>some html</div>
|
||||
{% endcall %}
|
||||
"""
|
||||
)
|
||||
Loading…
Reference in a new issue