File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -245,4 +245,38 @@ describe('web components', () => {
245
245
} ) ;
246
246
assert . equal ( getShadowHTML ( ) , '<p>Active theme: sunny</p>' ) ;
247
247
} ) ;
248
+
249
+ it ( 'renders element in shadow dom open mode' , async ( ) => {
250
+ function ShadowDomOpen ( ) {
251
+ return < div className = "shadow-child" > Shadow DOM Open</ div > ;
252
+ }
253
+
254
+ registerElement ( ShadowDomOpen , 'x-shadowdom-open' , [ ] , {
255
+ shadow : true ,
256
+ mode : 'open' ,
257
+ } ) ;
258
+
259
+ const el = document . createElement ( 'x-shadowdom-open' ) ;
260
+ root . appendChild ( el ) ;
261
+ const shadowRoot = el . shadowRoot ;
262
+ assert . isTrue ( ! ! shadowRoot ) ;
263
+ const child = shadowRoot . querySelector ( '.shadow-child' ) ;
264
+ assert . isTrue ( ! ! child ) ;
265
+ assert . equal ( child . textContent , 'Shadow DOM Open' ) ;
266
+ } ) ;
267
+
268
+ it ( 'renders element in shadow dom closed mode' , async ( ) => {
269
+ function ShadowDomClosed ( ) {
270
+ return < div className = "shadow-child" > Shadow DOM Closed</ div > ;
271
+ }
272
+
273
+ registerElement ( ShadowDomClosed , 'x-shadowdom-closed' , [ ] , {
274
+ shadow : true ,
275
+ mode : 'closed' ,
276
+ } ) ;
277
+
278
+ const el = document . createElement ( 'x-shadowdom-closed' ) ;
279
+ root . appendChild ( el ) ;
280
+ assert . isTrue ( el . shadowRoot === null ) ;
281
+ } ) ;
248
282
} ) ;
You can’t perform that action at this time.
0 commit comments