@@ -1322,6 +1322,81 @@ describe('Appointment Form', () => {
13221322 expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor' ) ) . toBe ( '10 occurrence(s)' ) ;
13231323 } ) ;
13241324 } ) ;
1325+
1326+ describe ( 'Repeat End Values Preservation' , ( ) => {
1327+ [ 'count' , 'until' ] . forEach ( ( repeatEndValue ) => {
1328+ it ( `should preserve repeat end values when switching between recurrence types for ${ repeatEndValue } ` , async ( ) => {
1329+ const { scheduler, POM } = await createScheduler ( getDefaultConfig ( ) ) ;
1330+ const testCount = 15 ;
1331+ const testUntilDate = new Date ( 2017 , 5 , 16 ) ;
1332+
1333+ scheduler . showAppointmentPopup ( {
1334+ text : 'Meeting' ,
1335+ startDate : new Date ( 2017 , 4 , 1 , 10 , 30 ) ,
1336+ endDate : new Date ( 2017 , 4 , 1 , 11 ) ,
1337+ } ) ;
1338+
1339+ POM . popup . selectRepeatValue ( 'daily' ) ;
1340+
1341+ POM . popup . setInputValue ( 'recurrenceRepeatEndEditor' , repeatEndValue ) ;
1342+
1343+ if ( repeatEndValue === 'count' ) {
1344+ POM . popup . setInputValue ( 'recurrenceEndCountEditor' , testCount ) ;
1345+ } else {
1346+ POM . popup . setInputValue ( 'recurrenceEndUntilEditor' , testUntilDate ) ;
1347+ }
1348+
1349+ POM . popup . getBackButton ( ) . click ( ) ;
1350+
1351+ POM . popup . selectRepeatValue ( 'weekly' ) ;
1352+
1353+ POM . popup . openRecurrenceSettings ( ) ;
1354+
1355+ if ( repeatEndValue === 'count' ) {
1356+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor' ) ) . toBe ( `${ testCount } occurrence(s)` ) ;
1357+ } else {
1358+ expect ( POM . popup . getInputValue ( 'recurrenceEndUntilEditor' ) ) . toBe ( '6/16/2017' ) ;
1359+ }
1360+
1361+ scheduler . hideAppointmentPopup ( ) ;
1362+ } ) ;
1363+ } ) ;
1364+ } ) ;
1365+
1366+ describe ( 'Repeat End Editors Disabled State' , ( ) => {
1367+ [ 'never' , 'until' , 'count' ] . forEach ( ( repeatEndValue ) => {
1368+ it ( `should set correct disabled state when repeatEnd is ${ repeatEndValue } ` , async ( ) => {
1369+ const { scheduler, POM } = await createScheduler ( getDefaultConfig ( ) ) ;
1370+ let recurrenceRule = '' ;
1371+ switch ( repeatEndValue ) {
1372+ case 'count' :
1373+ recurrenceRule = 'FREQ=DAILY;COUNT=10' ;
1374+ break ;
1375+ case 'until' :
1376+ recurrenceRule = 'FREQ=DAILY;UNTIL=20170615T000000Z' ;
1377+ break ;
1378+ default :
1379+ recurrenceRule = 'FREQ=DAILY' ;
1380+ }
1381+
1382+ scheduler . showAppointmentPopup ( {
1383+ text : 'Meeting' ,
1384+ startDate : new Date ( 2017 , 4 , 1 , 10 , 30 ) ,
1385+ endDate : new Date ( 2017 , 4 , 1 , 11 ) ,
1386+ recurrenceRule,
1387+ } ) ;
1388+
1389+ POM . popup . getEditSeriesButton ( ) . click ( ) ;
1390+ POM . popup . openRecurrenceSettings ( ) ;
1391+
1392+ const untilEditor = POM . popup . form . getEditor ( 'recurrenceEndUntilEditor' ) ;
1393+ const countEditor = POM . popup . form . getEditor ( 'recurrenceEndCountEditor' ) ;
1394+
1395+ expect ( untilEditor ?. option ( 'disabled' ) ) . toBe ( repeatEndValue !== 'until' ) ;
1396+ expect ( countEditor ?. option ( 'disabled' ) ) . toBe ( repeatEndValue !== 'count' ) ;
1397+ } ) ;
1398+ } ) ;
1399+ } ) ;
13251400 } ) ;
13261401
13271402 describe ( 'firstDayOfWeek' , ( ) => {
0 commit comments