@@ -269,9 +269,12 @@ suite('Styling', () => {
269269 '10px' ) ;
270270 } ) ;
271271
272- test ( '@apply renders in nested elements when sub-element renders separately first' , async ( ) => {
273- class I extends LitElement {
274- render ( ) { return htmlWithStyles `
272+ test (
273+ '@apply renders in nested elements when sub-element renders separately first' ,
274+ async ( ) => {
275+ class I extends LitElement {
276+ render ( ) {
277+ return htmlWithStyles `
275278 < style >
276279 : host {
277280 dis play: block;
@@ -282,15 +285,16 @@ suite('Styling', () => {
282285 @apply --bag;
283286 }
284287 </ style > Hi` ;
285- }
286- }
287- customElements . define ( 'x-applied' , I ) ;
288+ }
289+ }
290+ customElements . define ( 'x-applied' , I ) ;
288291
289- const name = generateElementName ( ) ;
290- class E extends LitElement {
291- applied : HTMLElement | undefined ;
292+ const name = generateElementName ( ) ;
293+ class E extends LitElement {
294+ applied : HTMLElement | undefined ;
292295
293- render ( ) { return htmlWithStyles `
296+ render ( ) {
297+ return htmlWithStyles `
294298 < style >
295299 : host {
296300 - - bag: {
@@ -300,29 +304,36 @@ suite('Styling', () => {
300304 }
301305 </ style >
302306 < x-applied > </ x-applied > ` ;
303- }
304-
305- firstUpdated ( ) {
306- this . applied = this . shadowRoot ! . querySelector ( 'x-applied' ) as LitElement ;
307- }
308- }
309- customElements . define ( name , E ) ;
310-
311- const firstApplied = document . createElement ( 'x-applied' ) as I ;
312- container . appendChild ( firstApplied ) ;
313- const el = document . createElement ( name ) as E ;
314- container . appendChild ( el ) ;
315-
316- // Workaround for Safari 9 Promise timing bugs.
317- await firstApplied . updateComplete && el . updateComplete && await ( el . applied as I ) ! . updateComplete ;
318-
319- await nextFrame ( ) ;
320- assert . equal ( getComputedStyleValue ( firstApplied ! , 'border-top-width' ) . trim ( ) , '2px' ) ;
321- assert . equal ( getComputedStyleValue ( firstApplied ! , 'margin-top' ) . trim ( ) , '10px' ) ;
322- assert . equal ( getComputedStyleValue ( el . applied ! , 'border-top-width' ) . trim ( ) , '10px' ) ;
323- assert . equal ( getComputedStyleValue ( el . applied ! , 'margin-top' ) . trim ( ) , '2px' ) ;
324- } ) ;
307+ }
325308
309+ firstUpdated ( ) {
310+ this . applied =
311+ this . shadowRoot ! . querySelector ( 'x-applied' ) as LitElement ;
312+ }
313+ }
314+ customElements . define ( name , E ) ;
315+
316+ const firstApplied = document . createElement ( 'x-applied' ) as I ;
317+ container . appendChild ( firstApplied ) ;
318+ const el = document . createElement ( name ) as E ;
319+ container . appendChild ( el ) ;
320+
321+ // Workaround for Safari 9 Promise timing bugs.
322+ await firstApplied . updateComplete && el . updateComplete &&
323+ await ( el . applied as I ) ! . updateComplete ;
324+
325+ await nextFrame ( ) ;
326+ assert . equal (
327+ getComputedStyleValue ( firstApplied ! , 'border-top-width' ) . trim ( ) ,
328+ '2px' ) ;
329+ assert . equal ( getComputedStyleValue ( firstApplied ! , 'margin-top' ) . trim ( ) ,
330+ '10px' ) ;
331+ assert . equal (
332+ getComputedStyleValue ( el . applied ! , 'border-top-width' ) . trim ( ) ,
333+ '10px' ) ;
334+ assert . equal ( getComputedStyleValue ( el . applied ! , 'margin-top' ) . trim ( ) ,
335+ '2px' ) ;
336+ } ) ;
326337} ) ;
327338
328339suite ( 'ShadyDOM' , ( ) => {
0 commit comments