@@ -947,6 +947,115 @@ describe('Appointment Form', () => {
947947 POM . openPopupByDblClick ( 'Resource test app' ) ;
948948 expect ( POM . popup . getInputValue ( 'roomId' ) ) . toBe ( 'Room 2' ) ;
949949 } ) ;
950+
951+ it ( 'should create resourceEditorsGroup when resources have no custom icons' , async ( ) => {
952+ const { POM } = await createScheduler ( {
953+ ...getDefaultConfig ( ) ,
954+ dataSource : [ {
955+ text : 'Resource test app' ,
956+ startDate : new Date ( 2017 , 4 , 9 , 9 , 30 ) ,
957+ endDate : new Date ( 2017 , 4 , 9 , 11 ) ,
958+ roomId : 1 ,
959+ ownerId : 2 ,
960+ } ] ,
961+ resources : [ {
962+ fieldExpr : 'roomId' ,
963+ dataSource : [ { text : 'Room 1' , id : 1 } , { text : 'Room 2' , id : 2 } ] ,
964+ } , {
965+ fieldExpr : 'ownerId' ,
966+ dataSource : [ { text : 'Owner 1' , id : 1 } , { text : 'Owner 2' , id : 2 } ] ,
967+ } ] ,
968+ } ) ;
969+
970+ POM . openPopupByDblClick ( 'Resource test app' ) ;
971+
972+ const formItems = POM . popup . form . option ( 'items' ) as FormItem [ ] ;
973+ const mainGroup = formItems . find ( ( item ) => item . name === 'mainGroup' ) as GroupItem ;
974+ const resourcesGroup = mainGroup ?. items ?. find ( ( item ) => item . name === 'resourcesGroup' ) as GroupItem ;
975+
976+ expect ( resourcesGroup ) . toBeDefined ( ) ;
977+ expect ( resourcesGroup ?. items ?. length ) . toBe ( 2 ) ;
978+
979+ expect ( resourcesGroup ?. items ) . toEqual (
980+ expect . arrayContaining ( [
981+ expect . objectContaining ( {
982+ name : 'resourcesGroupContent' ,
983+ itemType : 'group' ,
984+ items : expect . arrayContaining ( [
985+ expect . objectContaining ( {
986+ name : 'roomId' ,
987+ } ) ,
988+ expect . objectContaining ( {
989+ name : 'ownerId' ,
990+ } ) ,
991+ ] ) ,
992+ } ) ,
993+ ] ) ,
994+ ) ;
995+ } ) ;
996+
997+ it ( 'should create individual resource groups when resources have custom icons' , async ( ) => {
998+ const { POM } = await createScheduler ( {
999+ ...getDefaultConfig ( ) ,
1000+ dataSource : [ {
1001+ text : 'Resource test app' ,
1002+ startDate : new Date ( 2017 , 4 , 9 , 9 , 30 ) ,
1003+ endDate : new Date ( 2017 , 4 , 9 , 11 ) ,
1004+ roomId : 1 ,
1005+ ownerId : 2 ,
1006+ } ] ,
1007+ resources : [
1008+ {
1009+ fieldExpr : 'roomId' ,
1010+ icon : 'home' ,
1011+ dataSource : [ { text : 'Room 1' , id : 1 } , { text : 'Room 2' , id : 2 } ] ,
1012+ } ,
1013+ {
1014+ fieldExpr : 'ownerId' ,
1015+ icon : 'user' ,
1016+ dataSource : [ { text : 'Owner 1' , id : 1 } , { text : 'Owner 2' , id : 2 } ] ,
1017+ } ,
1018+ ] ,
1019+ } ) ;
1020+
1021+ POM . openPopupByDblClick ( 'Resource test app' ) ;
1022+
1023+ const formItems = POM . popup . form . option ( 'items' ) as FormItem [ ] ;
1024+ const mainGroup = formItems . find ( ( item ) => item . name === 'mainGroup' ) as GroupItem ;
1025+ const resourcesGroup = mainGroup ?. items ?. find ( ( item ) => item . name === 'resourcesGroup' ) as GroupItem ;
1026+
1027+ expect ( resourcesGroup ) . toBeDefined ( ) ;
1028+ expect ( resourcesGroup ?. items ?. length ) . toBe ( 2 ) ;
1029+
1030+ expect ( resourcesGroup ?. items ) . toEqual (
1031+ expect . arrayContaining ( [
1032+ expect . objectContaining ( {
1033+ name : 'roomIdGroup' ,
1034+ itemType : 'group' ,
1035+ items : expect . arrayContaining ( [
1036+ expect . objectContaining ( {
1037+ name : 'roomId' ,
1038+ } ) ,
1039+ expect . objectContaining ( {
1040+ name : 'roomIdIcon' ,
1041+ } ) ,
1042+ ] ) ,
1043+ } ) ,
1044+ expect . objectContaining ( {
1045+ name : 'ownerIdGroup' ,
1046+ itemType : 'group' ,
1047+ items : expect . arrayContaining ( [
1048+ expect . objectContaining ( {
1049+ name : 'ownerId' ,
1050+ } ) ,
1051+ expect . objectContaining ( {
1052+ name : 'ownerIdIcon' ,
1053+ } ) ,
1054+ ] ) ,
1055+ } ) ,
1056+ ] ) ,
1057+ ) ;
1058+ } ) ;
9501059 } ) ;
9511060
9521061 describe ( 'Recurrence Form' , ( ) => {
@@ -1041,7 +1150,7 @@ describe('Appointment Form', () => {
10411150 expect ( POM . popup . getInputValue ( 'recurrenceStartDateEditor' ) ) . toBe ( '5/1/2017' ) ;
10421151 expect ( POM . popup . getInputValue ( 'recurrenceCountEditor' ) ) . toBe ( '2' ) ;
10431152 expect ( POM . popup . getInputValue ( 'recurrencePeriodEditor' ) ) . toBe ( 'Hour(s)' ) ;
1044- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1153+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
10451154 } ) ;
10461155
10471156 it ( 'should have correct input values for appointment with daily frequency' , async ( ) => {
@@ -1063,7 +1172,7 @@ describe('Appointment Form', () => {
10631172 expect ( POM . popup . getInputValue ( 'recurrenceStartDateEditor' ) ) . toBe ( '5/1/2017' ) ;
10641173 expect ( POM . popup . getInputValue ( 'recurrenceCountEditor' ) ) . toBe ( '2' ) ;
10651174 expect ( POM . popup . getInputValue ( 'recurrencePeriodEditor' ) ) . toBe ( 'Day(s)' ) ;
1066- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1175+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
10671176 } ) ;
10681177
10691178 it ( 'should have correct input values for appointment with week frequency' , async ( ) => {
@@ -1089,7 +1198,7 @@ describe('Appointment Form', () => {
10891198 const expectedWeekDaysSelection = [ true , false , true , false , true , false , false ] ;
10901199 expect ( POM . popup . getWeekDaysSelection ( ) ) . toEqual ( expectedWeekDaysSelection ) ;
10911200
1092- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1201+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
10931202 } ) ;
10941203
10951204 it ( 'should have correct input values for appointment with monthly frequency' , async ( ) => {
@@ -1112,7 +1221,7 @@ describe('Appointment Form', () => {
11121221 expect ( POM . popup . getInputValue ( 'recurrenceCountEditor' ) ) . toBe ( '2' ) ;
11131222 expect ( POM . popup . getInputValue ( 'recurrencePeriodEditor' ) ) . toBe ( 'Month(s)' ) ;
11141223 expect ( POM . popup . getInputValue ( 'recurrenceDayOfMonthEditor' ) ) . toBe ( '1' ) ;
1115- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1224+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
11161225 } ) ;
11171226
11181227 it ( 'should have correct input values for appointment with yearly frequency' , async ( ) => {
@@ -1136,7 +1245,7 @@ describe('Appointment Form', () => {
11361245 expect ( POM . popup . getInputValue ( 'recurrencePeriodEditor' ) ) . toBe ( 'Year(s)' ) ;
11371246 expect ( POM . popup . getInputValue ( 'recurrenceDayOfYearDayEditor' ) ) . toBe ( '1' ) ;
11381247 expect ( POM . popup . getInputValue ( 'recurrenceDayOfYearMonthEditor' ) ) . toBe ( 'May' ) ;
1139- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1248+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
11401249 } ) ;
11411250
11421251 it ( 'should have correct input values for appointment with no end' , async ( ) => {
@@ -1152,7 +1261,7 @@ describe('Appointment Form', () => {
11521261 POM . popup . getEditSeriesButton ( ) . click ( ) ;
11531262 POM . popup . openRecurrenceSettings ( ) ;
11541263
1155- expect ( POM . popup . getInputValue ( 'repeatEndEditor ' ) ) . toBe ( 'never' ) ;
1264+ expect ( POM . popup . getInputValue ( 'recurrenceRepeatEndEditor ' ) ) . toBe ( 'never' ) ;
11561265 } ) ;
11571266
11581267 it ( 'should have correct input values for appointment with end by date' , async ( ) => {
@@ -1168,8 +1277,8 @@ describe('Appointment Form', () => {
11681277 POM . popup . getEditSeriesButton ( ) . click ( ) ;
11691278 POM . popup . openRecurrenceSettings ( ) ;
11701279
1171- expect ( POM . popup . getInputValue ( 'repeatEndEditor ' ) ) . toBe ( 'until' ) ;
1172- expect ( POM . popup . getInputValue ( 'untilEditor ' ) ) . toBe ( '6/1/2017' ) ;
1280+ expect ( POM . popup . getInputValue ( 'recurrenceRepeatEndEditor ' ) ) . toBe ( 'until' ) ;
1281+ expect ( POM . popup . getInputValue ( 'recurrenceEndUntilEditor ' ) ) . toBe ( '6/1/2017' ) ;
11731282 } ) ;
11741283
11751284 it ( 'should have correct input values for appointment with end by count' , async ( ) => {
@@ -1185,8 +1294,8 @@ describe('Appointment Form', () => {
11851294 POM . popup . getEditSeriesButton ( ) . click ( ) ;
11861295 POM . popup . openRecurrenceSettings ( ) ;
11871296
1188- expect ( POM . popup . getInputValue ( 'repeatEndEditor ' ) ) . toBe ( 'count' ) ;
1189- expect ( POM . popup . getInputValue ( 'countEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
1297+ expect ( POM . popup . getInputValue ( 'recurrenceRepeatEndEditor ' ) ) . toBe ( 'count' ) ;
1298+ expect ( POM . popup . getInputValue ( 'recurrenceEndCountEditor ' ) ) . toBe ( '10 occurrence(s)' ) ;
11901299 } ) ;
11911300 } ) ;
11921301 } ) ;
0 commit comments