mirror of
https://github.com/django-components/django-components.git
synced 2025-08-30 10:47:20 +00:00
refactor: move the utils from component_tags to util.template_tag (#899)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
a79b24b692
commit
ba0f9e65e9
4 changed files with 584 additions and 576 deletions
|
@ -8,7 +8,7 @@ from django_components.expression import (
|
|||
safe_resolve_dict,
|
||||
safe_resolve_list,
|
||||
)
|
||||
from django_components.templatetags.component_tags import TagSpec, _parse_tag
|
||||
from django_components.util.template_tag import TagSpec, parse_template_tag
|
||||
|
||||
from .django_test_setup import setup_test_config
|
||||
from .testutils import BaseTestCase, parametrize_context_behavior
|
||||
|
@ -26,7 +26,7 @@ class ParserTest(BaseTestCase):
|
|||
pos_or_keyword_args=["num", "var"],
|
||||
keywordonly_args=True,
|
||||
)
|
||||
tag = _parse_tag(parser, parser.tokens[0], tag_spec=spec, tag_id="my-id")
|
||||
tag = parse_template_tag(parser, parser.tokens[0], tag_spec=spec, tag_id="my-id")
|
||||
|
||||
ctx = {"myvar": {"a": "b"}, "val2": 1}
|
||||
args = safe_resolve_list(ctx, tag.args)
|
||||
|
@ -42,7 +42,7 @@ class ParserTest(BaseTestCase):
|
|||
tokens = Lexer(template_str).tokenize()
|
||||
parser = Parser(tokens=tokens)
|
||||
spec = TagSpec(tag="component", keywordonly_args=True)
|
||||
tag = _parse_tag(parser, parser.tokens[0], tag_spec=spec, tag_id="my-id")
|
||||
tag = parse_template_tag(parser, parser.tokens[0], tag_spec=spec, tag_id="my-id")
|
||||
|
||||
ctx = Context({"date": 2024, "bzz": "fzz"})
|
||||
args = safe_resolve_list(ctx, tag.args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue