Skip to content

Commit 0e35325

Browse files
committed
kitchen-sink test case for reactive shadow roots from #59
1 parent 327b3e3 commit 0e35325

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

examples/kitchen-sink/index.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,13 @@ const sinks = {
672672
`;
673673
},
674674

675+
ShadowDOMElement: () => {
676+
return rml`
677+
Should create a web component with a reactive Shadow DOM and elements created after mounting that are still reactive
678+
<custom-shadowdom-element />
679+
`;
680+
},
681+
675682
EventDelegation: () => {
676683
const n = new BehaviorSubject<number>(0);
677684

@@ -1798,13 +1805,31 @@ const component = () => {
17981805
`;
17991806
}
18001807

1808+
RegisterElement('custom-shadowdom-element', () => {
1809+
const data = new Subject<string>().pipe(
1810+
map(data=>{
1811+
const rm = new Subject<string>;
1812+
return rml`<button onclick="${rm}" rml:removed="${rm}">${data}</button>`
1813+
}),
1814+
);
1815+
1816+
return rml`
1817+
<div class="cls1">
1818+
Custom Element with Reactive Shadow DOM!<br>
1819+
<input onchange="${Cut(data)}">
1820+
<br>
1821+
Output (buttons should disappear when clicked): <span>${AppendHTML(data)}</span>
1822+
</div>
1823+
`;
1824+
});
1825+
18011826
RegisterElement('custom-element', ({ title, content, onbuttonclick, onput }) => {
18021827
const internalPut = new Subject();
18031828
const handle = e => {
18041829
console.log('Internal event', e);
18051830
onput.next(e);
18061831
internalPut.next(e);
1807-
}
1832+
};
18081833

18091834
return rml`
18101835
<div class="cls1">

0 commit comments

Comments
 (0)