rbeard0330
979dc82eda
Fix bug where template with multiple component_block tags could raise KeyError ( #19 )
...
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-30 08:01:57 +01:00
rbeard0330
93b8a7404a
Rework of context handling ( #18 )
...
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-28 10:40:35 +01:00
rbeard0330
be0a75e2a3
Missing context variables and kwargs in component_block ( #17 )
...
* Fix issue with missing variables by binding template to context in Component.render method.
* Pass extra_context to Component.render()
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-14 18:25:36 +01:00
Emil Stenström
4c14675c3a
Support specifying block names with single quotes.
...
Fixes #15
2020-12-08 23:41:10 +01:00
Emil Stenström
e9fba9538f
Add trick to make tests pass on Django 1.11 too.
2020-12-08 23:33:36 +01:00
Emil Stenström
ec7b10f4db
Django 3.1 no longer outputs type="text/javascript".
2020-11-10 21:54:15 +01:00
Bradley Stuart Kirton
2c644d4c06
Add pytest-cov
...
Apply black formatting
Add component_css_dependencies_tag and component_js_dependencies_tag tags
Add convenience methods render_css_dependencies and render_js_dependencies to component class
Create additional test cases
Add license to setup.py
Add pytest.ini config file
2020-07-10 13:07:51 +02:00
Emil Stenström
5f63a6a6bd
Add test for component with undefined template method.
2020-06-07 17:07:24 +02:00
Emil Stenström
b2f61b61ad
Fix flake8.
2020-06-07 08:45:54 +02:00
Emil Stenström
d1405dda13
Add slots to components that can be filled when using component.
2020-06-06 09:11:27 +02:00
Emil Stenström
b2726a6832
Contain all registry logic in helper methods.
2020-06-06 09:07:23 +02:00
Emil Stenström
9d48a8e93f
Add test for passing two variables to template tag.
2019-11-24 11:17:17 +01:00
Emil Stenström
701e1e3ac2
Add test for more complex template that uses built-in django filter.
2019-11-24 11:10:14 +01:00
Emil Stenström
d91f014b4b
Move test components into test cases.
2019-11-24 11:09:40 +01:00
Emil Stenström
40ebd6b936
Install isort and fix all imports.
2019-11-24 11:09:14 +01:00
Emil Stenström
f60b443f07
Add test for calling the component template tag with positional arg.
2019-11-24 10:55:57 +01:00
Emil Stenström
aa4a3092c8
Make test suite ignore insignificant differences in HTML and whitespace.
2019-11-24 10:55:30 +01:00
Emil Stenström
6949dc286f
Add tests for defining multiple css and js files.
2019-11-24 10:33:14 +01:00
Emil Stenström
096057b33d
Use built-in django form assets instead of custom logic.
2019-11-24 10:31:23 +01:00
Emil Stenström
ebb180c540
Use list instead of tuple to avoid errors with missing comma.
2019-11-23 19:26:16 +01:00
Emil Stenström
17eb54e18a
Change test setup to make test run on Django 1.7.
2015-06-22 22:37:07 +02:00
Emil Stenström
7bc1096e94
Registering the same component twice only renders one dependency <link> and <script> tag.
2015-06-19 19:30:20 +02:00
Emil Stenström
9a91df7978
Add component tag.
2015-06-14 14:43:57 +02:00
Emil Stenström
57286f8389
Clear global component.registry before each test.
2015-06-14 14:43:43 +02:00
Emil Stenström
a2e829f8af
Use single quotes for all templates, we might need double quotes inside later.
2015-06-14 14:43:11 +02:00
Emil Stenström
5cfd5d2ec7
Use simpler component name.
2015-06-14 14:42:34 +02:00
Emil Stenström
005460543b
Make variable required.
2015-06-14 14:42:01 +02:00
Emil Stenström
176574a9cc
Add component_dependencies template tag.
2015-06-14 14:29:20 +02:00
Emil Stenström
143918e2cf
Move django bootstrapping to separate file so it can be reused between test modules.
2015-06-14 14:16:50 +02:00
Emil Stenström
41122d1592
Move environment setup to the module to get Travis CI to pass.
2015-06-14 12:23:12 +02:00
Ryan Hiebert
f219370be2
Use dictionary to compare registry
...
The registry is a dictionary, so comparing items() has a couple of
problems:
1. The order of a dictionary is unstable, so it may not turn out as
expected.
2. items() returns a list in Python 2, but a dict_items in Python 3,
which makes the comparison fail.
2015-06-13 13:42:27 -05:00
Emil Stenström
6492081b64
Add render() and render_dependencies() to Compoent.
2015-06-12 22:15:09 +02:00
Emil Stenström
972f99af05
Make test slightly more interesting.
2015-06-11 21:28:50 +02:00
Emil Stenström
31261ece08
Add a basic Component class.
2015-06-11 21:14:21 +02:00
Emil Stenström
ebf4ac1d20
Add way to unregister components.
2015-06-11 20:52:46 +02:00
Emil Stenström
00bd40aaaf
Don't allow registering the same component twice.
2015-06-11 20:47:35 +02:00
Emil Stenström
313852ce21
A simple ComponentRegistry to store components.
2015-06-11 20:42:16 +02:00