mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
feat: allow globs when specifynigg additionall JS and CSS (#1043)
* feat: allow globs when specifynigg additionall JS and CSS * refactor: fix tests and linter errors
This commit is contained in:
parent
73e94b6714
commit
ab75cfdb8f
12 changed files with 282 additions and 97 deletions
|
@ -386,6 +386,34 @@ class TestComponentMedia:
|
|||
assertInHTML('<link abc href="path/to/style2.css" media="print" rel="stylesheet">', rendered)
|
||||
assertInHTML('<link abc href="path/to/style3.css" media="screen" rel="stylesheet">', rendered)
|
||||
|
||||
@djc_test(
|
||||
django_settings={
|
||||
"INSTALLED_APPS": ("django_components", "tests"),
|
||||
}
|
||||
)
|
||||
def test_glob_pattern_relative_to_component(self):
|
||||
from tests.components.glob.glob import GlobComponent
|
||||
rendered = GlobComponent.render()
|
||||
|
||||
assertInHTML('<link href="glob/glob_1.css" media="all" rel="stylesheet">', rendered)
|
||||
assertInHTML('<link href="glob/glob_2.css" media="all" rel="stylesheet">', rendered)
|
||||
assertInHTML('<script src="glob/glob_1.js"></script>', rendered)
|
||||
assertInHTML('<script src="glob/glob_2.js"></script>', rendered)
|
||||
|
||||
@djc_test(
|
||||
django_settings={
|
||||
"INSTALLED_APPS": ("django_components", "tests"),
|
||||
}
|
||||
)
|
||||
def test_glob_pattern_relative_to_root_dir(self):
|
||||
from tests.components.glob.glob import GlobComponentRootDir
|
||||
rendered = GlobComponentRootDir.render()
|
||||
|
||||
assertInHTML('<link href="glob/glob_1.css" media="all" rel="stylesheet">', rendered)
|
||||
assertInHTML('<link href="glob/glob_2.css" media="all" rel="stylesheet">', rendered)
|
||||
assertInHTML('<script src="glob/glob_1.js"></script>', rendered)
|
||||
assertInHTML('<script src="glob/glob_2.js"></script>', rendered)
|
||||
|
||||
|
||||
@djc_test
|
||||
class TestMediaPathAsObject:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue