@@ -161,6 +161,40 @@ it('interferes prop types from default values', () => {
161161 expect ( readProps ( el ! ) ) . toMatchSnapshot ( )
162162} )
163163
164+ it ( `exposes the component's refs` , ( ) => {
165+ const component = registerComponent ( 'test' , ( ) => { } )
166+
167+ document . body . innerHTML = `
168+ <div data-simple-component="test" id="my-id">
169+ <div id="ref" data-ref="ref"></div>
170+ </div>
171+ `
172+ const refs = { ref : document . getElementById ( 'ref' ) }
173+ mountComponents ( document . body )
174+ const el = document . getElementById ( 'my-id' ) as SimpleElement < typeof component >
175+ expect ( el . $refs ) . toEqual ( refs )
176+ } )
177+
178+ it ( `exposes the component's refsAll` , ( ) => {
179+ const component = registerComponent ( 'test' , ( ) => { } )
180+
181+ document . body . innerHTML = `
182+ <div data-simple-component="test" id="my-id">
183+ <div id="ref1" data-ref="myRef"></div>
184+ <div id="ref2" data-ref="myRef"></div>
185+ </div>
186+ `
187+
188+ const myRef = [
189+ document . getElementById ( 'ref1' ) ,
190+ document . getElementById ( 'ref2' ) ,
191+ ]
192+
193+ mountComponents ( document . body )
194+ const el = document . getElementById ( 'my-id' ) as SimpleElement < typeof component >
195+ expect ( el . $refsAll ) . toEqual ( { myRef } )
196+ } )
197+
164198it ( `exposes the component function's return value` , ( ) => {
165199 const exposed = { test : ( ) => { } }
166200 const component = registerComponent ( 'test' , ( ) => exposed )
0 commit comments