@@ -1386,6 +1386,89 @@ describe('Appointment Popup Form', () => {
13861386 expect ( data [ 0 ] . Subject ) . toBe ( 'qwerty' ) ;
13871387 expect ( data [ 0 ] . text ) . toBeUndefined ( ) ;
13881388 } ) ;
1389+
1390+ describe ( 'Popup options' , ( ) => {
1391+ it ( 'should pass custom popup options from editing.popup to appointment popup' , async ( ) => {
1392+ const { scheduler, POM } = await createScheduler ( {
1393+ ...getDefaultConfig ( ) ,
1394+ editing : {
1395+ allowAdding : true ,
1396+ allowUpdating : true ,
1397+ popup : {
1398+ showTitle : true ,
1399+ title : 'Custom Appointment Form' ,
1400+ maxHeight : '80%' ,
1401+ dragEnabled : true ,
1402+ } ,
1403+ } ,
1404+ } ) ;
1405+
1406+ scheduler . showAppointmentPopup ( commonAppointment ) ;
1407+
1408+ expect ( POM . popup . component . option ( 'showTitle' ) ) . toBe ( true ) ;
1409+ expect ( POM . popup . component . option ( 'title' ) ) . toBe ( 'Custom Appointment Form' ) ;
1410+ expect ( POM . popup . component . option ( 'maxHeight' ) ) . toBe ( '80%' ) ;
1411+ expect ( POM . popup . component . option ( 'dragEnabled' ) ) . toBe ( true ) ;
1412+ } ) ;
1413+
1414+ it ( 'should use default popup options when editing.popup is not specified' , async ( ) => {
1415+ const { scheduler, POM } = await createScheduler ( {
1416+ ...getDefaultConfig ( ) ,
1417+ editing : {
1418+ allowAdding : true ,
1419+ allowUpdating : true ,
1420+ } ,
1421+ } ) ;
1422+
1423+ scheduler . showAppointmentPopup ( commonAppointment ) ;
1424+
1425+ expect ( POM . popup . component . option ( 'showTitle' ) ) . toBe ( false ) ;
1426+ expect ( POM . popup . component . option ( 'height' ) ) . toBe ( 'auto' ) ;
1427+ expect ( POM . popup . component . option ( 'maxHeight' ) ) . toBe ( '90%' ) ;
1428+ } ) ;
1429+
1430+ it ( 'should merge custom popup options with default options' , async ( ) => {
1431+ const { scheduler, POM } = await createScheduler ( {
1432+ ...getDefaultConfig ( ) ,
1433+ editing : {
1434+ allowAdding : true ,
1435+ allowUpdating : true ,
1436+ popup : {
1437+ showTitle : true ,
1438+ title : 'My Form' ,
1439+ } ,
1440+ } ,
1441+ } ) ;
1442+
1443+ scheduler . showAppointmentPopup ( commonAppointment ) ;
1444+
1445+ expect ( POM . popup . component . option ( 'showTitle' ) ) . toBe ( true ) ;
1446+ expect ( POM . popup . component . option ( 'title' ) ) . toBe ( 'My Form' ) ;
1447+
1448+ expect ( POM . popup . component . option ( 'showCloseButton' ) ) . toBe ( false ) ;
1449+ expect ( POM . popup . component . option ( 'enableBodyScroll' ) ) . toBe ( false ) ;
1450+ expect ( POM . popup . component . option ( 'preventScrollEvents' ) ) . toBe ( false ) ;
1451+ } ) ;
1452+
1453+ it ( 'should allow overriding default popup options' , async ( ) => {
1454+ const { scheduler, POM } = await createScheduler ( {
1455+ ...getDefaultConfig ( ) ,
1456+ editing : {
1457+ allowAdding : true ,
1458+ allowUpdating : true ,
1459+ popup : {
1460+ showCloseButton : true ,
1461+ enableBodyScroll : true ,
1462+ } ,
1463+ } ,
1464+ } ) ;
1465+
1466+ scheduler . showAppointmentPopup ( commonAppointment ) ;
1467+
1468+ expect ( POM . popup . component . option ( 'showCloseButton' ) ) . toBe ( true ) ;
1469+ expect ( POM . popup . component . option ( 'enableBodyScroll' ) ) . toBe ( true ) ;
1470+ } ) ;
1471+ } ) ;
13891472} ) ;
13901473
13911474describe ( 'Appointment Popup Content' , ( ) => {
0 commit comments