refactor: Fix path resolution relative to COMPONENTS.dirs + add CI test to ensure sampleproject works (#1075)

* refactor: Fix path resolution relative to COMPONENTS.dirs + add CI test to ensure sampleproject works

* refactor: fix compat with Windows by explicitly using utf8 encoding to read component files

* refactor: add missing components to tests

* docs: update changelog

* refactor: fix formatting
This commit is contained in:
Juro Oravec 2025-03-31 16:09:37 +02:00 committed by GitHub
parent f07818fc7d
commit 9f68f0f1a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 100 additions and 14 deletions

View file

@ -414,6 +414,30 @@ class TestComponentMedia:
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_non_globs_not_modified(self):
from tests.components.glob.glob import NonGlobComponentRootDir
rendered = NonGlobComponentRootDir.render()
assertInHTML('<link href="glob/glob_1.css" media="all" rel="stylesheet">', rendered)
assertInHTML('<script src="glob/glob_1.js"></script>', rendered)
@djc_test(
django_settings={
"INSTALLED_APPS": ("django_components", "tests"),
}
)
def test_non_globs_not_modified_nonexist(self):
from tests.components.glob.glob import NonGlobNonexistComponentRootDir
rendered = NonGlobNonexistComponentRootDir.render()
assertInHTML('<link href="glob/glob_nonexist.css" media="all" rel="stylesheet">', rendered)
assertInHTML('<script src="glob/glob_nonexist.js"></script>', rendered)
def test_glob_pattern_does_not_break_urls(self):
from tests.components.glob.glob import UrlComponent
rendered = UrlComponent.render()