mirror of
https://github.com/django-components/django-components.git
synced 2025-08-04 06:18:17 +00:00
refactor: Backbone for passing JS and CSS variables (#861)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
296da4a1e8
commit
fe67d90547
28 changed files with 1181 additions and 594 deletions
|
@ -215,7 +215,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const inputHash = 'input-abc';
|
||||
|
||||
// Pretend that this HTML belongs to our component
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
let captured = null;
|
||||
manager.registerComponent(compName, (data, ctx) => {
|
||||
|
@ -248,7 +248,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
"hello": "world",
|
||||
},
|
||||
"ctx": {
|
||||
"els": ['<div data-comp-id-12345=""> abc </div>'],
|
||||
"els": ['<div data-djc-id-12345=""> abc </div>'],
|
||||
"id": "12345",
|
||||
"name": "my_comp",
|
||||
},
|
||||
|
@ -269,7 +269,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const inputHash = 'input-abc';
|
||||
|
||||
// Pretend that this HTML belongs to our component
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
manager.registerComponent(compName, (data, ctx) => {
|
||||
return Promise.resolve(123);
|
||||
|
@ -309,7 +309,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const inputHash = 'input-abc';
|
||||
|
||||
// Pretend that this HTML belongs to our component
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
manager.registerComponent(compName, (data, ctx) => {
|
||||
throw Error('Oops!');
|
||||
|
@ -343,7 +343,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const inputHash = 'input-abc';
|
||||
|
||||
// Pretend that this HTML belongs to our component
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
manager.registerComponent(compName, async (data, ctx) => {
|
||||
throw Error('Oops!');
|
||||
|
@ -408,7 +408,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const compId = '12345';
|
||||
const inputHash = 'input-abc';
|
||||
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
manager.registerComponent(compName, (data, ctx) => {
|
||||
return Promise.resolve(123);
|
||||
|
@ -434,7 +434,7 @@ class CallComponentTests(_BaseDepManagerTestCase):
|
|||
const compId = '12345';
|
||||
const inputHash = 'input-abc';
|
||||
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-comp-id-12345> abc </div>');
|
||||
document.body.insertAdjacentHTML('beforeend', '<div data-djc-id-12345> abc </div>');
|
||||
|
||||
manager.registerComponentData(compName, inputHash, () => {
|
||||
return { hello: 'world' };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue