@@ -1509,7 +1509,7 @@ QUnit.module('options changed callbacks', {
15091509 const topToolbar = this . instance . topToolbar ( ) ;
15101510
15111511 assert . strictEqual ( topToolbar . length , 1 , 'top toolbar is rendered' ) ;
1512- // 1st and 2nd from toolbar rendering on init, 3rd from overlay visibility changing
1512+ // 1st from overlay visibility changing, 2nd and 3rd from _animateShowing
15131513 assert . strictEqual ( this . resizeEventSpy . callCount , 3 , 'event is triggered 3 times' ) ;
15141514 } ) ;
15151515
@@ -1524,7 +1524,7 @@ QUnit.module('options changed callbacks', {
15241524 const topToolbar = this . instance . topToolbar ( ) ;
15251525
15261526 assert . strictEqual ( topToolbar . length , 1 , 'top toolbar is rendered' ) ;
1527- // 1st and 2nd from toolbar rendering on init, 3rd from overlay visibility changing
1527+ // 1st from overlay visibility changing, 2nd and 3rd from _animateShowing
15281528 assert . strictEqual ( this . resizeEventSpy . callCount , 3 , 'event is triggered 3 times' ) ;
15291529 } ) ;
15301530
@@ -1540,8 +1540,8 @@ QUnit.module('options changed callbacks', {
15401540 this . instance . option ( { toolbarItems : [ { text : 'text' } ] } ) ;
15411541
15421542 assert . strictEqual ( getTopToolbar ( ) . length , 1 , 'top toolbar is rendered' ) ;
1543- // 2, 3 from top toolbar rendering, 4, 5 from optionChanged
1544- assert . strictEqual ( this . resizeEventSpy . callCount , 5 , 'event is triggered 5 times' ) ;
1543+ // 2nd and 3rd from optionChanged
1544+ assert . strictEqual ( this . resizeEventSpy . callCount , 3 , 'event is triggered 3 times' ) ;
15451545 } ) ;
15461546
15471547 QUnit . test ( 'toolbarItems runtime changing should trigger resize event if toolbar is rendered on init' , function ( assert ) {
@@ -1559,10 +1559,57 @@ QUnit.module('options changed callbacks', {
15591559 const $toolbar2 = getTopToolbar ( ) ;
15601560
15611561 assert . strictEqual ( $toolbar2 . length , 1 , 'top toolbar is rendered' ) ;
1562- assert . strictEqual ( this . resizeEventSpy . callCount , 7 , 'event is triggered additional times' ) ;
1562+ assert . strictEqual ( this . resizeEventSpy . callCount , 5 , 'event is triggered additional times' ) ;
15631563
15641564 assert . strictEqual ( $toolbar1 , $toolbar2 , 'toolbar is not rendered twice after toolbarItems update in runtime' ) ;
15651565 } ) ;
1566+
1567+ QUnit . test ( 'resize event is triggered during animation showing when toolbar is present' , function ( assert ) {
1568+ this . resizeEventSpy . resetHistory ( ) ;
1569+ this . reinit ( {
1570+ visible : false ,
1571+ showTitle : true ,
1572+ showCloseButton : true ,
1573+ } ) ;
1574+ const beforeShow = this . resizeEventSpy . callCount ;
1575+
1576+ this . instance . show ( ) ;
1577+
1578+ const topToolbar = this . instance . topToolbar ( ) ;
1579+
1580+ assert . strictEqual ( beforeShow , 0 , 'event is not triggered when popup is hidden' ) ;
1581+ assert . strictEqual ( topToolbar . length , 1 , 'top toolbar is rendered' ) ;
1582+ // 1st from overlay visibility changing, 2nd and 3rd from _animateShowing
1583+ assert . strictEqual ( this . resizeEventSpy . callCount , 3 , 'event is triggered 3 times during show animation' ) ;
1584+ } ) ;
1585+
1586+ QUnit . test ( 'additional resize events are triggered only on toolbar elements' , function ( assert ) {
1587+ this . resizeEventSpy . resetHistory ( ) ;
1588+ this . reinit ( {
1589+ visible : true ,
1590+ showTitle : true ,
1591+ showCloseButton : true ,
1592+ toolbarItems : [
1593+ {
1594+ text : 'bottom text' ,
1595+ toolbar : 'bottom' ,
1596+ location : 'center' ,
1597+ } ,
1598+ ] ,
1599+ } ) ;
1600+
1601+ const topToolbar = this . instance . topToolbar ( ) ;
1602+ const bottomToolbar = this . instance . bottomToolbar ( ) ;
1603+ const overlayContent = this . instance . $overlayContent ( ) ;
1604+
1605+ const callsForTopToolbar = this . resizeEventSpy . getCalls ( ) . filter ( call => call . args [ 0 ] && call . args [ 0 ] [ 0 ] === topToolbar [ 0 ] ) ;
1606+ const callsForBottomToolbar = this . resizeEventSpy . getCalls ( ) . filter ( call => call . args [ 0 ] && call . args [ 0 ] [ 0 ] === bottomToolbar [ 0 ] ) ;
1607+ const callsForOverlayContent = this . resizeEventSpy . getCalls ( ) . filter ( call => call . args [ 0 ] && call . args [ 0 ] [ 0 ] === overlayContent [ 0 ] ) ;
1608+
1609+ assert . strictEqual ( callsForTopToolbar . length , 2 , 'additional resize events are triggered on top toolbar' ) ;
1610+ assert . strictEqual ( callsForBottomToolbar . length , 2 , 'additional resize events are triggered on bottom toolbar' ) ;
1611+ assert . strictEqual ( callsForOverlayContent . length , 1 , 'resize event is triggered on overlay content for geometry rendering' ) ;
1612+ } ) ;
15661613 } ) ;
15671614
15681615 QUnit . test ( 'titleTemplate option change should trigger resize event for content correct geometry rendering' , function ( assert ) {
0 commit comments