67 | <${Header} name="ToDo's (${page})" />
68 |
69 | ${todos.map((todo) => html`- ${todo}
`)}
70 |
71 | <${Button} onClick=${this.addTodo.bind(this)}>Add Todo${Button}>
72 | <${Footer}>footer content here/>
73 |
74 | `;
75 | }
76 | }
77 |
78 | render(html`<${App} page="All" />`, document.body);
79 | ```
80 |
81 | ## Usage in Tests
82 |
83 | ```js
84 | import { html as litHtml, render } from 'lit';
85 | import takeCareOf from 'carehtml';
86 |
87 | const html = takeCareOf(litHtml);
88 |
89 | describe('MyMixin', () => {
90 | it('does something', () => {
91 | class MyElement extends MyMixin(HTMLElement) {
92 | // define extra behavior
93 | }
94 |
95 | // create fixture
96 | // (html`` in this context returns TemplateResult as if it was Lit itself)
97 | const element = fixture(html`<${MyElement}>${MyElement}>`);
98 |
99 | // test mixin/element behavior
100 | });
101 | });
102 |
103 | function fixture(litTemplate) {
104 | // please use smth like this in real life
105 | // https://open-wc.org/recommendations/testing-helpers.html#test-a-custom-element-with-properties
106 | const wrapper = document.createElement('div');
107 | render(litTemplate, wrapper);
108 | document.body.appendChild(wrapper);
109 | return wrapper.children[0];
110 | }
111 | ```
112 |
113 | ## Benchmarks
114 |
115 | Runtime performance is not the key requirement for `carehtml` since the end goal is to compile the code and have static and still unique tag names in the production code.
116 | But some numbers might be interesting to show the impact of such solution on local development and the potential runtime usage in production for projects that want to stay compilation-free.
117 |
118 | There are 2 things which `carehtml` can slow down and which can be measured: creating a template and rendering a template.
119 | Both can be measured together as well.
120 |
121 | The original idea was that the benchmarks need to compare the most minimalistic template possible, e.g. `