Commit graph

106 commits

Author SHA1 Message Date
Juro Oravec
f3a2bcbc4f refactor: rename for easier debugging 2024-04-16 23:25:13 +02:00
Juro Oravec
1dd492314a refactor: use component_id instead of Template as slot fill cache key 2024-04-16 23:25:13 +02:00
pre-commit-ci[bot]
752567bf7c [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-04-14 14:49:07 +00:00
Juro Oravec
fd9c441024 refactor: fix linter errors 2024-04-14 16:48:55 +02:00
Juro Oravec
e6725c8445 refactor: update tests 2024-04-14 16:46:43 +02:00
Juro Oravec
5ca4313238 refactor: fix mypy error 2024-04-14 13:54:39 +02:00
Juro Oravec
1f72535cf1 refactor: skip test 2024-04-14 13:51:08 +02:00
pre-commit-ci[bot]
8ff35ae5e5 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-04-14 11:10:56 +00:00
Juro Oravec
dae49c42a8 refactor: add tests 2024-04-14 13:10:45 +02:00
Juro Oravec
3050dc71b9 refactor: add test 2024-04-11 23:44:36 +02:00
Dylan Castillo
0f278f3c25
Fix issue #421 (#422) 2024-04-04 08:29:26 +02:00
Juro Oravec
37fd901908
Resolve media and template files relative to component class dir (#395), thanks @JuroOravec
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
2024-03-23 19:01:39 +01:00
Juro Oravec
b14dec9777
Add mypy support (#396), thanks @JuroOravec 2024-03-15 23:31:15 +01:00
Emil Stenström
edf3885632 Replace all instances of component_block with component. Remove duplicate tests. 2024-02-21 22:38:06 +01:00
Emil Stenström
48fe8171b4 Reformat lines that became too long. And enforce 119 line length. 2024-02-21 22:38:06 +01:00
Emil Stenström
ef6a082238 Remove component tag in favour of component_block. 2024-02-21 22:38:06 +01:00
Dylan Castillo
5b296b02a3 Remove more prints, sorry :/ 2024-02-08 08:45:00 +01:00
Dylan Castillo
5c2b7eb640 Remove unnecessary function 2024-02-08 08:45:00 +01:00
Dylan Castillo
567c8ccc3d Fix for #290 2024-02-08 08:45:00 +01:00
Dylan Castillo
dc9f1b46b2
Fix issue #368 and add tests (#369) 2024-01-27 23:10:03 +01:00
Dylan Castillo
91b4accfeb
Render components as views (#366) (thanks @dylanjcastillo) 2024-01-24 22:36:57 +01:00
pre-commit-ci[bot]
665d5af827 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-15 21:58:42 +01:00
Dylan Castillo
560b721523 Change context behavior setting to enum 2024-01-15 21:58:42 +01:00
Dylan Castillo
4da76c178b Add setting to isolate components' context by default 2024-01-15 21:58:42 +01:00
Dylan Castillo
70a2a01400 Implement single file components 2024-01-14 22:36:55 +01:00
Dylan Castillo
27b35f32b9
Add startcomponent test cases and setup (#346) 2023-12-17 23:40:12 +01:00
Roman Imankulov
16826f45f9 Change the order of arguments in assertHTMLEqual() 2023-09-29 16:06:52 +02:00
Roman Imankulov
0cc507fd5d Replace self.assertEqual() with self.assertHTMLEqual() 2023-09-29 16:06:52 +02:00
pre-commit-ci[bot]
6a633c67a8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-29 16:06:52 +02:00
Roman Imankulov
a919b648b3 Add support for - and / in component names in middleware
- Fix the COMPONENT_COMMENT_REGEX to find component names with special symbols.
- Fix the test to catch the error.

Follow-up of e0c29e5 and ref: #262
2023-09-29 16:06:52 +02:00
Emil Stenström
719637b3aa Minor: Remove type attribute from right side to make usage more intuitive. 2023-09-29 12:48:23 +02:00
Emil Stenström
e0c29e55b7 Add support for - and / in component names in middleware. 2023-09-03 11:44:40 +02:00
VojtechPetru
26bd72a9e2
Invalid slot more helpful message (#283)
* more helpful message when filling invalid slot name

* Update tests/test_templatetags.py

Co-authored-by: Emil Stenström <emil@emilstenstrom.se>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add missing import; set -> typing.Set

* fix after rebase

* set -> typing.Set

* let -> typing.List

* Reduce duplicated effort; extend helpfulness; add extra comments

code qa

---------

Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: lemontheme <lemontheme@gmail.com>
2023-05-22 14:54:18 +02:00
VojtechPetru
9fd53436d7
Fix - fill inside loop (#273)
* simple iteration fill test case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* a couple more tests

* distinguish between filled & default value

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: adriaan <lemontheme@gmail.com>
2023-05-18 15:46:46 +02:00
adriaan
2d86f042da
Implement #231 – default slot filling (#269)
* Add 'default' slot option + implicit fills; tests; docs
* Differentiate between standard fillnodes and implicitfillnodes on type lvl
* Reworking slot-fill rendering logic. Simplifying component interfact. Add new get_string_template method
* First working implementation of chainmap instead of stacks for slot resolution
* Stop passing FillNode to Component initalizer -> better decoupling
* Treat fill name and alias and component name as filterexpression, dropping namedvariable
* Name arg of if_filled tags and slots must be string literal
2023-05-18 14:58:46 +02:00
adriaan
7544bd10e2
Add regression test for #239 (broke extends tags) + minor tweaks (#247) 2023-03-23 21:38:08 +01:00
lemontheme
898d148382 Add required kwd to slot tag and add test
Move required slot check to SlotNode.render(); clean up needed

Remove unused code; drop caching

Update docs

Incorporate PR feedback
2023-03-14 23:40:21 +01:00
lemontheme
a8dfcce24e Introduce {% fill %} replacing 'fill' func of 'slot' tag
Partial implementation fill-tags plus update tests

Implement {% fill %} tags. Next: update tests.

Bring back support for {%slot%} blocks for bckwrd-compat and implement ambig. resolution policy

Update tests to use fill blocks. Add extra checks that raise errors

Add new tests for fill-slot nesting

Update README. Editing still required

remove unused var ctxt after flake8 complaint

fix flake8 warning about slotless f-string

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Add new slot aliases in fill context. Clean up rendering logic in Component. Update docs.

fix flake8, isort, black errors

Refactor duplicated name validation

Add if_filled tag + elif_filled...else_filled...endif_filled for cond. slots

Fix mistake in do_if_filled() docstring

Upload templates for tests! D'oh

Incorporate PR feedback

Drop Literal type hint; Use isort off-on instead of skip in tests

Treat all fill,slot,if_filled,component names as variables

Reset sampleproject components

Add test for variable filled name

Update examples in docs
2023-03-14 23:40:21 +01:00
Emil Stenström
36237f0752 Make Media.css and Media.js optional. 2023-02-09 22:15:47 +01:00
Humberto Alves
f7ae307c79 Add test for passing a response to the middleware without Content-Type header. 2023-01-05 09:59:55 +00:00
Emil Stenström
8af63ad3ad Ignore type="text/css" in tests, it doesn't matter. 2022-12-25 23:00:59 +01:00
Emil Stenström
812e455dec Update tests to include component_block versions too. 2022-07-14 13:29:35 +02:00
Emil Stenström
84fcaf7ba7 Add tests for calling template tag with variable. 2022-07-14 12:49:21 +02:00
Emil Stenström
98ea9405f9 Fix test breakage when setting accessed before django.setup(). 2022-07-14 09:29:00 +02:00
David Guillot
0ae04467c5 fix(tests): some minor anomalies 2022-04-29 00:06:06 +02:00
David Guillot
f67cd37dea feat(templatetags): fix #143, ability to preload components 2022-04-29 00:06:06 +02:00
pre-commit-ci[bot]
0648ad9a93 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-09-10 11:12:26 +00:00
Emil Stenström
a2f0e2246b Require get_context_data set to accept parameters. 2021-09-10 12:29:47 +02:00
Emil Stenström
fa3731422f Variables are never used in the tests. Remove them. 2021-09-10 11:46:09 +02:00
Real-Gecko
5fcabaa5ba Renamed get_context to get_context_data 2021-09-10 11:27:55 +02:00