File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,4 +57,23 @@ describe('controller', () => {
5757
5858 expect ( instance . foo ) . to . have . been . called ( 1 )
5959 } )
60+
61+ it ( 'binds auto shadowRoots' , async ( ) => {
62+ controller ( class ControllerBindAutoShadowElement extends HTMLElement { } )
63+ const instance = document . createElement ( 'controller-bind-auto-shadow' )
64+ const template = document . createElement ( 'template' )
65+ template . setAttribute ( 'data-shadowroot' , 'open' )
66+ // eslint-disable-next-line github/unescaped-html-literal
67+ template . innerHTML = '<button data-action="click:controller-bind-auto-shadow#foo"></button>'
68+ instance . appendChild ( template )
69+ chai . spy . on ( instance , 'foo' )
70+ document . body . appendChild ( instance )
71+
72+ expect ( instance . shadowRoot ) . to . exist
73+ expect ( instance ) . to . have . property ( 'shadowRoot' ) . not . equal ( null )
74+ expect ( instance . shadowRoot . children ) . to . have . lengthOf ( 1 )
75+ instance . shadowRoot . querySelector ( 'button' ) . click ( )
76+
77+ expect ( instance . foo ) . to . have . been . called ( 1 )
78+ } )
6079} )
You can’t perform that action at this time.
0 commit comments