diff --git a/test/statics-caching.test.mjs b/test/statics-caching.test.mjs index 11c9820..78bb627 100644 --- a/test/statics-caching.test.mjs +++ b/test/statics-caching.test.mjs @@ -89,4 +89,39 @@ describe('htm', () => { expect(html`
`).toBe(3); }); }); + + describe('the h function should be able to modify `this[0]`', () => { + function wrapH(h) { + return function(type, props, ...children) { + if (type === '@static') { + this[0] &= ~3; + return children; + } + if (props['@static']) { + this[0] &= ~3; + } + return h(type, props, ...children); + }; + } + + test('should be able to force subtrees to be static via a prop', () => { + const html = htm.bind(wrapH(h)); + const x = () => html`