@@ -572,45 +572,79 @@ describe('popover', () => {
572572 } ) ;
573573
574574 describe ( 'dimensions' , ( ) => {
575- beforeEach ( async ( ) => {
576- popover . opened = true ;
577- await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
578- } ) ;
575+ describe ( 'default' , ( ) => {
576+ beforeEach ( async ( ) => {
577+ popover . opened = true ;
578+ await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
579+ } ) ;
579580
580- it ( 'should update width after opening the popover' , async ( ) => {
581- popover . width = '300px' ;
582- await nextRender ( ) ;
583- expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( '300px' ) ;
584- } ) ;
581+ it ( 'should update width after opening the popover' , async ( ) => {
582+ popover . width = '300px' ;
583+ await nextRender ( ) ;
584+ expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( '300px' ) ;
585+ } ) ;
585586
586- it ( 'should update height after opening the popover' , async ( ) => {
587- popover . height = '500px' ;
588- await nextRender ( ) ;
589- expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( '500px' ) ;
590- } ) ;
587+ it ( 'should update height after opening the popover' , async ( ) => {
588+ popover . height = '500px' ;
589+ await nextRender ( ) ;
590+ expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( '500px' ) ;
591+ } ) ;
591592
592- it ( 'should reset style after setting width to null' , async ( ) => {
593- const originalWidth = getComputedStyle ( overlay . $ . overlay ) . width ;
593+ it ( 'should reset style after setting width to null' , async ( ) => {
594+ const originalWidth = getComputedStyle ( overlay . $ . overlay ) . width ;
594595
595- popover . width = '500px' ;
596- await nextRender ( ) ;
597- expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( '500px' ) ;
596+ popover . width = '500px' ;
597+ await nextRender ( ) ;
598+ expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( '500px' ) ;
598599
599- popover . width = null ;
600- await nextRender ( ) ;
601- expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( originalWidth ) ;
600+ popover . width = null ;
601+ await nextRender ( ) ;
602+ expect ( getComputedStyle ( overlay . $ . overlay ) . width ) . to . equal ( originalWidth ) ;
603+ } ) ;
604+
605+ it ( 'should reset style after setting height to null' , async ( ) => {
606+ const originalHeight = getComputedStyle ( overlay . $ . overlay ) . height ;
607+
608+ popover . height = '500px' ;
609+ await nextRender ( ) ;
610+ expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( '500px' ) ;
611+
612+ popover . height = null ;
613+ await nextRender ( ) ;
614+ expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( originalHeight ) ;
615+ } ) ;
602616 } ) ;
603617
604- it ( 'should reset style after setting height to null' , async ( ) => {
605- const originalHeight = getComputedStyle ( overlay . $ . overlay ) . height ;
618+ describe ( 'set before attach' , ( ) => {
619+ beforeEach ( ( ) => {
620+ popover = document . createElement ( 'vaadin-popover' ) ;
621+ } ) ;
606622
607- popover . height = '500px' ;
608- await nextRender ( ) ;
609- expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( '500px' ) ;
623+ afterEach ( ( ) => {
624+ popover . remove ( ) ;
625+ } ) ;
610626
611- popover . height = null ;
612- await nextRender ( ) ;
613- expect ( getComputedStyle ( overlay . $ . overlay ) . height ) . to . equal ( originalHeight ) ;
627+ it ( 'should apply overlay width when set before attach' , async ( ) => {
628+ popover . width = '300px' ;
629+ document . body . appendChild ( popover ) ;
630+ await nextRender ( ) ;
631+
632+ popover . opened = true ;
633+ await oneEvent ( popover . $ . overlay , 'vaadin-overlay-open' ) ;
634+
635+ expect ( getComputedStyle ( popover . $ . overlay . $ . overlay ) . width ) . to . equal ( '300px' ) ;
636+ } ) ;
637+
638+ it ( 'should apply overlay height when set before attach' , async ( ) => {
639+ popover . height = '300px' ;
640+ document . body . appendChild ( popover ) ;
641+ await nextRender ( ) ;
642+
643+ popover . opened = true ;
644+ await oneEvent ( popover . $ . overlay , 'vaadin-overlay-open' ) ;
645+
646+ expect ( getComputedStyle ( popover . $ . overlay . $ . overlay ) . height ) . to . equal ( '300px' ) ;
647+ } ) ;
614648 } ) ;
615649 } ) ;
616650
0 commit comments