mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 11:17:21 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
a919b648b3
commit
6a633c67a8
2 changed files with 19 additions and 8 deletions
|
@ -11,7 +11,9 @@ CSS_DEPENDENCY_PLACEHOLDER = '<link name="CSS_PLACEHOLDER">'
|
||||||
JS_DEPENDENCY_PLACEHOLDER = '<script name="JS_PLACEHOLDER"></script>'
|
JS_DEPENDENCY_PLACEHOLDER = '<script name="JS_PLACEHOLDER"></script>'
|
||||||
|
|
||||||
SCRIPT_TAG_REGEX = re.compile("<script")
|
SCRIPT_TAG_REGEX = re.compile("<script")
|
||||||
COMPONENT_COMMENT_REGEX = re.compile(rb"<!-- _RENDERED (?P<name>[\w\-/]+?) -->")
|
COMPONENT_COMMENT_REGEX = re.compile(
|
||||||
|
rb"<!-- _RENDERED (?P<name>[\w\-/]+?) -->"
|
||||||
|
)
|
||||||
PLACEHOLDER_REGEX = re.compile(
|
PLACEHOLDER_REGEX = re.compile(
|
||||||
rb"<!-- _RENDERED (?P<name>[\w\-/]+?) -->"
|
rb"<!-- _RENDERED (?P<name>[\w\-/]+?) -->"
|
||||||
rb'|<link name="CSS_PLACEHOLDER">'
|
rb'|<link name="CSS_PLACEHOLDER">'
|
||||||
|
|
|
@ -399,8 +399,14 @@ class ComponentMediaRenderingTests(SimpleTestCase):
|
||||||
request = Mock()
|
request = Mock()
|
||||||
self.assertEqual(response, middleware(request=request))
|
self.assertEqual(response, middleware(request=request))
|
||||||
|
|
||||||
def test_middleware_response_with_components_with_slash_dash_and_underscore(self):
|
def test_middleware_response_with_components_with_slash_dash_and_underscore(
|
||||||
component_names = ["test-component", "test/component", "test_component"]
|
self,
|
||||||
|
):
|
||||||
|
component_names = [
|
||||||
|
"test-component",
|
||||||
|
"test/component",
|
||||||
|
"test_component",
|
||||||
|
]
|
||||||
for component_name in component_names:
|
for component_name in component_names:
|
||||||
component.registry.register(
|
component.registry.register(
|
||||||
name=component_name, component=SimpleComponent
|
name=component_name, component=SimpleComponent
|
||||||
|
@ -412,8 +418,11 @@ class ComponentMediaRenderingTests(SimpleTestCase):
|
||||||
f"{{% component '{component_name}' variable='value' %}}"
|
f"{{% component '{component_name}' variable='value' %}}"
|
||||||
)
|
)
|
||||||
rendered = create_and_process_template_response(template)
|
rendered = create_and_process_template_response(template)
|
||||||
self.assertEqual((
|
self.assertEqual(
|
||||||
'<script src="script.js"></script>'
|
(
|
||||||
'<link href="style.css" media="all" rel="stylesheet">'
|
'<script src="script.js"></script>'
|
||||||
"Variable: <strong>value</strong>\n"
|
'<link href="style.css" media="all" rel="stylesheet">'
|
||||||
), rendered)
|
"Variable: <strong>value</strong>\n"
|
||||||
|
),
|
||||||
|
rendered,
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue