mirror of
https://github.com/django-components/django-components.git
synced 2025-08-30 10:47:20 +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>'
|
||||
|
||||
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(
|
||||
rb"<!-- _RENDERED (?P<name>[\w\-/]+?) -->"
|
||||
rb'|<link name="CSS_PLACEHOLDER">'
|
||||
|
|
|
@ -399,8 +399,14 @@ class ComponentMediaRenderingTests(SimpleTestCase):
|
|||
request = Mock()
|
||||
self.assertEqual(response, middleware(request=request))
|
||||
|
||||
def test_middleware_response_with_components_with_slash_dash_and_underscore(self):
|
||||
component_names = ["test-component", "test/component", "test_component"]
|
||||
def test_middleware_response_with_components_with_slash_dash_and_underscore(
|
||||
self,
|
||||
):
|
||||
component_names = [
|
||||
"test-component",
|
||||
"test/component",
|
||||
"test_component",
|
||||
]
|
||||
for component_name in component_names:
|
||||
component.registry.register(
|
||||
name=component_name, component=SimpleComponent
|
||||
|
@ -412,8 +418,11 @@ class ComponentMediaRenderingTests(SimpleTestCase):
|
|||
f"{{% component '{component_name}' variable='value' %}}"
|
||||
)
|
||||
rendered = create_and_process_template_response(template)
|
||||
self.assertEqual((
|
||||
'<script src="script.js"></script>'
|
||||
'<link href="style.css" media="all" rel="stylesheet">'
|
||||
"Variable: <strong>value</strong>\n"
|
||||
), rendered)
|
||||
self.assertEqual(
|
||||
(
|
||||
'<script src="script.js"></script>'
|
||||
'<link href="style.css" media="all" rel="stylesheet">'
|
||||
"Variable: <strong>value</strong>\n"
|
||||
),
|
||||
rendered,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue